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 3 of 3

Thread: ComboBox and TextField

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ComboBox and TextField

    Hello, I am creating a program and I'm using JComboBox and textfield. what i want is when ever the user selects an item from the ComboBox its supposed to show up text for example (A) in the textfield.
    I'm trying to use if statement but i do know how please help
    the combo box model contact :
    5000
    15000
    20000
    25000
    30000
    35000
    40000


     private void ServiceTypeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                                     
     
     
            if (KmsComboBox.equals(5000))
     
            {
                ServiceTypeTextField.setText("A Service");
            }
     
            else
            {
               ServiceTypeTextField.setText(" ");
            }
     
     
        }


  2. #2
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    491
    Thanks
    8
    Thanked 47 Times in 45 Posts

    Default Re: ComboBox and TextField

    Cross posted and already answered
    JComboBox and JTextField - Java Forums

    db

  3. #3
    Junior Member
    Join Date
    Sep 2009
    Location
    zambia
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: ComboBox and TextField

    i think all the package importation should be done at the beginning of the code..otherwise this should work but try to separate importation from the actual code..

Similar Threads

  1. JComboBox and Textfield
    By Nexusfactor in forum AWT / Java Swing
    Replies: 3
    Last Post: November 9th, 2009, 11:57 AM
  2. Struts combobox edit
    By kalees in forum Web Frameworks
    Replies: 2
    Last Post: November 1st, 2009, 12:27 AM
  3. Combo/TextField Help
    By GRossi0511 in forum AWT / Java Swing
    Replies: 2
    Last Post: October 26th, 2009, 08:15 PM
  4. do actions in ComboBox
    By java_cs in forum AWT / Java Swing
    Replies: 2
    Last Post: October 1st, 2009, 10:53 AM
  5. Java program to display 2D Array in ComboBox
    By crazydeo in forum AWT / Java Swing
    Replies: 1
    Last Post: May 29th, 2008, 09:13 AM