Synchronize 2 Jcombobox - double the action?

Hi all,
I have asked how to synchronize 2 Jcombobox before, and the solution works, which is:
JComboBox myCB1 = new JComboBox(...);
JComboBox myCB2 = new JComboBox(...);
myCB1.addActionListener(
   new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         int index = myCB1.getSelectedIndex();
         myCB2.setSelectedIndex(index);
myCB2.addActionListener(
   new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         int index = myCB2.getSelectedIndex();
         myCB1.setSelectedIndex(index);
); However, now I ran into a problem which the action perform by one of the ComboBox is done twice because the 2 combo are calling each other.
In one case which I try to print out the items in a final array (initiate by selecting an itrem in the comboBox), it runs into and infinite loop.
I've tried flipping an gobal boolean, which the comboBox only perform the action when the boolean is true, and after each action I flip the boolean. But this sort of disable the synchronization of the comboBox.
Could anyone please help me here?
Sam

If they are already in synch, then there is nothing else to do...
JComboBox myCB1 = new JComboBox(...);
JComboBox myCB2 = new JComboBox(...);
myCB1.addActionListener(
   new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         int index = myCB1.getSelectedIndex();
         if(myCB2.getSelectedIndex() != index) {
           myCB2.setSelectedIndex(index);
myCB2.addActionListener(
   new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         int index = myCB2.getSelectedIndex();
         if(myCB1.getSelectedIndex() != index) {
           myCB1.setSelectedIndex(index);
);

Similar Messages

  • Detecting double-click in the action of a JButton

    I have a similar problem to the poster of http://forum.java.sun.com/thread.jsp?forum=52&thread=93004 and I'm wondering if anyone has a better solution.
    A fuller description of my problem.
    My JButtons represents certain pallette items. Clicking a pallete item puts the button in a selected state (changes its border to show it's selected). The action on this button sets a mode state on the canvas to indicate what was selected. I then click on a canvas workspace to place an instance of that item onto the canvas based on the current mode.
    The selected JButton then pops up and the user needs to select a new pallette icon.
    What I want as an option so that if a pallette button is double-clicked it remains selected even after the item has been placed on the canvas allowing the user to place several copies around the canvas before selecting another item.
    I'd like if possible to determine this from the buttons action rather than registering a listener to the button because parts of the framework I am using pass just the actions around.
    I could do this by looking at the time between actions being triggered but this seems like a messy solution (can I pickup the operating system settings for double-click delay).
    Any other ideas?

    thebobster,
    This doesn't answer your original question, so if you're determined to use d-clicks on a JButton, don't bother reading further.
    I've always found double-clicking on a JButton non-intuitive, not to mention messy to implement. I prefer CTRL-click, etc, to indicate a sticky click.
    Perhaps you could use an image to indicate your palette button: you'll need just 2 images--up-state and down-state--and d-clicks will be easy to implement.
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • JComboBox.removeItem() automatically calls the action listener

    Hi, these are segments of my code:
    static JComboBox selectSection = new JComboBox(new DefaultComboBoxModel(sectionsTitles));
    selectSection.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    String title = (String)selectSection.getSelectedItem();
    String content = InfoProvider.getSectionContent(title);
    sectionTitle.setText("Section title:" + title);
    sectionContent.setText("Section content:" + content);
    selectSection.removeItemAt(index);
    The last line of code automatically invokes the method of the action listeners.
    Anybody any clues to what I should to prevent this from happening?

    Found the solution : http://forums.sun.com/thread.jspa?threadID=248288&messageID=915448

  • "An error (1502) occurred during the action Open." when opening original .VSD files, but NOT copies!?

    We have a weird situation we're trying to troubleshoot for quite a while: We have multiple .vsd files stored on our network in DFS shares.. We have multiple users who cannot open the files, when they try by navigating to the file and double-clicking it,
    they get "An error (1502) occurred during the action Open. File not found"
    However, if they copy and paste the file to the same exact network folder, THAT file they can open with no problem!
    The problem is very bizarre. I've checked obvious things such as file/folder permissions, versions of Visio installed, things in common between people who can and can't open the files.. I even did some testing today with some strange results...
    Windows 7 x64 machine with Visio 2010 Pro installed (x86):
    1. Opened file by double-clicking it in explorer, "Got the 1502 error"
    2. Tried it again, this time I just get "File not found"
    3. Opened Vizio, did a File --> Open --> navigated to the file and opened it that way... 1502 error.
    4. Copy/pasted the file into the same folder where it's stored, then double-clicked the copy and it opens fine.
    5. Closed the copy, tried to open the original, still get file not found / error 1502.
    The file does exist, it IS there.. sometimes the user just copies it to their local desktop (well, it's not really local, it's redirected) and it opens fine there.. other users email themselves a copy of the file and then open it that way.. it works for
    some, not for others.. and there's no discernible pattern yet to identify who this is affecting. Anyone have any ideas?
    -Keith
    -Keith Elkin

    Hi,
    Based on the error message, the issue may be caused by the Visio file is occupied by some other program in DFS.
    >>4. Copy/pasted the file into the same folder where it's stored, then double-clicked the copy and it opens fine.<< If you did this step, the Visio file would rename in the same folder, like file1.vsd. Thus, it opened well.
    Thus, I recommend you check the file's status in computer management in DFS server, see the below image:
    If the affected Visio files were occupied, please try to clean them(right click>close the file) to test.
    Hope it's helpful.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.
    Sorry,
    This didn't help, the files are not open, locked open, and the issue still persists. Any other suggestions?
    -Keith
    -Keith Elkin

  • How to capturing Mouse double click action?

    Hi all,
    how can we identify the "mouse double click" action?
    MouseListener has methods for only mousePressed,released,clicked (single).
    Thanks in advance..
    Regards
    Sojan

    Hi,
    Thanks it worked ..
    e.getClickCount() value increases if we keep on clicking on the component, is there anythning wrong by interpreting double click as
    "e.getClickCount() >=2 "?
    Regards
    Sojan

  • Agentry - Disable Double Click Action on Individual Row

    Is it possible to disable the double click action on a single row in a list screen?  I wanted to have a rule that would disable a row if it has already been updated.  Let me know if that is possible.

    The double click option can not be set by a rule or not, but the action is called, you can put an enable rule on to check the data already.
    Stephen

  • Double click actions were capturing for PPOME by other servers,But not in..

    Hi all,
      I am trying to assign cost center for the employee using T.Code PPOME. While recording I am unable to select person to assign cost center,
    i.e. while recoding I had done double click action for selecting a person. But, at the time of processing the recorded code, That double click actions were not capturing. 
    Here my problem is...
    When I am running, My program is unable to catch double
    But, In other server system, double click action was capturing sucessfully.Can any one suggest me regarding this.
      Can any one suggest me how to handel this issue.
    Thanks in advance,
    Surender.B.V.
    Edited by: Surender Batlanki on Feb 8, 2008 7:20 PM
    Edited by: Surender Batlanki on Feb 8, 2008 7:24 PM

    Hi Kiran,
        I got what you told, But are you sure double click action will not handel in SHDB recording for any transaction code ?
        I also tried all possibilities, as you suggested by using menu bar options, mouse right click actions and making changes in recorded program. If I gone through this step I can solve my issue.
        Do u face this kind of issue any time i.e. handling double click actions. Can you suggest me if any.
        Thanks for your reply.
    Regards,
    Surender.B.V.

  • How to modified a URL showed in a Render phase from the Action phase.

    Hi all,
    I have a problem with a URL showed when I pass from action phase to render phase. Next I explain that problem.
    I'm using a Weblogic Portal 10.3., Java Portlet and Spring. My portlet contains two controllers (A and B). The controller A receive an action and depending of a parameter, shows a viewA (which is managed by A controller) or viewB (managed by B controller). To do that I use a ParameterHandlerMapping of SpringFramework, which if an action parameter is A, the portlet use Controller A and use controller B if an action parameter is B.
    Next I show you a Controller A method which receive an action:
    @ActionMapping(params={"action=A","execAction=redirection","pg"})
    public void accionIrFichaDispositivo(ActionRequest req, ActionResponse resp,
    @ModelAttribute("listadoVozForm") ListadoVozForm form,
    @RequestParam("pg") String paramPg) throws PortletException, IOException{
    if(pg.equals("Hola")){
    }else{
    resp.setRenderParameter("action", "B");
    In a Render Phase, which is managed by Controller B, the URL contains the value of action parameter: action=A.
    How can I modified that action parameter to show action=B?..
    Regards..

    Hello,
    What you are seeing is the expected behavior; the URL in the browser will be the action URL (with action=A) even though the portlet is setting a render parameter action=B in the action phase. There's nothing "wrong" with this; the "B" controller will get run because the render parameter "action=B" exists, even though it isn't what is displayed in the browser. In general, it is best to not be concerned about what parameters are in the browser's URL, as the portal framework is managing all the parameters for you on the server-side.
    If you really want the browser's displayed URL to not be the action URL, there is a feature built in to WLP 10.3.2 and later versions which will cause the browser to do a redirect to the render URL just after the action phase runs. This will make the browser display the "action=B" in the URL, but the redirect will also double the number of requests the server must handle, so consider if you really need the browser's URL to display the current render URL. To turn this feature on, modify the entry for your portlet in the WEB-INF/portlet.xml file to add a container runtime option "com.oracle.portlet.redirectAfterAction", like this:
        <portlet>
            <portlet-name>sampleRedirectAfterAction</portlet-name>
            <portlet-class>
                portlets.jsr286.SampleRedirectAfterAction
            </portlet-class>
            <supports>
                <mime-type>text/html</mime-type>
                <portlet-mode>view</portlet-mode>
            </supports>
            <portlet-info>
                <title>Redirect After Action Sample</title>
            </portlet-info>
            <container-runtime-option>
                <name>com.oracle.portlet.redirectAfterAction</name>
                <value>true</value>
            </container-runtime-option>
            <container-runtime-option>
                <name>com.oracle.portlet.suppressWsrpOptimisticRender</name>
                <value>true</value>
            </container-runtime-option>
        </portlet>The "suppressWsrpOptimisticRender" runtime option is recommended as a performance enhancement for any portlets being run over WSRP which also have the "redirectAfterAction" option, however, if you are running your portlets over WSRP you won't be seeing the render parameters in the browser's URL in any recognizable form anyway.
    Kevin

  • How to  record double click action in ECATT ...?

    Hi,
    I created ecatt for Asset master in that recording there is sub field in which i need to enter data only after double clicking main field ,while recording i double clicked tha main field after upload txt file unless i double click the field it is not moving farward,
    so can u help the same..
    thanking you

    You can record double click action using ecatt or u can do same by pressing f2 key while recordiing

  • How to separate double click action and single click action

    in my mouse action listerner for JTable.
    i do two actions, when user doule click column header, sort the column,
    when single clicked, select all cells in this column.
    but when user double clicked, the action attached with single click also triggered.(column sorted but also selected)
    how to separate them.

    Ok, so despite my earlier suggestion being basically the only solution offered anyway on the web it appears that Lokust is correct and that the single click operation would be performed as well as the double click one. to get round this u have to implement a Timer, i'm not going to post my whole code here because most of it is irrelevent, just add this code in the correct places and it should work fine. apologies to all format junkies for not using code tags!
    import java.util.Timer;
    import java.util.TimeTask;
    public class WhateverClassName implements MouseListener {
    private Timer t;
    private boolean doubleclick;
    myTable.addMouseListener(this);
    public void mouseClicked(MouseEvent e) {
         t = new Timer();
         if (e.getClickCount() == 2){
              doubleclick = true;
         else if(e.getClickCount()==1){
              t.schedule(new MyTimerTask(),500);
    /*You need all these methods as well */
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
    public void mouseEntered(MouseEvent arg0) {
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
    public void mouseExited(MouseEvent arg0) {
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
    public void mousePressed(MouseEvent arg0) {
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
    public void mouseReleased(MouseEvent arg0) {
    class MyTimerTask extends TimerTask{
    /* (non-Javadoc)
    * @see java.util.TimerTask#run()
         public void run() {
              if(doubleclick){
                   System.out.print("double click");
              else{
                   System.out.println("single click");
              t.cancel();
    This assumes that for it to be considered a double click user has to click twice within .5 seconds.
    Let me know if that works or not, sorry its a bit messy!

  • I can not synchronize data from the prelude livelog

    I can not synchronize data from the prelude livelog apparently seems to be all right, more aprasenta the following message: The Open Clip does not support XMP.
    The Prelude can not apply metadata in it.
    please can someone help me

    Hi -
    When it comes to AVCHD footage, Prelude wants to leverage the complex folder structure in order to save metadata. If the file is just the *.MTS file and is not part of the original folder structure, Prelude will report it cannot write metadata to the file. You can transcode the *.MTS to another format and then add metadata.
    We are looking at future solution for what we call "naked MTS file", but unfortunately that is not part of the currently released product version.
    Michael

  • How do I create an action to save as, but into a different folder than the one I used to create the action?

    I am having an issue with my action being created to save under the same folder that my action was created with.  For instance, I opened an image, recorded the action, then I went to a different folder to play the action, but it saves to the previous folder.  How do I add some way to change the folder I want my pics to save to?

    If you want to give Scripting a try paste the following text into a new file in ExtendScript Toolkit and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.
    // saves jpg into same folder;
    // be advised: this  overwrites existing jpgs of the same name without prompting.
    // 2010, use it at your own risk;
    #target photoshop;
    if (app.documents.length > 0) {
    var thedoc = app.activeDocument;
    // getting the name and location;
    var docName = thedoc.name;
    if (docName.indexOf(".") != -1) {var basename = docName.match(/(.*)\.[^\.]+$/)[1]}
    else {var basename = docName};
    // getting the location, if unsaved save to desktop;
    try {var docPath = thedoc.path}
    catch (e) {var docPath = "~/Desktop"};
    // jpg options;
    var jpegOptions = new JPEGSaveOptions();
    jpegOptions.quality = 12;
    jpegOptions.embedColorProfile = true;
    jpegOptions.matte = MatteType.NONE;
    //save jpg as a copy:
    thedoc.saveAs((new File(docPath+'/'+basename+'.jpg')),jpegOptions,true);
    //that’s it; thanks to xbytor;

  • How do I get more effects in my action box?  I am only showing a few, like BOTTOM BORDERS, LOSE WEIGHT AND SPECIAL EFFECTS. That is all. The turotials I've checked into all show a long list of effects in the actions box. If anyone could help, I appreciate

    How do I get more effects in my action box? I am only showing a few, like "Bottom Borders, Losing Weight, Resize and Crop, and Special Effects. And they do not list but a few effects. When I have watched the tutorials, they are showing a long list of effects in the action box. (with a side space bar)  I do not.  When I have clicked on the little arrow at top, and clicked "Load Actions", a box comes up, but it is blank,saying "no items match your search".  I'm lost!  If someone could help, it would be much appreciated!  I would like to start using this.
    Thank you. 

    Apple Computer Customer Relations:
    1-512-674-2500

  • Cannot delete exe files - The action can't be completed because the file is open in Windows Explorer

    We have received 3 new computers with Windows 8.1. All of us 3 have the same problem: we cannot delete exe files with message "The action can't be completed because the file is open in Windows Explorer"
    For example, I download skypeinstall.exe on desktop, install the program correctly and then try to delete the file: file is in use by Windows Explorer, cannot be delete.
    We reboot computer, we are able to delete the file. But, if I restore the file from the recycle bin on the desktop, I cannot delete it again until I reboot the PC. I used ProcessExplorer to see what is locking it and I can see 5 instances of explorer.exe
    locking the file.
    I can always reproduce the same way:
    1-Reboot
    2-Delete exe file
    3-Restore file
    4-Delete stop working and 5 explorer.exe handle are locking it.
    I have tried the following so far after reading multiple threads:
    - De-activating Windows Search service
    - Activating User Experience service
    - Deleting from command prompt (no success)
    - In folder options: inactivate display icon on thumbnail and activate always display icons, never thumbnail
    - Changing folder view (contents, detail, small icons...)
    - Using Lock Hunter - not working until reboot
    None of these worked.
    We all have Windows 8.1 with Crucial SSD drive, could the problem be linked with the SSD drive incompatibility?
    Any help would be appreciated.

    Hi,
    Please try to make a clean boot for your system, then check if this problem resolved.
    Clean Boot: http://support.microsoft.com/kb/929135
    If problem persists, try to open Resource Monitor to check handle of Explorer.exe, if there any exception, end them for test.
    Roger Lu
    TechNet Community Support

  • The action could not be completed because of a conflict with the original item. The conflict may have occurred when an existing item was updated on another computer or device. Open the item again and try making your changes. If the problem continues, cont

    I have a user on an iMac 10.6 connected to our domain.  She uses Outlook web access for email on our exchange server.  Last week she received the following message which is randomly preventing her from sending emails.  She claims no attachment was involved in the original email when this all started.  I have not been able to look at her account as she is out of the office but maybe someone else dealt with this issue.  I realize this may not be Mac related but thought I'd give it a try.  She did say it occurred once over two days while working on a PC but it continued over the past weekend.
    If an internal user tries to send a message with infected attachment using Outlook Web Access, it may report the following error message: The action could not be completed because of a conflict with the original item. The conflict may have occurred when an existing item was updated on another computer or device. Open the item again and try making your changes. If the problem continues, contact technical support for your organization.
    This is because F-Secure Anti-Virus for Microsoft Exchange has detected a virus in the attachment. If the user tries to send the message again, the message will be sent but without the attachment. At the same time a blank message with an attachment named "Attachment_information.txt" will remain in the user's Drafts folder. The "Attachment_information.txt" will contain information about the virus detected in the message.

    PS - have found other posts indicating that clips smaller than 2s or sometimes 5s, or "short files" can cause this. Modern style editing often uses short takes ! Good grief I cannot believe Apple. Well I deleted a half a dozen short sections and can export, but now of course the video is a ruined piiece of junk and I need to re-do the whole thing, the sound etc. which is basically taking as much time as the original. And each time I re-do it I risk again this lovely error -50 and again trying to figure out what thing bugs it via trial and error instead of a REASONABLE ERROR MESSAGE POINTING TO THE CLIP IT CAN'T PROCESS. What a mess. I HATE this iMovie application - full of BUGS BUGS BUGS which Apple will not fix obviously, since I had this product for a few years and see just hundreds of hits on Google about this error with disappointed users. Such junk I cannot believe I paid money for it and Apple does not support it with fixes !!!
    If anyone knows of a GOOD reasonably priced video editing program NOT from APPLE I am still looking for suggestions. I want to do more video in future, but obviously NOT with iMovie !!!

Maybe you are looking for