How to write an "user control"
- From: clearlight@xxxxxxxxx
- Date: 18 Apr 2007 12:58:09 -0700
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
.
- Prev by Date: Re: javax.swing.JPopupMenu cannot be cast to javax.swing.JMenuItem
- Next by Date: Re: How to detect focus lost on a JPanel
- Previous by thread: javax.swing.JPopupMenu cannot be cast to javax.swing.JMenuItem
- Next by thread: current jtable cell not returned
- Index(es):
Relevant Pages
|