0

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 ?

demongolem
  • 9,474
  • 36
  • 90
  • 105
cypronmaya
  • 520
  • 1
  • 11
  • 24
  • Is `RTextScrollPane` on the `Palette` under `Swing Containers`? – trashgod Apr 11 '12 at 02:07
  • 1
    @trashgod ya, i've added it through tools->palette->Swing/AWT Components – cypronmaya Apr 11 '12 at 04:55
  • If that solves the problem, you could post it as an answer. – trashgod Apr 11 '12 at 05:02
  • @trashgod No, even if i've added it to palette, i can't add it through drag & drop, i've added RSyntaxTextArea though, even i've added RTextScrollPane through custom code in it, but i couldn't see that in Inspector or in Application ....i donnot what to do, BTW i didnt add it to swing containers, i've added it to a new category – cypronmaya Apr 11 '12 at 05:05
  • @trashgod i doesn't matter where it is right? i've added it to Swing containers also, but no luck – cypronmaya Apr 11 '12 at 05:09
  • I was hoping it had been installed automatically and just hidden in another sub-menu – trashgod Apr 11 '12 at 05:11
  • @trashgod is there another way of adding to palette? other than adding from jar file? – cypronmaya Apr 11 '12 at 05:16
  • Not that I know. Edit: I might be worth asking in a Netbeans forum. – trashgod Apr 11 '12 at 05:17

1 Answers1

0

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

*/