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
Post a Comment