我使用rsyntaxtextarea,我把它添加到Netbeans调色板,这里有两个组件,
An RSyntaxTextArea是主要的文本编辑器类。它扩展了JTextArea,因此它拥有从Swing文本组件中期望的所有标准方法,再加上更具体的处理语法突出显示的方法。
RTextScrollPane是支持行号的JScrollPane的扩展。如果需要,可以使用标准的JScrollPane,但是在编辑源代码时,启用行号通常是很好的。
实际上,我可以通过从调色板中拖动和删除RSyntaxTextArea来添加它,但是对于RTextScrollPane,我不能这样做( RSyntaxTextArea需要比现有的滚动面板感觉更好)。错误消息显示组件不能被实例化,您应该确保它是一个JavaBean。
如何通过拖放在netbeans中添加这两个组件?
发布于 2014-04-04 18:30:57
//试一试;
/**
*
* @author Filipe
*/
public class RTextScrollPaneFlp extends RTextScrollPane {
public RTextScrollPaneFlp() {
super(new RTextEditorSyntaxFlp());
}
}
/**
*
* @author Filipe
*/
public class RTextEditorSyntaxFlp extends RSyntaxTextArea {
public RTextEditorSyntaxFlp() {
super(5, 20);
this.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
this.setCodeFoldingEnabled(true);
Color azulClaro = Color.decode("#E0EEEE");
this.setCurrentLineHighlightColor(azulClaro);
}
}
/*Then right click on the class RTextScrollPaneFlp->Tools->Add to palette.
Create a new category or add the default category "beans".
Done, your component will appear in the palette, I hope that helps.
Enjoy yourself!*/
https://stackoverflow.com/questions/10096532
复制相似问题