Results 1 to 8 of 8

Thread: Gui

  1. #1
    mayhewj7 is offline Member
    Join Date
    Dec 2008
    Posts
    39
    Rep Power
    0

    Default Gui

    What is the best way to change a class Interface into a GUI ?

  2. #2
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Posts
    185
    Rep Power
    6

    Default

    You can't just "convert it" like that into a GUI, you have to rewrite alot of stuff like if you currently have ASCII menus in a command prompt application you have to design your gui, but you can use code you already have to put in functions, its hard to tell because you didn't give any information. I would completely rewrite it if I were you using your old one as a reference to improve code etc. and to get the GUI.
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  3. #3
    mayhewj7 is offline Member
    Join Date
    Dec 2008
    Posts
    39
    Rep Power
    0

    Default more detail

    I am taking a interface class that i wrote for a program that asks a user for a row and column size, as well as if they want to modify or exit the program. The program displays a grid with a character in the spot where the user enters a row and column.

    I have to take the interfase class that is already written and change it to a GUI. Im not sure how to ask the user through the GUI for the row and column, etc.

    Im not sure how to write my existing code as a GUI, so far I have a textbased Box with a "enter" button and the bottom for the user to select after they enter their input but i know how to display the questions for the user on the screen.

    I dont know if I am making any sense to anyone but hopefully some can help. Thanks a lot.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Unfortunately there are no shortcuts here, so that no one will be able to give you a simple recipe for you to follow. What you should do if you haven't done so already is to go through the Sun Swing tutorials and learn how to create GUI programs. There's a lot to learn here, but it is all ultimately worthwhile. Best of luck.

    Pete

  5. #5
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Posts
    185
    Rep Power
    6

    Default

    If you don't want to learn GUI swing code, get netbeans IDE 6.5. You can just drag and drop elements, pretty easy.
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by MK12 View Post
    If you don't want to learn GUI swing code, get netbeans IDE 6.5. You can just drag and drop elements, pretty easy.
    Right, but what if you want to then modify the GUI code, and because you didn't take the effort to learn Swing, you're stuck in the water without a paddle. My feeling is that putting in a little effort to learn Swing from the ground up will pay off with big dividends.

  7. #7
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Posts
    185
    Rep Power
    6

    Default

    Well if you look at the generated code and don't understand what is going on or can't manually code a few things in (I was assuming enough knowledge to code the Event Methods), then you need to learn more..
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  8. #8
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    It sounds like what you want is a JOptionPane. If you look at the API documentation for it, it explains how to very easily pop up a window with a question, a place for a user to enter text, and 'Ok' and 'Cancel' buttons.

Posting Permissions

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