JComboBox event ItemChanged is called repeatedly

Hi all,
I've got an JApplet with 2 JComboBoxes. The first both of them are added to ItemListener.
When a entry of the first ComboBox is selected I delete
the contents of the second one and add other contents.
(I have to do so)
The problem :
The itemStateChanged event occurs of Combo2 occurs
after itemStateChanged of Combo1 and vice versa multiple times.
How can I avoid this. When I select an item from combo1
only this event should occure. When I select an item from combo2 only this event should occure.
public void itemStateChanged(ItemEvent ie) {
      String sName = (String)ie.getItem();
      if(ie.getSource() == ((CQdbl_Beanstandung)m_appletParent).jchoBereich) {
         if(ie.getStateChange() == ItemEvent.SELECTED) {
            //department BML-V1  and BML-V2 have the same masks
            if(sName.compareTo("BML-V2") == 0) {
               ((CQdbl_Beanstandung)m_appletParent).setBmlv2();
            } else  if(sName.compareTo("BML-V1/WE") == 0) {
               ((CQdbl_Beanstandung)m_appletParent).setBmlv1we();
            } else  if(sName.compareTo("BML-V1/WA") == 0) {
               ((CQdbl_Beanstandung)m_appletParent).setBmlv1wa();
            //get new form contents
            ((CQdbl_Beanstandung)m_appletParent).refreshForm();
      } else if(ie.getSource() == ((CQdbl_Beanstandung)m_appletParent).jchoVerursacher) {
         if(ie.getStateChange() == ItemEvent.SELECTED) {
            ((CQdbl_Beanstandung)m_appletParent).setKst();

make a variable itemStateThatOughtToBe
in your ItemListenrer first ask if the current itemstate is istemStateThatOughtToBe. if return else execute your normal code.
If you don't want the itemlistener to become active with this particualr change first set ItemStateTahtOughttoBe and then change the item

Similar Messages

  • How do I enter an event in Calendar and repeat it every 3rd day

    How do I enter an event in Calendar and repeat it every 3rd day

    Hello PatrickMaryAnn,
    Thanks for the question, and welcome to Apple Support Communities.
    When editing or creating an event, choose Repeat > Custom… - then choose "Daily" and enter Every 3 days.
    Calendar: Update or delete an event
    http://support.apple.com/kb/PH11509
    Thanks,
    Matt M.

  • JTAPI events of incoming calls

    Hello.
    I use JTAPI library to receive CallEvents in my application. Everithing works fine, but when one CUCM user calls another, I receive events only from caller number, not from called number.
    But when CUCM user receives call from outside (PSTN, for example), it sends me all events I need.
    Need help with this.

    Your My Verizon lists all the phone calls you send or receive.  Your bill each month also lists your calls.

  • JComboBox event confusion: not enough generated? :-(

    Hi,
    I am slightly confused about the events generated by the combobox.
    I have a combobox and and actionlistener registered on it. If I programmatically use setSelectedIndex on the combobox, and event is generated and the actionlistener is triggered. If I do a setSelectedIndex on the same combobox within the code of the action listener, no event is generated, though the index does get updated. Though I am happy it doesn't generate that event, I don't understand why it doesn't. Anyone?
    Rene'

    Instead of using ActionListener you should use ItemListener for combo box. This is an example
    comboBox.addItemListener(new java.awt.event.ItemListener() {
         public void itemStateChanged(ItemEvent e) {
         try {
         JComboBox box = (JComboBox) e.getSource();
         System.out.println(box.getSelectedItem());
         } catch (ArrayIndexOutOfBoundsException exp) {}
    });Note: Item Listener only listens when you change something in Combo Box. If you click on a combo box, and selects the same value, item listeners doesn't call.
    Hope this helps.

  • JComboBox Event? How do I know when a JComboBox has been clicked?

    What event is fired when a JComboBox is pressed?
    I can tell when an item has been selected but I want
    to know when the combobox was clicked originally.

    Two (untested) ways of doing this:
    1. Subclass JCombobox and fire an event when the box is opened. To find out when its opened, you'll probably have to look at the source for JCombobox and override the method.
    2. use the model as a clue. Chances are the underlying combo box model will have its getValueAt() method called when the user opens the drop down box. Cant be sure that thats the only time itll happen tho,,
    DS

  • Not able to reach start of selection event in the called program

    hi,
    I have a report 1 in which i am calling report2 using below syntax,
    SUBMIT Report2  VIA JOB gv_jobname NUMBER gv_jobcount
                 WITH s_g_yr  IN s_g_yr
                 WITH s_c_rf  IN s_c_rf
    AND RETURN.
    the problem is when report 2 is called it exists after event "at selection screen output" and does not go in the event "start of selection". 
    Please advise. how can i reach the "start of selection" event where all the processing logic is specified..
    Thanks and Regards,
    Kriti

    Hi,
    In your report you have used the event AT SELECTION-SCREEN OUTPUT. So, first it will trigger this event and then it will go for START-OF-SELECTION event.
    Events will trigger in this following way.
    LOAD PROGRAM
    INITIALIZATION
    AT SELECTION-SCREEN
    AT SELECTION-SCREEN OUTPUT
    START-OF-SELECTION
    END-OF-SELECTION
    TOP-OF-PAGE
    END-OF-PAGE
    In above sequence events will trigger in report.
    Regards,
    Shankar.

  • JComboBox event notification when select first entry in pop-up menu JDK 6

    I recently began testing a Java GUI, I originally developed with JDK 1.5.0_11, with JDK 1.6.0_3. I have used the JComboBox in several applications developed using JDK 1.3.x and 1.4.x over the years. In every one of these earlier JDKs the JComboBox widgets all behaved the same. When you select the JComboBox widget, the pop-up menu appears and you can select any of the items from the menu list. Having made the selection with either a mouse click or a key press, an event notification is sent. Typically, an ActionEvent as well as either a mouse click event or a keypressed event may be sent. When testing with 1.6.0_x versions of the JDK and JRE, I can't account for any event notification being sent when selecting the first item at the top of the pop-up menu as the initial selection. If I select some other item on the list and then the first item, it works as it is supposed to work, but only after selecting another item first.
    I've placed the JComboBox in a JDialog and a JPanel. There are NO AWT widgets in any containers of the application. The same behavior seems to exist regardless of what other containing Swing component I place the JComboBox in. I'm running these applications on Windows XP, service pack 2. The system is an AMD 64 bit dual processor with 4Gb of RAM. The essential code follows:
    private JComboBox getJcboAlias()
        /* Note here that I am using a defaultComboModel as I have always done */
       jcboAliases = new JComboBox(urls);
       *jcboAliases.setEditable(false);*                               // Note here that the JComboBox is NOT editable
       jcboAliases.addActionListener(new ActionListener()   // ActionListener only receives a notification if the second or
       {                                                                            // another item in the pop-menu list is selected...but never the
          public void actionPerformed(ActionEvent ae)           // first item in the list
             String s = (String) jcboAliases.getSelectedItem();
             for (int i = 0; i < connections.size(); i++)
                conAlias = (String[]) connections.get(i);
                if (s.equals(conAlias))
    isSelected = true;
    break;
    jlblName.setVisible(true);
    jlblAlias.setVisible(true);
    jlblUID.setVisible(true);
    jlblPWD.setVisible(true);
    jtxtName.setText(conAlias[0]);
    jtxtName.setVisible(true);
    jtxtAddress.setText(conAlias[1]);
    jtxtAddress.setVisible(true);
    jtxtUID.setText(conAlias[2]);
    jtxtUID.setVisible(true);
    jtxtPWD.setVisible(true);
    jtxtPWD.setText("");
    jtxtPWD.requestFocus();
    return jcboAliases;
    }    I'm using a non-editable JComboBox because there is a pop-up menu with this and not with the JList widget.  JComboBox behaves more like the JList MicroSoft counterpart.  Another code snippet follows in which the JComboBox is editable.  The same errant behavior occurs when selecting the first item from the pop-up menu: private JComboBox getJcboPCMember()
    jcboPCMember = new JComboBox(PCViewerCustom.getCurrentMembers());
    jcboPCMember.setBounds(250, 103, 180, 20);
    jcboPCMember.setToolTipText("PATHCHECK(ER) member name - Example: CKPPTHCK");
    jcboPCMember.setSelectedIndex(Integer.valueOf(PCViewerCustom.getCurrentHost(3)));
    jcboPCMember.setEditable(true); // Note here that this JComboBox IS editable
    jcboPCMember.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    if (ae.getActionCommand().equals("comboBoxEdited"))
    boolean copy = false;
    for (int i = 0; i < jcboPCMember.getItemCount(); i++)
    if (jcboPCMember.getSelectedItem().equals(jcboPCMember.getItemAt(i)))
    copy = true;
    break;
    if (!copy)
    if (jcboPCMember.getItemCount() > 0)
    if (jcboPCMember.getItemAt(0).equals("No Entries"))
    jcboPCMember.removeItem("");
    jcboPCMember.removeItem("No Entries");
    jcboPCMember.insertItemAt((String) jcboPCMember.getSelectedItem(), 0);
    else
    jcboPCMember.removeItem("");
    jcboPCMember.addItem((String) jcboPCMember.getSelectedItem());
    enableJbtnOK();
    else
    if (jcboPCMember.getSelectedIndex() >= 0)
    PCViewerCustom.setCurrentHost(3, Integer.toString(jcboPCMember.getSelectedIndex()));
    enableJbtnOK();
    else
    JOptionPane.showMessageDialog(null, "Name not selected", "Error", JOptionPane.ERROR_MESSAGE);
    return jcboPCMember;
         I am able to add a new entry to the JComboBox, however, I am still unable to select the first item from the pop-up menu and fire any kind of notification event.  I have not seen this behavior before in any earlier versions of the JDK and it's playing havoc with my ability to deploy the application into a JDK or JRE V6 environment, without adding a bunch of additional code to pre-select the first item on the list, which pretty much defeats the purpose of the JComboBox.  I'll be the first to admit I've done something wrong, but i've built a number of test scenarios now on two systems runing Win XP SP2 and I get the same errant behavior.  I've also added in event listeners for a MouseListerner, a KeyListener and an ItemListener.  Still no event notification on this first item in the list.  Again, however, if I select one of the other items from the pop-up menu list and then select the first item, all is well.  Imagine selling that method of operation to a user....  It occurs to me that this must be a bug in the V6 JComboBox.  I wanted to post this here first, however, in order to determine if this is, in fact, a bug - in other words, am I the only one seeing this, or is this a more widespread issue?  Any assistance in making this determination is greatly appreciated.
    David Baker
    Edited by: Galstuk on Nov 27, 2007 12:21 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    here is the other file as well:
    Harold Timmis
    [email protected]
    Orlando,Fl
    *Kudos always welcome
    Attachments:
    VI2.vi ‏5 KB

  • Global class event handler not called

    I am having a problem where I created a function module that instatiates an application log class. This application log class has methods ON_* for public events of other classes.
    The function module then processes its routines and as a result some of these events are raised. Ex: The function module creates a Purchase order and in that class I have a public even PO_CREATED that is raised upon succesfull creation of the PO. The global class APPLICATION_LOG I created has a method ON_PO_CREATED for event PO_CREATED of class ZCL_MAT_PO.
    I put a break point in the APPLICATION LOG method but is os not called.
    ANy idea of what Iam doing wrong or missing?
    Thanks,
    Leo

    Hi Leo, did you set the handler method?
    SET HANDLER <method_name> FOR <object>.
    Regards,
    Rich Heilman

  • A Calendar event that is to repeat N times sometimes need to be specified as repeating N 1 times

    Under Mountain Lion, iCal's successor, Calendar, doesn't always handle repeating events correctly.
    If I want an event to repeat every week for N weeks, sometimes I need merely fill in Stop After N Times.
    But sometimes I have to fill in Stop After N+! times.
    There's some code somewhere that is having trouble crossing month boundaries as it counts the recurrences of the event.
    Any work-arounds (other than noticing the problem and changing the count)?

    No one here would be privi to Apple's plans on the matter. Submit your feedback to Apple requesting such a feature:
    http://www.apple.com/feedback
    In the interim, there is a reminder program for pretty much every need and taste in the App Store.

  • JComboBox event problem

    Hi ,
    I have JComboBox in my application. I added action listener for this. When I set the values programmatically I don't want the code in the actionperformed to be executed. I can do it indirectly by using boolean flag for this, but I want to know is there any other (neat) way we can achieve this.
    Thanks

    You can always check to see if there is a selected index...
    myComboBox.addActionListener
         new ActionListener()
              public void actionPerformed(ActionEvent e)
                   if (((JComboBox)e.getSource()).getSelectedIndex() != -1)
                        //perform your operations here.
    );Another way to do it would be to write your own custom action listener and consume() any event that you don't want.
    Hope that helps.

  • JComboBox Event Handling

    Editable JComboBox (combo1.setEditable(true)) is not adhering to KeyEvents such as keyTyped() and keyReleased() events.
    How can I make a "Editable" JComboBox to adhere KeyEvents.

    a comboBox is made up of many components.
    when editable there is a JTextField
    you need to get the textfield to add the keylistener
    combo.getEditor().getEditorComponent().addKeyListener(new KeyAdapter()
    other times you may need to cast it
    ((JTextField)combo.getEditor().getEditorComponent()).someMethod()

  • JComboBox events

    Is it possible to have the event handling for a JComboBox in another class?
    I'm using MVC architecture and so would like my View's JCBs to be handled by the Controller, but I can't get the Controller to recognise different JCBs with getSource()....
    Is there something like
    if (e.theView.getSource()==combo1)
    do this;
    else if (e.theView.getSource()==combo2)
    do this;
    }

    OOps. Realized what I was doing wrong.

  • JComboBox events as TableCellEditor

    I'm using a subclass of JComboBox as a TableCellEditor, and it isn't firing the same events as it does outside the table. For instance, when the combobox has editable focus, I can use the arrow keys to move the selection up and down the menu, and outside the Table, everytime I move the selection in this way, it sets the appropriate SelectedItem and SelectedIndex properties of the ComboBox to match my selection. But in the table, it doesn't set these properties just by chaning the selection in this way. It also doesn't fire an ItemChangeEvent like it does outside the table.
    Anyone know why this is happening and how I can work around it?
    Thanks.

    well, the keyinputhandler was a class in JClass's table extension!
    there was a traverse() method which we had to stick a requestFocus() in to make sure that all the right listeners were invoked from a 'move' event....
    not entirely sure where you'd stick it in normal swing JTables....!
    (apols!)

  • BP_CONFIRM does not triggers the event properly from call list

    Hi expert,
    We have upgrading CRM 5 to 7.
    The issue is. In the IC_AGENT role. When i got to call list and select a call. The corresponding bp is automatically conformed.
    But then when i go to Account identification navigation link i can only see the bp confirmed. the vehicle  info of the BP are not displayed the view remains the same. normally it displays the vehicle details in the result view.
    If i directly search for a BP and conform it all the vehicle detail are displayed in the result views.
    It happens only when a BP is automatically conformed by selecting from the call list.
    But in both the cases the Method  "CL_CRMCMP_B_CUCOBUPA_IMPL->BP_CONFIRM" is triggered ( it is a customer control in CRMCMP_BPIDENT/CuCoBuPa )
    the difference i can find is.
    if i conform a bp manually from the account identification screen. the CL_ICCMP_AU_VEHISEARCH_IMPL->IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT is triggered. ( which is inside the "ICCMP_AUTO_VEHI/VEHISearch" ) which displays the required view.
    but when the same BP_CONFIRM is triggered automatically from the call list management view it is not triggering CL_ICCMP_AU_VEHISEARCH_IMPL->IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT. ( which is inside the "ICCMP_AUTO_VEHI/VEHISearch" ).
    so i can see the difference in the event listeners of the 2 process.
    below is the piece of code which triggers the event. it is in the method "CL_CRMCMP_B_CUCOBUPA_IMPL->BP_CONFIRM" d ( it is a customer control in CRMCMP_BPIDENT/CuCoBuPa )
    raise event BPConfirmed and/or CPConfirmed
        IF lv_bp_confirm EQ abap_true.
          CLASS cl_crm_ic_services DEFINITION LOAD.
          CREATE OBJECT event.
          event->set_name( if_crm_ic_events_con=>gc_bpconfirmed ).
          event_srv = cl_crm_ic_services=>get_event_srv_instance( ).
          event_srv->raise( event ).
        ENDIF.
    Can any one help me how to register  the event or trigger the CL_ICCMP_AU_VEHISEARCH_IMPL->IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT is triggered. ( which is inside the "ICCMP_AUTO_VEHI/VEHISearch" )
    when i click on call list.
    thanks in advance
    chella.

    Hi expert,
    We have upgrading CRM 5 to 7.
    The issue is. In the IC_AGENT role. When i got to call list and select a call. The corresponding bp is automatically conformed.
    But then when i go to Account identification navigation link i can only see the bp confirmed. the vehicle  info of the BP are not displayed the view remains the same. normally it displays the vehicle details in the result view.
    If i directly search for a BP and conform it all the vehicle detail are displayed in the result views.
    It happens only when a BP is automatically conformed by selecting from the call list.
    But in both the cases the Method  "CL_CRMCMP_B_CUCOBUPA_IMPL->BP_CONFIRM" is triggered ( it is a customer control in CRMCMP_BPIDENT/CuCoBuPa )
    the difference i can find is.
    if i conform a bp manually from the account identification screen. the CL_ICCMP_AU_VEHISEARCH_IMPL->IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT is triggered. ( which is inside the "ICCMP_AUTO_VEHI/VEHISearch" ) which displays the required view.
    but when the same BP_CONFIRM is triggered automatically from the call list management view it is not triggering CL_ICCMP_AU_VEHISEARCH_IMPL->IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT. ( which is inside the "ICCMP_AUTO_VEHI/VEHISearch" ).
    so i can see the difference in the event listeners of the 2 process.
    below is the piece of code which triggers the event. it is in the method "CL_CRMCMP_B_CUCOBUPA_IMPL->BP_CONFIRM" d ( it is a customer control in CRMCMP_BPIDENT/CuCoBuPa )
    raise event BPConfirmed and/or CPConfirmed
        IF lv_bp_confirm EQ abap_true.
          CLASS cl_crm_ic_services DEFINITION LOAD.
          CREATE OBJECT event.
          event->set_name( if_crm_ic_events_con=>gc_bpconfirmed ).
          event_srv = cl_crm_ic_services=>get_event_srv_instance( ).
          event_srv->raise( event ).
        ENDIF.
    Can any one help me how to register  the event or trigger the CL_ICCMP_AU_VEHISEARCH_IMPL->IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT is triggered. ( which is inside the "ICCMP_AUTO_VEHI/VEHISearch" )
    when i click on call list.
    thanks in advance
    chella.

  • EVENT structure remembers events from previous call?

    LV2013, Win7
    My customer has complained about this misbehavior, and I made a basic VI to show it.  No one noticed this behavior in LV 7, 8, or 2010.
    Given a SubVI with a RETURN button, that is set to SHOW FP WHEN CALLED and CLOSE IF ORIGINALLY CLOSED, then we have what seems to be a misbehavior by LabVIEW.
    The SUBVI is normally closed.  If you run the TEST vi and click the DO IT button, the subVI comes up.
    If you click the RETURN button TWICE, during that five-sec interval, the button sticks in the DOWN position.  I understand that.
    When the timer expires, the window closes.  I understand that.
    If you click the DO IT button again, the window comes up again.  I understand that.
    But the window will close BY ITSELF, after another 5 seconds !  I DO NOT understand that.
    Even if bringing up the window acts to pop out the button, that cannot cause termination, because termination is caused by a VALUE CHANGED event, changing to TRUE!    But it does.
    I tried limiting the events in the queue to 1, no change in behavior.
    Attached is a test vehicle, try it yourself.
    Is this a bug in my thinking, or a bug in LabVIEW?
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks
    Attachments:
    TestEventQueue.zip ‏16 KB

    when you define a static event, the registration for that event (that's the point where it starts queueing up events) happens as soon as the VI that the structure is in enters run mode. That doesn't mean that the VI is actually running, but rather that it is running or reserved for running. The unregistration happens when the VI leaves run mode.
    OK, I understand that.  Although I didn't think about it before, that makes good sense.  The dynamic registration system is the root behavior, the statis stuff just supplies fixed references at RUN MODE time. Fine.
    But how is it that the second call, which depends on a VALUE CHANGED event, with a value of TRUE, doesn't just get ignored?
    OIC - what is queued is the original event, which IS a transition from false to TRUE.
    Funny - I've used LabVIEW for 25 years and never noticed this issue myself.  I guess I thought the event queue was flushed when the window came up.
    So, I should use a FLUSH EVENT QUEUE at the start of every such VI, I guess.  I don't want to add a time-check to every single event case.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

Maybe you are looking for

  • JNLP - Swing application compiled in jdk1.5 not working in jdk1.6

    I have one swing application, compiled in jdk 1.5 and deployed in JNLP with jdk 1.5. When client machine try to access the application and having jre 1.5 then it works fine. but if client machine having jre 1.6 or version greater than 1.5 then applic

  • Goods return against maintenance work order exceeds goods issue

    Is there a way to prevent returning more quantity (262 movement type done within MB1A) than was issued (261 movement type done within MIGO_GI) against a maintenance work order component? Thanks in advance, Rick

  • Jtree custom selection

    I use the jTree. When an element is selected - i dont like how it looks. Check the screenshot : there are two selected areas - a standart one (top) and a custom one(bottom), dont pay attention to the gradient. The designer made an improved variant. A

  • 9i and 10g Installation

    Have oracle 9ir2 installed first and I then installed 10g, but 10g DB can't start. Installation was succeessful. When I try to open the database I get the following errors Listener refused the connection with the following error: ORA-12500, TNS:liste

  • Complex section in smartforms

    Hi I am practicing smartforms in 4.7. I have a tutorial based on 4.6c and they have complex section in the nodes. How do i translate this to 4.7 as there is no complex section available in this version. Detailed explanation would be helpful to me Poi