This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm learning Java from Head First and I'm trying to write a simple GUI program that first asks if the user wants to load a game or start completely over. After that, the user gets to change the values of his character. If the user selected Restore, the TextFields contain the information that he saved last time the game was played.
However, in the method gameGui(), the JVM throws an exception at me saying that Boxlayout can't be shared. I do not understand that at all. Maybe somebody can help =)
The code(Don't worry, the bulk of it is just Swing ;)
Maybe something goes wrong in the panel.removeAll()?
I would be grateful if somebody could help. If you want to see the relatively simple GameCharacter class, here it is:
I can't check to make sure that solves the problem and that it's the only problem, so let us know.
Oh, haha, what a silly mistake by me! Sorry for not posting the error message.
It works perfectly now, thanks a million!
On a side note, do you think that the program was well written? It's my first attempt at making a GUI with some function, so I'd love to hear some feedback =)
Joined: Oct 24, 2010
Glad I could help.
I won't be able to give your code thorough consideration until later today, but I'm sure others will critque its "fitness." Please accept all comments as constructive criticism. This can be a critical group (but mostly friendly) when given the opportunity to critique code.