Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: how to set a value from a Combobox after Clicking Ok button

  1. #1
    Khan05 is offline Member
    Join Date
    Jul 2011
    Posts
    27
    Rep Power
    0

    Default how to set a value from a Combobox after Clicking Ok button

    Hi Everybody.
    I am trying to make a GUI its have 4 combobox and each combobox have different string values. I am trying to create a Button("OK"). I need to pick some value from each combobox and then click ok button to make changes and exit. And also If I click cancel no changes. Please let me know to performed this action event.

    Thanks

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    Have you read the tutorials on How to Use Combo Boxes and How to Use Buttons (linked from the respective APIs)? Where are you stuck?

    To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

    db
    Fubarable likes this.

  3. #3
    Khan05 is offline Member
    Join Date
    Jul 2011
    Posts
    27
    Rep Power
    0

    Default

    Yes I did, I already create Combobox and "OK" button I entered all the possible value but now I need to select the values from each combobox and after clicking Ok button then need to changed otherwise clicking Cancel no change made.

    Thanks

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    So, far we haven't the slightest clue what you imply by
    need to changed otherwise clicking Cancel no change made
    So where's that SSCCE?

    db

  5. #5
    gauravfzd's Avatar
    gauravfzd is offline Member
    Join Date
    Oct 2010
    Location
    India
    Posts
    72
    Rep Power
    0

    Default

    You should clearly elaborate the problem first.

  6. #6
    Khan05 is offline Member
    Join Date
    Jul 2011
    Posts
    27
    Rep Power
    0

    Default

    I am trying to Make a GUI. I do have 4 combobox.Each combobox have some value for example
    Box one Box two same box 3 box 4. Now, I want pick a value from dropdown list and select
    12 2 from each box. Then click ok button. After submit my ok button it has to
    10 4 make changes and close the Frame. If , I open next time It has to show me
    08 6 all the value I selected.Please if you have any clue about it please let me
    06 8 know. Thank you gyes for your posting.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,925
    Rep Power
    19

    Default

    Quote Originally Posted by Khan05 View Post
    Java Code:
    I am trying to Make a GUI. I do have 4 combobox.Each combobox have some value for example 
    Box one           Box two   same box 3 box 4. Now, I want pick a value from dropdown list and select
    12                   2            from each box. Then click ok button. After submit my ok button it has to 
    10                   4            make changes and close the Frame. If , I open next time It has to show me
    08                   6            all the value I selected.Please if you have any clue about it please let me 
    06                    8            know. Thank you gyes for your posting.
    I was going to ask what those numbers were, but I see it's the example of what's in the drop downs.
    (Just stuck code tags in there so I can see what's going on)

    So you just want to remember between closing and reopening the JFrame the values for those combos?
    Then stick them in a model that lives outside of the frame. When you open the frame then supply those saved values.

Similar Threads

  1. Assigning text in JTable by clicking a button
    By Aiquoc in forum New To Java
    Replies: 3
    Last Post: 06-01-2011, 03:29 PM
  2. Creating a textfield on clicking toolbar button
    By rohaniiitb in forum SWT / JFace
    Replies: 0
    Last Post: 02-14-2011, 12:18 PM
  3. How to open new JFrame with clicking on button?
    By phearless in forum AWT / Swing
    Replies: 1
    Last Post: 01-14-2011, 10:36 AM
  4. Replies: 3
    Last Post: 08-07-2010, 08:06 PM
  5. Get source web page after clicking next Button
    By noob in forum New To Java
    Replies: 1
    Last Post: 03-05-2010, 09:01 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
  •