rsyntaxtextarea component add netbeans

819 Views Asked by At

I'm using rsyntaxtextarea , i've added it to Netbeans palette, here it has two components,

An RSyntaxTextArea is the main text editor class. It extends JTextArea, so it has all the standard methods you'd expect from a Swing text component, plus more specific to handling syntax highlighting.

An RTextScrollPane is an extension of JScrollPane that supports line numbers. You can use a standard JScrollPane if you want, but when editing source code, it is often nice to have line numbering enabled.

I can actually add RSyntaxTextArea by dragging and dropping it from palette, but i cannot do that for RTextScrollPane (it is necessary for RSyntaxTextArea to feel better than existing scroll panel). The error message says that the component cannot be instantiated and that you should make sure it is a JavaBean

How can i add these two components in netbeans through drag & drop ?

1

There are 1 best solutions below

0
On

// Try it;

/**
 *
 * @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!

*/