Results 1 to 9 of 9
  1. #1
    SockMonkey is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default How to select an item from a list and add it to a display Java GUI

    Hey everyone,

    Very new to Java and I was wondering if some one would lend me a hand. I'm making an application that will allow users to view several displays
    simultaneously. I'm trying to make it so that the user should be able to select one of the items from a list then hit a radio button add them to the display. And there will be a second button to remove them from the display. Oh and there will always be alteast one display.

    I just don't even know where to start with this. All I have is just the frame itself after that I keep confusing myself.

    Please help if you can

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,007
    Rep Power
    34

    Default Re: How to select an item from a list and add it to a display Java GUI

    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: How to select an item from a list and add it to a display Java GUI

    If you are new to Java it seems you are tackling a relatively difficult project. Even if you have other programming experience, your lack of knowledge of the JDK will make it frustrating. I would recommend you start learning the language first. Before you get to GUI creation you will likely find aspects of Java which will make it eaiser. For starers, check out the tutorials in my signature.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    SockMonkey is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: How to select an item from a list and add it to a display Java GUI

    Unfortunately I have no other option then to do it. I was out sick for a long time and I have to do this project so I need to get my head around it as soon as possible. Thank you for the response I appreciate it!

  5. #5
    SockMonkey is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: How to select an item from a list and add it to a display Java GUI

    Thank you for your help! I'll get cracking into the tutorials! I appreciate your response!

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    13

    Default Re: How to select an item from a list and add it to a display Java GUI

    Curious: what is a "display" ?

    You say you confuse yourself, is that only because you don't know the API or are you also not clear on the requirements perhaps? It might benefit you to create a crude drawing of the application in paint / your favorite painting tool first. Things are just a lot clearer if you have something visual to look at. It takes experience to be able to see the Matrix in your head.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    SockMonkey is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: How to select an item from a list and add it to a display Java GUI

    Quote Originally Posted by gimbal2 View Post
    Curious: what is a "display" ?

    You say you confuse yourself, is that only because you don't know the API or are you also not clear on the requirements perhaps? It might benefit you to create a crude drawing of the application in paint / your favorite painting tool first. Things are just a lot clearer if you have something visual to look at. It takes experience to be able to see the Matrix in your head.
    Hi!

    Ah the reason I confuse myself is because there are some many different variations online. The display is a clock. So I'm attempting to create an application that has multiple clock displays and you can pick and choose what clock you want or don't want to display.

    I just watched a few tutorials online and I am wondering how would you add a second clock that would be an hour ahead?

    so this is what I have for the clock. I'm just wondering how to add in another thats an hour ahead? I got the below code off a video by ILikeChess so credit is to him!

    spain = new JPanel ();
    spain.setLayout(new FlowLayout());
    //Intialise the text field
    //F stands for field
    timeF = new JTextField(10);
    //set to false so time isn't edited
    timeF.setEditable(false);
    timeF.setFont(new Font("Aeriel",Font.PLAIN,48));
    spain.add(timeF);
    add(spain);

    Timer t = new Timer(1000,new Listener2());
    t.start();
    }
    class Listener2 implements ActionListener2{
    public void actionPerformed(ActionEvent e) {


    Calendar rightNow = Calendar.getInstance();

    int hour = rightNow.get(Calendar.HOUR_OF_DAY);
    int min = rightNow.get(Calendar.MINUTE);
    int sec = rightNow.get(Calendar.SECOND);
    timeF.setText (hour + ":" + min + ":" + sec);

    }

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    13

    Default Re: How to select an item from a list and add it to a display Java GUI

    Well I'd do it by creating a Clock class and a ClockPanel class; Clock is the 'model' and ClockPanel is the 'view'. Adding two clocks is creating two Clock instances and two ClockPanel instances and adding the ClockPanel instances to the user interface, somehow.

    But that is only half the problem: how do you want to display multiple clocks? In one frame in a grid for example, or in different internal frames? That is something you need to think about, which is why I recommend drawing a design first.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    SockMonkey is offline Member
    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0

    Default Re: How to select an item from a list and add it to a display Java GUI

    How to select an item from a list and add it to a display Java GUI-world-clock.jpg This is what im looking to put together!

Similar Threads

  1. Replies: 1
    Last Post: 06-29-2011, 03:32 PM
  2. Populate select list with Java/Ajax
    By Jeremy720 in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-20-2011, 04:14 PM
  3. Replies: 4
    Last Post: 12-16-2010, 04:47 PM
  4. Appending and item to a Select List
    By Samurai Coder in forum New To Java
    Replies: 1
    Last Post: 12-04-2009, 11:56 PM
  5. Displaying a Java List in Html:select tag
    By ramitmehra123 in forum New To Java
    Replies: 0
    Last Post: 02-07-2008, 06:48 AM

Posting Permissions

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