Results 1 to 2 of 2
  1. #1
    tyimp is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default 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

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    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?


Similar Threads

  1. Separating the digits of given number
    By lb2 in forum New To Java
    Replies: 5
    Last Post: 09-09-2010, 05:29 AM
  2. need a logic for this
    By rajivjoshi in forum New To Java
    Replies: 4
    Last Post: 06-12-2010, 02:18 PM
  3. help with a logic error
    By ShinTec in forum Advanced Java
    Replies: 11
    Last Post: 05-02-2010, 10:19 PM
  4. Separating program logic and GUI
    By loopingman in forum AWT / Swing
    Replies: 0
    Last Post: 12-08-2008, 03:46 PM
  5. Cant get the logic right
    By jermaindefoe in forum New To Java
    Replies: 4
    Last Post: 03-11-2008, 01:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts