JAIKISH
April 2nd, 1999, 04:13 AM
Hi,
I have a class that extends Frame. I have two panels in it - one that contains two buttons ("add" and "remove") and the other panel is empty and has FlowLayout as it's layout manager. The panels are added to the Frame using BorderLayout.
I wrote the eventhandler for the "add" button to add a new button to the initially empty panel, each time the "add" button is clicked. I am calling validate() and pack() for the container after adding the new button. Also, I wrote the handler for the "remove" button to remove the last added button. I have got two problems.
1. When I keep adding the buttons, I can't control the size of the Frame and have the new buttons wrapped around, instead the Frame is becoming wider and wider. I tried using setSize but it doesn't work.
2. Component.remove() is not working. I am doing this from an inner class which listens to the "remove" button. I am calling validate() on the container after calling remove. But the button is not removed.
Can anyone help.
thanx in advance
JAIKISH
I have a class that extends Frame. I have two panels in it - one that contains two buttons ("add" and "remove") and the other panel is empty and has FlowLayout as it's layout manager. The panels are added to the Frame using BorderLayout.
I wrote the eventhandler for the "add" button to add a new button to the initially empty panel, each time the "add" button is clicked. I am calling validate() and pack() for the container after adding the new button. Also, I wrote the handler for the "remove" button to remove the last added button. I have got two problems.
1. When I keep adding the buttons, I can't control the size of the Frame and have the new buttons wrapped around, instead the Frame is becoming wider and wider. I tried using setSize but it doesn't work.
2. Component.remove() is not working. I am doing this from an inner class which listens to the "remove" button. I am calling validate() on the container after calling remove. But the button is not removed.
Can anyone help.
thanx in advance
JAIKISH