Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    Default JcomboBox not working correctly

    I am having difficulty with a jcomboBox reverting to the old settings dispite the fact that i have remove all the model list leaving only A when i click run i am able to select items from the old list how is this possible ?
    also the code below is that behind the clear button
    I am useing netbeans 7.2
    Java Code:
     jLabel17.setIcon(new ImageIcon("C:\\ebay pics\\holdEverything.jpg"));
            jLabel15.setVisible(true);
            jTextField1.setText(null);
            jTextField2.setText(null);
            jTextField3.setText(null);
            jTextField4.setText(null);
            jTextField5.setText(null);
            jTextField6.setText(null);
            jTextField7.setText(null);
            jTextField8.setText(null);
            jTextField9.setText(null);
            jTextField10.setText(null);
            jTextField11.setText(null);
            jTextField12.setText(null);
            jTextField13.setText(null);
            jTextField14.setText(null);
            jTextField15.setText(null);
            jButton3.setVisible(false);
    
            jTextArea3.setText("");
            jTextArea3.setEnabled(true);
            jTextField1.setEnabled(true);
            jTextField2.setEnabled(true);
            jTextField3.setEnabled(true);
            jTextField4.setEnabled(true);
            jTextField5.setEnabled(true);
            jTextField6.setEnabled(true);
            jTextField7.setEnabled(true);
            jTextField8.setEnabled(true);
            jTextField9.setEnabled(true);
            jTextField10.setEnabled(true);
            jTextField11.setEnabled(true);
            jTextField12.setEnabled(true);
            jTextField13.setEnabled(true);
            jComboBox1.setSelectedIndex(0);
            jComboBox2.setSelectedIndex(0);
            jComboBox3.setSelectedIndex(0);
         the code for the jComboBox4 was here and has now been removed and yet clicking the clear button resets to the original value of B
            jComboBox5.setSelectedIndex(0);
            jComboBox6.setSelectedIndex(0);
    
    
            jTextField1.requestFocusInWindow();
            jTextField16.setText(null);

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: JcomboBox not working correctly

    Your question doesn't make any sense to me with that code. Provide an SSCCE to get better help sooner.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    Default Re: JcomboBox not working correctly

    Quote Originally Posted by PhHein View Post
    Your question doesn't make any sense to me with that code. Provide an SSCCE to get better help sooner.

    Thanks for your reply*
    The difficulty is that I have a jcombobox that work ok with the old values, now i need to change those values, so i just selected the properties of the jcombobox and replaced them thinking that was the end of the matter, but not so as when i ran the app again the old values turned up, in addition to this i noticed that when i clicked the clear (jbutton) instead of resetting to the first item in the new list it reset to the first item in the old list despite the fact the old list had been replace in the jcombobox properties
    With regard to the need for an example of the code its noting more than the action performed from the jcombobox *so here is the code behind the jcombobox action performed*
    Java Code:
    private void jComboBox4ActionPerformed(java.awt.event.ActionEvent evt) { * * * * * * * * * * * * * * * * * * * * **
    * * * * // these combo boxes are used to create a storage location
    * * * * // that can only be selected not entered will be adding some automation
    
    
    
    
    * * * * String str = (String) jComboBox4.getSelectedItem();
    * * * * String str1 = (String) jComboBox5.getSelectedItem();
    * * * * String str2 = (String) jComboBox6.getSelectedItem();
    * * * * String total;
    * * * * String sp;
    * * * * sp = " ";
    * * * * total = str + str1 + sp + str2;
    * * * * updater8();// check if ok to turn on html button
    * * * * jTextField14.setText(total);
    * * } *
    All this is doing is creating a storage location for an item based upon the selection of three comboboxes
    To give an example * * *jComboBox4 * selected A * jComboBox5 *selected 2 *and finally jComboBox6 selected 33 *then the total appears in * * * *jTextField14 *as *A2 33
    The main thing I canít understand is how the old values still there*

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

    Default Re: JcomboBox not working correctly

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Why isn't this snipet of code working correctly
    By josho493 in forum New To Java
    Replies: 4
    Last Post: 04-19-2012, 09:59 AM
  2. Help with If/Else not working correctly?
    By kalaiss in forum New To Java
    Replies: 8
    Last Post: 04-16-2012, 06:32 AM
  3. method not working correctly
    By r1b in forum New To Java
    Replies: 4
    Last Post: 01-04-2012, 08:09 PM
  4. Applet not working correctly?
    By Beavotropper2 in forum Java Applets
    Replies: 2
    Last Post: 04-18-2011, 06:32 AM
  5. [SOLVED] \t not working correctly?
    By Gakusei in forum New To Java
    Replies: 5
    Last Post: 05-06-2008, 04:45 PM

Tags for this Thread

Posting Permissions

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