Hello all
I am having a problem adding a component to a JPanel at runtime. My
code adds a new JTextField. However it does not appear when I click the
add button. The component count of the JPanel does rise by one however
everytime I click the add button so the new JTextfield is being added.
I have noticed that when I click the border of the JFrame the new
JTextfield appears then. I have tried to 'repaint' the frame and the
JPanel but I still cannot see the new added JTextField. I can only see
it when I click on the edge of the frame. It seems to force a refresh.
Can anyone help?
Thanks in advance
Richard
mrandywarner@gmail.com - 17 Nov 2005 20:55 GMT
Try calling :
panel.revalidate();
panel.repaint();
The panel needs to be revalidated to relayout the child components.
Richard - 20 Nov 2005 14:05 GMT
Thanks a lot. That worked fine.
> Try calling :
>
> panel.revalidate();
> panel.repaint();
>
> The panel needs to be revalidated to relayout the child components.