Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Replacing a specific Jbutton in a grid with 8 new buttons

stup walker
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a package where all the buttons are added to a gridbag (4 rows and two colu) using a function call from the constructur of buttons class again the grid internally contains
a box layout for each row and JButtons are added in this BOX these JButtons
are of Type portButtons which are initialized in other class portButtons which is in diffrent .java file.The Listener are implemented in portButtons class.
Now i needs to be replaced the button from top row with 8 new buttons when the Button corresponding to it in third row is clicked.
IS there any method by which i can dynamically remove the components of JPanel in action listener and replace it with 8 new buttons and also romving and readding the other components of to use paint and repaint method to remove and add new buttons.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic