Silenty change combobox contents without generating an event

How do I do the following code without generating an item selected event?
        employeeModel.removeAllElements();
        for (Employee employee : employeeList) {
            employeeModel.addElement(employee); // FIXME generates event at index 0
        }

you change the combo's model
here's a simple demo - click the button to change the model
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing extends JFrame
  String[] numbers = {"1","2","3"};
  String[] letters = {"a","b","c"};
  JComboBox cbo = new JComboBox(numbers);
  public Testing()
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(400,100);
    setLocation(400,300);
    JButton btn = new JButton("OK");
    JPanel panel =new JPanel();
    panel.add(cbo);
    panel.add(btn);
    getContentPane().add(panel);
    pack();
    cbo.addItemListener(new ItemListener(){
      public void itemStateChanged(ItemEvent ie){
        if(ie.getStateChange() == ItemEvent.SELECTED){
          System.out.println(cbo.getSelectedIndex());}}});
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        //cbo.removeAllItems(); //these two lines generate item event
        //for(int x = 0; x < letters.length; x++) cbo.addItem(letters[x]);
        cbo.setModel(new DefaultComboBoxModel(letters));}});//this doesn't
  public static void main(String[] args){new Testing().setVisible(true);}
}

Similar Messages

  • Programati​cally change control focus to generate and Event.....​.

    I'm adding some user enhancement (anti-screw-it-up functions) to insure the desired process is executed.
    Primary question:  If I have an event that is handles by a value change in a text control, (event happens when you hit Enter or exit control with mouse) will the event also occur if you exit the control by programatically changing the focus to another control ?
    I'm going to try and set up a temp vi to test this but wanted to see if anyone had tried this and if it works or not.  My other option is to set up multiple event cases but I was hoping to use a single case to handle everything.
    A few details,  I have a test system that tests a product automatically when the product is placed in a cradle and the cradle is moved into position and activates a prox sensor.  At end of test, system waits for prox sensor to de-activate before resetting the system.
    If a unit fails, there are rework options and the unit can be retested.  When it fails, a label prints defining the failure modes and provides a failing serial number.  When the unit is retested, the failing serial number is entered into a text control. I want the re-test sequence (queued up in the Event) to occur when either 1, a failing serial number is entered or two a button is pressed (with mouse)  I'm pretty sure pressing a button would in turn automatically create the text control change event so my button can probably be a dummy button just for appearances.
    Where the hole is if the user enters a failed serial # and doesn't exit the control and then engages a pump to start the test.  I can use a 'Empty Path/String' function but the control will continue to show empty as if nothing was entered until the Enter key is pressed or the mouse is used to exit the control.
    If I can generate the event by changing the focus, then it will insure that if a failing s/n is entered, the re-test sequence occurs and if nothing exists in that field, it performs a first time test.
    A little long winded for sure but any thoughts are appreciated.
    Can't really post any simple code as this feature is in my top level vi and I have a really big app that doesn't warrant uploading.
    Doug
    Doug
    "My only wish is that I am capable of learning each and every day until my last breath."
    Solved!
    Go to Solution.

    Actually, changing the focus alone did not trigger the event but I was able to then utilize the Empty Path/String function to drive a Value(Signaling) node for the control.
    Doug
    "My only wish is that I am capable of learning each and every day until my last breath."
    Attachments:
    Event_Structure_Trials.vi ‏29 KB

  • I have 5 html pages that share a common header, footer, and sidebar. how do i use my nav bar to change the content of the body without duplicating a lot of code?

    i have 5 html pages that share a common header, footer, and sidebar. how do i use my nav bar to change the content of the body without duplicating a lot of code? thank you!

    i inherited the website. It’s for a non-profit and is not very
    sophisticated, and neither am I in webdesign. It currently has multiple
    pages that are identical except for that body section, so whenever i change
    the navigation (in the sidebar) I have to update every html page.  I want
    to have one basic page, and just call in the different body content based
    on the link the user selects from the nav bar. How can i do that using a
    script? i am using Dreamweaver.
    ~ in love and light ~
    Jeannie
    On Sat, Feb 7, 2015 at 4:07 AM, Ben Pleysier <[email protected]>

  • After setting up my new 4S restoring a backup of my old one, I've renamed the old 3GS in iTunes and changed the content, deleting all my important stuff. Now I'm syncing the old one to my PC. Can I then backup my NEW 4S to  iCloud without messing up all-?

    After setting up my new 4S, restoring a backup of my old 3GS, I've renamed the old 3GS in iTunes and then I've changed the content, deleting all my important stuff. Now I'm syncing the old one to my PC. Can I then after that safely backup my NEW 4S - which now holds all my company information and stuff - to  iCloud without risking to lose it?

    Hi Mcchen425,
    Welcome to the Support Communities!
    As a precaution, I would suggest backing up your iPhone to your computer via iTunes as well as iCloud.  Then you can delete one of your two backups.  The article below will explain all of your options for deleting data or backups from your iCloud storage.
    iOS: Back up and restore your iOS device with iCloud or iTunes
    http://support.apple.com/kb/ht1766
    iCloud: Managing your iCloud storage
    http://support.apple.com/kb/ht4847
    Cheers,
    - Judy

  • Generate Key Events without pressing key???

    Hi,
    Is it possible to generate key events without pressing a key in swing???
    i dont know if the question is logical or not, but just i want to generate some display as if the key is pressed by the user
    Ashish

    assuming c represents a text field.
    This will type the character 'a' in the text field:
    c.dispatchEvent( new KeyEvent (c, KeyEvent.KEY_TYPED, 0, 0, KeyEvent.VK_UNDEFINED, 'a') );
    This will invoke Ctrl+F1, which will show the tool tip for the text field:
    c.dispatchEvent( new KeyEvent (c, KeyEvent.KEY_PRESSED, 0, KeyEvent.CTRL_MASK, KeyEvent.VK_F1) );

  • Changing apple ID without losing content.

    I am having to change apple ID since I changed internet (email) provider. I have gone into set up a new Id: but when I look at Itunes account it is still listing underprior name; also if I go on ipod to download I get a prompt to enter password to the old account. I have not restarted computer since I entered new email adress as apple ID; I am afraid I am going to lose all of my content. Any suggestions?
    Kelly

    All your content is saved to you computer it's self so u shouldn't lose anything.  However, when in doubt back it up.  Do a back up of your content just to give yourself leave of mind that way you have it if it does get lost.  I changed my account without losing anything.  U should be fine

  • In STO, system allowing to make invoice without generating PGI

    Dear All,
    We are using SAP ECC 6.0, in stock transfer STO - Delivery - PGI - Invoice - excise invoice, this procedure we are using. Now error which has been noticed is that without generating  PGI, system is allowing to make excise invoice in the system. Requirement is that system would not allow to make invoice without generating PGI in the system. Anybody can help in this matter.
    Thanks in advance.
    Madhukar Mittal

    Hi,
    go to Txn.VTFL Under Header chose the item category and change the copying requirements change from 11 to 3.
    Regards
    GK.
    Edited by: Gnana Kumar on Oct 7, 2010 7:01 AM

  • How can I detect an external trigger and then generate an event or occurance

    I have a PXIe-1065 chassis with a PXIe8030 controller, PXI-6653 timing module, PXI-6542 Digital IO, and PXI-6259 DAQ board, running LabView 8.5. I need to detect a trigger (100 ns TTL pulse) from an external device then start a process on a GPIB device. Is there a way for me to detect this trigger and then generate an event, or an occurance ? Can I do this without polling a device? Can any of this hardware generate an interrupt that LabView can detect?

    My screenshot was only an example how you can approach the issue. I wasnt saying that you should try it with AI....
    Just take a closer look into the DAQmx Events and you will discover something like this:
    hope this helps,
    NorbertMessage Edited by Norbert B on 10-05-2007 02:35 AM
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.
    Attachments:
    DAQmxEvent.PNG ‏11 KB

  • .change IUCONFIG attribute value in an event-handler of IUICCON (move in)

    Hi there,
    I have been searching for over a week now both on SDN and using the debugger, hopefully this brings more luck.
    On the web-client there is this new contracts page with 3 tabs.
    On the first tab you can choose a product, select a contract and then click Configuration.
    There you can change parameters. (this is View IUCONFIG/ConfigTree) with contextnode ISUORDERITEMCONFIG.
    In this case it is not wanted that this configuration page needs to be opened.
    So I need to change the value of 1 of these attributes (always the same attribute) automatically when switching to the 2nd tab, or when clicking the save button on the last tab. Or any event on the 2nd or 3rd tab are okay. As long as they are sure to be executed in the process.
    I would prefer changing the attribute from within IUICCON/ProcessSaveButtonBar>EH_ONBT_SAVE_PROCESS
    or IUICCON/ProcessBar>EH_ONNAVTOACCOUNTDATA
    I just don't have a clue how to automatically set one value of these configuration attributes.
    Can anybody provide a solution or a workaround?
    Is there any way to change the parameters without ever going to the configuration page in the browser?
    Thanks in advance for your ideas
    Could this thread be moved to CRM webclient?

    Solved, the solution can be supplied in trade for the right amount of money
    (okay is was CRM_ISU_CONT_CHANGE_OW)

  • Change documents cannot be generated

    When trying to approve an admin charm we are getting warning : change documents cannot be generated
    Diagnosis
    Change Documents cannot be generated.
    System Response
    The status is reset, the action is canceled.
    Procedure
    Your Change Request Document contains data which cannot be used for the generation of the follow-on change documents.
    Please check the following possible errors:
    The chosen project in project field of the 'Details' assignment block is a project without a maintenance cycle or the assigned maintenance cycle is in a status where the generation of Change Documents are not allowed. The generation of projects is for example not allowed if the project is in a final status.
    If possible, change the project or choose a phase in the maintenance cycle which allows the generation of Change Documents. If this is not possible, this project cannot be used.
    The 'Scope' assignment block contains scope items for with a chosen IBase which is not the IBase of the productive system in the one (or more) logical components assigned in the chosen project. This is only relevant for the change category 'Urgent Correction', 'Normal Correction' and 'Administrative Change'.
    Choose the right IBase for the change category scope item.
    If a change is not possible because the Change Request was approved and the fields are not edit able, set the Change Request to 'Validation'. Then the data can be changed and the Change Request can be approved again.
    Can someone help why this happens

    Hi,
    Have you checked all the possible errors stated as in your error?
    1. Do you have proper auth to create, proper system assigned with the dev role and ibase created?
    2. is it new CR or you are trying to extend the scope? if this case, what is the status of CR? check out
    ChaRM: RfC process stuck at "Being Implemented"
    3. whether your project has the valid maintenance cycle assigned? you can check in solar_project_admin maintenance cycle is open ?
    4. what is the phase status of maintenance cycle and project cycle. check this allows to create CD, with the status as development with release ?
    Phases in the Project and Maintenance Cycle - SAP Documentation
    please check
    Thanks
    Jansi

  • How can I change the content of JTable?

    Dear friends.
    I have an JTable. I create tablemodel for it and fill out it by data.
    In application at the run time I always need to change the content of whole table. For example I have a frame with JTree and JTable. When I click on the tree node I need to retrieve the data about this node in the JTable.
    Advice me please how can I do that and give an example please.
    Thank you.

    SOL I:
    There solution can be simple if u've written a model for it.
    If u are updating the data of the table by the setValueAt() method of the tableModel, in ur calling(mutating code), then just append a sinle line at the end of the method. U just need to fire a data change event corresponding to the event that has happened.
    void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    - - - - - - - ur code
    //then last line can be
    fireTableDataChanged() ;
    OR
    fireTableCellUpdated(int row, int column);
    OR
    fireTableStructureChanged() ;
    depending uopn what has happened.
    SOL II:
    U may also try calling the method fireTableDataChanged(); from the place where the table data is getting mutated.
    like:
    ((AbstractTableModel) table.getModel()).fireTableDataChanged();
    [email protected]

  • Problem with changing flash content - Need help

    I need help in changing  the flash content. Here is my proble,
    1) I bought a flash template (I will call this Original) from a website and paid some money to customize my menu,logo and background color.
    2) After they finished it they sent me several files. Like 1) index.html, .swf, psd, .fla. In all the files .html,.swf (the video) and .psd I am seeing my customize changes (logo,menu and background color). But the .fla file they sent me is still shows everything from original template. It doesn't have my logo, menu or background color.
    3) I asked their technical support and they walk me through. a) Open the .fla file in flash pro. b) Change the content c) Hit Ctrl+Enter and it will export the new .swf file to the flash folder. d) Make sure I delete the video from flash folder and replace the name with the one I created.
         I did all these steps. But the problem is the .SWF that i generated is showing everything from the orignal template. It did change the content but I don't see any of my customize request. (Menu, logo or color)
    4) Then I open the index.html and I DID NOT see any of the changes in the content.
    My feeling is they did not provide me the correct .FLA file. I really need your help.
    My confusion is a) Have they provide me the correct .FLA file or I am doing something wrong. b) When I generated the new .swf video and renamed it properly why it didn't reflect in the index.html file.
    I am really going back and forth with them since last 15 days and its not going anywhere. I really appreciate any help.
    Thanks,
    Jessy

    Unfortunately, if you have not enough knowledge about using Flash, and do not want to pay to have this done for you, the folks who did this for you are likely going to be the only ones who can help you resolve it.  They should be able to provide the edited fla and the new swf if they are in any way a credible/reliable business.... which at this point sounds like they are not.

  • Dynamically load the content without re-starting the server

    Let me explain the scenario.........
    I have a JSP in which I call a method written in a different class( java file).
    Now, when I change the content of the method in the class and compile it, how can I get the updated stuff in the JSP without re-starting the server.
    Even though I have to re-deploy the changed class, I need to re-start the server to get the updates effective.
    The env set up is on Tomcat
    fun_one

    FUN_ONE, I am using Tomcat 5.0 (though not 5.5), and have a Test application that I do not use WARs to deply. The Context is set with reloadable="true".
    I have this simple bean:
    package jsp.beans;
    public class ItemBean implements java.io.Serializable
         public String getjunk() { return "Hello"; }
    } And this JSP
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <html>
      <head>
      </head>
      <body>
        <!-- Display the session ID for this user -->
        <p><c:out value="${pageContext.session.id}"/></p>
        <!-- Get the junk string from the ItemBean -->
        <p><jsp:useBean id="it" class="jsp.beans.ItemBean"/>
        <c:out value="${it.junk}"/></p>
      </body>
    </html> I run the JSP, then change the text returned by the bean, recompile it, then reload the JSP (force reload). The session id remains the same, and the text changes. Does this work on your system? (note, you do have to restart your server once after you set the Context to be reloadable="true")

  • Change special Attributes of generated Dynpro 1000 in Reports

    Hello!
    Does anybody know how to change the special Attributes of Dynpro Fields on a (automatically) generated Dynpro 1000 (Normal Report)?
    I need to change the Attribute "Without Template" for two Select-Option Fields
    Regards,
    Martin

    There is a function module to perform this : [SELECT_OPTIONS_RESTRICT|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=select_options_restrict&cat=sdn_all] this FM is to be called at INITIALIZATION or PBO (AT SELECTION-SCREEN OUTPUT)
    You may also use a LOOP AT SCREEN/MODIFY SCREEN in the PBO (AT SELECTION-SCREEN OUTPUT) for selection-screen.
    Regards

  • Generate an event programically

    Greetings everyone!
    I am trying to create a 'splash' screen that is displayed during httpconnection calls so that the user is informed of the status of the connection (ie connecting, posting, receiving etc). I created a form that implements the runnable method so that i can call httpconnection on a seperate thread. Once the run method is called i clear up all elements in the form, display a message and proceed with the http business.
    The only problem is that the only way i found that i can move on to either a) the next form (if the data return is OK) or b) to the same form that made the call (if there is some error) is by inserting a command in the form after the connection is finalized, thus allowing the user to click his way out of the info screen.
    I was wondering if there is some way for an event to be generated automatically once the connection is finalized, which could be treated by the commandlistener, thus allowing me to avoid any further user interaction.
    thanks in advance!
    best,
    marcos

    thanks for the help guys, i apologize if i did no make myself clear, but i think i can try out the call back method you guys suggested.
    my problem was the following, i would:
    1) generate an event that would call my connection thread
    2) the main thread would then finish
    3) the connection thread would get started
    4) the form would be cleared up and a new message (ie connecting etc) would be appended
    5) the connection thread would finish
    i guess what i forgot to explain is that at this point i was hoping i could 'generate' an event so that i could call back my CommandHandler class (which implements commandlistener). i could probably change the code around in all my forms so that the result from the connection gets treated in the same thread that calls the connection. but by what i understood i could call commandlistener(command c, displayable d) directly, which would result in an event being generated and thus i could stick to my current logic whereby all events get treated in the main thread.
    so the next step would be
    6) i save the result of my connection
    7) i call back my commandhandler
    8) i treat the result of the connection and move on to the next Form by calling display.setDisplay...
    is that correct or did i misinterpret your answer?
    thanks again for the all the help guys, much appreciated!

Maybe you are looking for

  • Search option in value help

    Dear all, I have a requirement to put a search option on the value help provided in VC. For example : I have a input field for materials, with a value help for multiple selection on material.  If i select a single material i am getting a huge hit lis

  • Discoverer Catalog :: Error while installing catalog

    Hi All, I am installed 10g AS with BI on windows 2003 server. I want to install discoverer catalog. I went to application server administration and then to discoverer link and then to adminsitration. In that page in clicked on install link. It took m

  • Deploying an HTTP Adapter in OAI (InterConnect 4.1)  - Anyone tried it...?

    Has anyone out there, any experience using Oracle Applications InterConnect 4.1? I am trying to deploy an Http adapter which is essentially a servlet supplied by oracle (InboundServlet.class inside adapter.jar). I added the servlet to a web module ru

  • Removal of software from Nokia Support

    I have a Nokia 9210 that was upgraded some two+ years ago - I was greatly dismayed tonight when I needed to download some software to it to find out that Nokia have taken the support software from the web sites. To date I have found the Nokia support

  • Contacts- icloud sync + deleting duplicates?

    I am ripping my hair out. I have lived with duplicate contacts on my iphone for years.  Today I started to clear out the duplicates by hand.  But as soon as I would delete one duplicate contact on my iphone, I would be brought back to the list of con