Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: GUI

  1. #1
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default GUI

    I've created a program which works well, though I want to now change it into a GUI, would it be better if I integrate GUI code into existing classes or have a separate GUI class which brings together existing classes into an interactive format?

    The program replicates buying items off a website so the GUI would be of a browser. It would be extremely simple, just wondering how to structure it.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: GUI

    In the spirit of pushing you towards an MVC design where there are code components that represent the View (the GUI), the Model (the data) and the connection between the two (the Controller), I suggest you separate the code you have into those parts. It's hard to give specific suggestions without seeing what you have, but imagine separating your existing code into user input (which will become the GUI) and the program logic - reactions to the user's input, data crunching, manipulation, etc. Ideally, the resulting resulting program design would plug in either a component that allows console input or GUI input with little to no change to any other code.

    If you didn't build your code with this goal in mind from the start (and I assume you didn't), then it's likely going to be difficult to draw clear boundaries and make non-intrusive separations. You may find it easier to start over, reusing the logic portion of your existing code when you can. Even though starting over may be easier, the task of separating what you have into stand-alone components may take longer but in the end provide a more significant opportunity to learn valuable lessons. You decide.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    keepStriving (November 27th, 2013)

  4. #3
    Member
    Join Date
    May 2013
    Posts
    165
    Thanks
    58
    Thanked 1 Time in 1 Post

    Default Re: GUI

    Thank you for your advice, I didn't structure my code on the basis of implementing a GUI down the line so I need to start from scratch.
    Thanks anyway.

  5. #4
    Junior Member
    Join Date
    Sep 2013
    Posts
    11
    My Mood
    Bored
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: GUI

    GUI in java has two packages such as AWT and Swing toolkit. Other java components for GUI applications are SWT, SwingX, etc. And JavaFX is a package which consists of rich set of media and graphics and helps to design , create and test GUI applications.

Similar Threads

  1. Help with GUI
    By Malesa in forum AWT / Java Swing
    Replies: 1
    Last Post: August 11th, 2011, 02:55 PM
  2. Replies: 3
    Last Post: February 1st, 2010, 12:24 AM
  3. GUI help
    By ravjot28 in forum AWT / Java Swing
    Replies: 1
    Last Post: January 31st, 2010, 10:19 PM