How to write an "user control"



Hi.

Being new to Java and coming from VB, I decided to call it "user
control", although I don't know how I should call it in this new world
(is it a "Widget"?)

If I write a test class extending JPanel, and add the component to it
simply like:

public TestPanel() {
super();
elCodeBox = new CodeBox("Cuentas", "Codigo", "titulo");
elCodeBox.setVisible(true);
this.add(elCodeBox);
}

the component shows perfectly.

But I am using NetBeans, and if one wants to use the designer one has
to add it as a "JPanel Form". NetBeans inserts a lot of read only code
to deploy components according to a layout (and does a good job with
it). But after all that code has been executed, the simple way to add
a component to the frame doesn't work anymore.

So, my solution would be how to add a new option to the component
panel of NetBeans, or else how to add a component to a heavily laid
out panel.

I did some searching on the Web, but no solution works on NetBeans
generated panels.


Thanks

.



Relevant Pages

  • Re: NetBeans 5.0 is here! (for those interested)
    ... Where the previous version clearly displayed the "Netbeans square" this ... library was easily converted into my 5.0 settings. ... fact that you cannot tell netbeans to allways use the advanced option panel. ... one point really bugged me: the new version control support. ...
    (comp.lang.java.programmer)
  • Re: Wie macht ihr GUIs?
    ... ob man ein neues GUI-Element einfügt. ... von Netbeans 6.1. ... Ich habe mehrere JPanels nebeneinander, Elemente von Panel 1 an Elementen von Panel 2 auszurichten scheint wohl nicht möglich zu sein. ...
    (de.comp.lang.java)
  • [netbeans image]addition of a background pattern in a Panel
    ... I know how to add an image in a Panel with Netbeans but I want to add a background pattern with Netbeans in a Panel like can be easily done in HTML: ... - you just have to provide the pattern and the background is filled with it wathever the dimensions of the Panel. ...
    (comp.lang.java.help)
  • jLabel on jPanel
    ... Using Netbeans 6.1 ... I have a desktop application with one JPanel. ... I drop a jLabel on the panel and set its properties and I see it there on ... How do I make it visbile on the panel when I run the application ??? ...
    (comp.lang.java.beans)