swing - How to add JTextField in time running in Java? -


in order develop edit text in java study. i'm problem: program once opened user, if user click in button "search", actionlistener add field in jpanel.

for example: have class jtoolbar sets jtoolbar menu extends jpanel. then, add in jframe. within jtoolbar there's button "search", if user click @ button, jtextfield appears side menu instantly.

i try create class private within jtoolbar class. so, add jtextfield jpanel contains jtoolbar. however, not working. there's no error. not appears jtextfield. solve problem ?

when add component visible gui general code is:

panel.add(...); panel.revalidate(); panel.repaint();  // needed 

you need revalidate() tell layout manager component has been added.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -