Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Removing a JButton from a panel. Help. :(

843805Mar 22 2007 — edited Mar 22 2007
Code:
gui1[0].addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
panelTop.remove(game.gui1[1]);
}
});
gui1[] is an array of JButtons. I added them to the panel by this:
panelTop.add(game.gui1[0]);
panelTop.add(game.gui1[1]);
panelTop.add(game.gui1[2]);
Whenever I click gui1[0] JButton, it doesn't disappear! It looks like it's pressed (blackened), and it stays like that. I can't click it, but I still see it. :( How do I make it disappear?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2007
Added on Mar 22 2007
18 comments
311 views