Results 1 to 2 of 2
  1. #1
    jackwong is offline Member
    Join Date
    May 2012
    Rep Power

    Unhappy Add if else statement for jcombobox?

    Hi guys, I'm new to java and I have come to a dead end got no idea how to add a if and else statement to combobox.. help?
    private static String[] times = {"Total Time","1 Hour", "45 Minutes", "30 Minutes", "15 Minutes", "7.30 Minutes", "6 Minutes", "3 Minutes"};
    JComboBox times1 = new JComboBox(times);

    How do add if 1 hour is selected, 45 minutes is selected and so on.. please help thanks..

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: Add if else statement for jcombobox?

    You don't add it to the JComboBox, you would add it to some listener, perhaps an ActionListener that's listening to the JComboBox or to a JButton. Please do yourself a favor and read the JComboBox tutorial to see how this is done. You won't regret doing this.

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2012, 05:27 PM
  2. Need help for a jcombobox
    By Alexis in forum AWT / Swing
    Replies: 4
    Last Post: 09-16-2011, 03:13 AM
  3. Replies: 2
    Last Post: 12-10-2009, 02:58 PM
  4. JComboBox
    By Fosters in forum AWT / Swing
    Replies: 0
    Last Post: 08-10-2008, 02:22 PM
  5. Statement or Prepared Statement ?
    By paty in forum JDBC
    Replies: 3
    Last Post: 08-01-2007, 05:45 PM

Posting Permissions

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