首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何向组件端RSyntaxTextArea显示行数

如何向组件端RSyntaxTextArea显示行数
EN

Stack Overflow用户
提问于 2014-04-04 12:25:10
回答 1查看 182关注 0票数 0

如何显示组件-> RSyntaxTextArea旁边的行数

下面的代码可以工作,但是我需要使用特定的组件来代替我的框架,当我这样做的时候,旁边的行就消失了。

代码语言:javascript
复制
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.flp.entidades;

import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JFrame;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;

/**
 *
 * @author Filipe
 */
public class TextEditorRSyntax extends JFrame {

    public TextEditorRSyntax() {

        JPanel cp = new JPanel(new BorderLayout());

        RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60);
        textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
        textArea.setCodeFoldingEnabled(true);
        RTextScrollPane sp = new RTextScrollPane(textArea);
        cp.add(sp);

         Color azulClaro =  Color.decode("#E0EEEE");
        textArea.setCurrentLineHighlightColor(azulClaro);
        setContentPane(cp);
        setTitle("Text Editor Demo");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setLocationRelativeTo(null);

    }

    public static void main(String[] args) {
        // Start all Swing applications on the EDT.
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new TextEditorRSyntax().setVisible(true);
            }
        });
    }

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-18 12:07:23

好孩子,文档是你的朋友

代码语言:javascript
复制
sp.setLineNumbersEnabled(true);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22862763

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档