Remove all and recreate it
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Can you make a small,simple program that compiles, executes and shows what you are trying to do?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
What happens when you execute this code? I get the following:
lang.ArrayIndexOutOfBoundsException: 5
Recommendation for testing code: Don't require user input. Hardcode a test value:
newSize = 7; //in.nextInt(); //<<<<<<<<<<<<<<<<
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
put in a number smaller than the original size
That is the reason I suggested you use a hardcoded value so we would all test with the same data.
Try removing everything and rebuiding the GUI's contents.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
what the problem is
You are not removing the components.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Where do you remove the components from the container? Your code removes them from the layout manager.
Won't you need a new layout manager when the size of the grid changes?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Question Answered as of 1 Year Ago by
NormR1