Re: custom Swing component
- From: Roedy Green <look-on@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Sep 2005 07:16:40 GMT
On 27 Sep 2005 23:51:55 -0700, "Chanchal" <chanchal.jacob@xxxxxxxxx>
wrote or quoted :
>i want to create a custom component with a text field and a button. i'm
>using netbeans IDE.when i place it to a container and resize the
>component, i want the text field to be resized accordingly. how would i
>do that. please help
Just create a create a ChanchalPanel class that extends JPanel.
in your constructor set up a layout manager.
add the JTextField and JButton.
hook up some listeners.
Now instantiate an instance of the ChanchalPanel and add it to some
bigger container and eventually validate the whole shebang and
setVisible( true ).
For something that simple, you might use a JOptionPane if you just
want it to pop up and go away.
see http://mindprod.com/jgloss/Jpanel.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
.
- Follow-Ups:
- Re: custom Swing component
- From: Chanchal
- Re: custom Swing component
- References:
- custom Swing component
- From: Chanchal
- custom Swing component
- Prev by Date: custom Swing component
- Next by Date: Re: Solaris 8 and Java 1.5 GUI problem
- Previous by thread: custom Swing component
- Next by thread: Re: custom Swing component
- Index(es):