Results 1 to 2 of 2
- 10-05-2010, 10:49 PM #1Member
- Join Date
- Oct 2010
- Rep Power
Problems separating GUI from Logic
Hell, i am having problems with a dice game that i am making.
First i made the logic of the game, then i made the GUI (NetBeans gui builder), and i want to have the logic update the gui with information about whats going on in the game.
I create a gui object in my logic class and i would like to call setter methods on it in order to post numbers into jLabels in the gui.
one thing im having trouble with is that there is a roll button and start game button in the gui so those need to be able to access the logic to start the game and get dice values.
Everytime i try to set values in the gui from the logic, it gives me null pointer exceptions and i have no idea why. can anyone help me figure out a better way to have this work?
I realize this is a very broad question and probably will not get any responses but i dont know what to do now
- 10-06-2010, 04:32 AM #2
The answer is very simple: ditch the NetBeans GUI builder and write code that you can understand and maintain.
At sometime down the line, one becomes adequately proficient in Java and GUIs to be able to use the GUI builder effectively. That time hasn't yet come for me and I'm hazarding a guess that it hasn't yet come for you.
Why use a feature that makes one thing -- layout -- easier, and has a steep learning curve for just about everything else?
- By lb2 in forum New To JavaReplies: 5Last Post: 09-09-2010, 05:29 AM
- By rajivjoshi in forum New To JavaReplies: 4Last Post: 06-12-2010, 02:18 PM
- By ShinTec in forum Advanced JavaReplies: 11Last Post: 05-02-2010, 10:19 PM
- By loopingman in forum AWT / SwingReplies: 0Last Post: 12-08-2008, 02:46 PM
- By jermaindefoe in forum New To JavaReplies: 4Last Post: 03-11-2008, 12:22 AM