2014-04-04 4 views
0
구성 요소 옆에 줄 수를 표시하는 방법

-> RSyntaxTextArea구성 요소 측면 RSyntaxTextArea에 행의 수를 표시하는 방법

작품 아래의 코드는,하지만 대신에 특정 구성 요소를 사용할 필요가 내 프레임, 내가 이것을 할 때, 옆에 줄이 사라집니다.

/* 
* 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); 
      } 
     }); 
    } 

} 

답변