JComboBox popup list remains open after losing keyboard focus

Hi,
I have noticed a strange JComboBox behavior. When you click on the drop down arrow to show the popup list, and then press the Tab key, the keyboard focus moves to the next focusable component, but the popup list remains visible.
I have included a program that demonstrates the behavior. Run the program, click the drop down arrow, then press the Tab key. The cursor will move into the JTextField but the combo box's popup list is still visible.
Does anyone know how I can change this???
Thanks for any help or ideas.
--Yeath
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class Test extends JFrame
   public Test()
      super( "Test Application" );
      this.getContentPane().setLayout( new BorderLayout() );
      Box box = Box.createHorizontalBox();
      this.getContentPane().add( box, BorderLayout.CENTER );
      Vector<String> vector = new Vector<String>();
      vector.add( "Item" );
      vector.add( "Another Item" );
      vector.add( "Yet Another Item" );
      JComboBox jcb = new JComboBox( vector );
      jcb.setEditable( true );
      JTextField jtf = new JTextField( 10 );
      box.add( jcb );
      box.add( jtf );
   public static void main( String[] args )
      Test test = new Test();
      test.pack();
      test.setVisible( true );
      test.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}

ran your code on 1.5.0_3, observed problem as stated.
even though the cursor is merrily blinking in the textfield, you have to click into
the textfield to dispose the dropdown
ran your code on 1.4.2_08, no problems at all - tabbing into textfield immediately
disposed the dropdown
another example of 'usual' behaviour (involving focus) breaking between 1.4 and 1.5
the problem is that any workaround now, may itself be broken in future versions

Similar Messages

  • How do i get the download window to remain open after closing firefox browser window

    i sometimes download a bunch of files all at ones then have to go back to review them. but i don't need the browser open to do this just the download window. in older versions the download window would remain open after i closed the browser but i don't see a way to do that anymore?

    You can set the pref browser.download.manager.quitBehavior to 2 on the about:config page.
    See http://kb.mozillazine.org/browser.download.manager.quitBehavior
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • Adobe XI remains open after printing from command line

    I am using a program to collect, batch print and delete multiple PDF files.
    The following command line is used to print the files, after which the file is deleted and next file is collected.
         "C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T /N FileName.pdf
    I have now upgraded to Adobe XI, however Adobe remains open (and minimized) after sending the print job to the printer, resulting in my programing freezing while waiting to delete.
    Is there a parameter to close Adobe after printing?
    This is rather urgent as we have started rolling out the new Adobe XI.
    OS = Windows7 Prof x64

    Command line parameters are sparsely documented and are officially not supported. What is documented can be found here: http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/intro_to_sdk/DeveloperFAQ.pd f
    I've not seen anything that shows what you want to do.

  • Why do ports remain open after closing Firefox?

    I have noticed recently that several ports associated with Firefox remain open when the Firefox browser is closed. The number of open ports increases each time Firefox is opened and I have seen that the number of open ports has reached to more than 1,000 open ports at a time. The majority of the open ports are outbound TCP using port 443 and I also note a sustained increase in the network traffic after Firefox is closed.
    I have observed ports opened by the Explorer browser and noted that all of the ports opened with Explorer close when the Explorer browser is closed. The Firefox ports remain open when the browser is closed.
    Questions:
    - Should all open ports associated with an open Firefox browser close when the Firefox browser is closed?
    - Does Firefox have a setting that closes all open ports when the Firefox browser is closed?
    - Does XP have a setting that will close all open ports associated with Firefox when Firefox is closed?
    - Should I have security concerns about the accumulating open ports and increased network activity when using Firefox?
    Thanks.

    You can set the pref browser.download.manager.quitBehavior to 2 on the about:config page.
    See http://kb.mozillazine.org/browser.download.manager.quitBehavior
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • Sockets remaining open after connection failure

    Hi - I have a multithreaded application that runs as a daemon (always up) and uses OCI (10.2.0, 64-bit client). If a database connection or query fails for any reason, it is coded to keep on retrying on a set schedule until it succeeds. The application runs on RHEL 4 (64-bit) and is compiled with g++ 3.4.6. (It's nominally C++, but is really what I call "C with objects" as it doesn't use a lot of the standard C++-isms, though there are objects -- the OCI code in question is in a C++ object wrapper that I wrote.)
    Anyway, about 5 days ago, the database where most of the queries are run went down (it's a 10g server; I don't remember the exact version, but since it's down, I'm not sure it matters), and it has not come back up, although the hosts it runs on are up. Meanwhile, my application kept failing to connect and retrying, and the number of queries that this was happening to kept on growing as new ones are added every day. Unknown to me, the failed connection attempts were leaving open TCP sockets to the database that was down, until eventually the maximum open files on the system was exceeded and I was forced to reboot. Twice. (It happened again the next day.)
    From what I can tell, I am properly dropping the handles and such when a connection fails, so why are the sockets staying open? Is there anything that can be done to force the socket to close after a failed connect? This morning I changed all the queries to use a different database (that's actually up), but according to lsof, there are still 56 open sockets to the old (non-working) database, even though none of my program threads are actively trying to connect there anymore.
    The sockets do close, by the way, if the application is stopped and restarted. But they remain open as long as the instance that created them is still running. (I added a periodic restart to clean things up, but I'd really like to fix the problem instead of using a stopgap like this!)
    Sample code is below. This first bit is what is used to connect and log in. (Note that I have this mutex-locked -- I know OCI is supposed to be thread-safe if you use the OCI_THREADED attribute, but I've been having so many issues that I thought it was safer.)
    if (check_err(OCIEnvCreate(&env, (OCI_THREADED), (void *) 0, 0, 0, 0, (size_t) 0, (void **) 0)) != 0)
    fprintf(stderr, "Error allocating OCI environment handle\n");
    return;
    // Allocate error handle.
    if (check_err(OCIHandleAlloc((void *) env, (void **) &err, OCI_HTYPE_ERROR, 0, (void **) 0)) != 0)
    fprintf(stderr, "Error creating OCI error handle.\n");
    return;
    // Allocate server handle.
    if (check_err(OCIHandleAlloc((void *) env, (void **) &server, OCI_HTYPE_SERVER, 0, (void **) 0)) != 0)
    fprintf(stderr, "Error allocating OCI server handle.\n");
    return;
    // Allocate service handle.
    if (check_err(OCIHandleAlloc((void *) env, (void **) &svc, OCI_HTYPE_SVCCTX, 0, (void **) 0)) != 0)
    fprintf(stderr, "Error allocating OCI service handle.\n");
    return;
    [Note: these are snippets from two different functions; this is a C++ wrapper that uses OCI, so the above code is in the database object constructor, and below is a separate login function.]
    // Attach to server.
    retcode = OCIServerAttach(server, err, (text *) curDS, strlen(curDS), OCI_DEFAULT);
    if (check_err(retcode))
    fprintf(stderr, "Error attaching to Oracle server.\n");
    return(retcode);
    // Set server attribute in service handle.
    retcode = OCIAttrSet((void *) svc, OCI_HTYPE_SVCCTX, (void *) server, 0, OCI_ATTR_SERVER, err);
    if (check_err(retcode))
    fprintf(stderr, "Error setting OCI server attribute.\n");
    return(retcode);
    // Allocate session handle.
    retcode = OCIHandleAlloc((void *) env, (void **) &sess, OCI_HTYPE_SESSION, 0, (void **) 0);
    if (check_err(retcode))
    fprintf(stderr, "Error allocating OCI session handle.\n");
    return(retcode);
    // Set username attribute in session handle.
    retcode = OCIAttrSet((void *) sess, OCI_HTYPE_SESSION, (void *) curUser, strlen(curUser), OCI_ATTR_USERNAME, err);
    if (check_err(retcode))
    fprintf(stderr, "Error setting OCI username.\n");
    return(retcode);
    // Set password attribute in session handle.
    retcode = OCIAttrSet((void *) sess, OCI_HTYPE_SESSION, (void *) curPass, strlen(curPass), OCI_ATTR_PASSWORD, err);
    if (check_err(retcode))
    fprintf(stderr, "Error setting OCI password.\n");
    return(retcode);
    // Start session.
    retcode = OCISessionBegin(svc, err, sess, OCI_CRED_RDBMS, OCI_DEFAULT);
    if (check_err(retcode) != 0)
    return(retcode);
    // Set session attribute in service handle
    retcode = OCIAttrSet((void *) svc, OCI_HTYPE_SVCCTX, (void *) sess, 0, OCI_ATTR_SESSION, err);
    if (check_err(retcode))
    fprintf(stderr, "Error setting OCI session attribute.\n");
    return(retcode);
    If any of the above calls returns an error, the next call is to the database object destructor (also mutexed), which looks like this:
    if (connected && svc && err && sess && check_err(OCISessionEnd(svc, err, sess, OCI_DEFAULT)))
    fprintf(stderr, "Oracle - Error ending session\n");
    if (connected && server && err && check_err(OCIServerDetach(server, err, OCI_DEFAULT)))
    fprintf(stderr, "Oracle - Error detaching from server\n");
    if (connected && server && check_err(OCIHandleFree((void *) server, OCI_HTYPE_SERVER)))
    fprintf(stderr, "Oracle - Error freeing server handle\n");
    if (connected && svc && check_err(OCIHandleFree((void *) svc, OCI_HTYPE_SVCCTX)))
    fprintf(stderr, "Oracle - Error freeing service handle\n");
    if (connected && err && check_err(OCIHandleFree((void *) err, OCI_HTYPE_ERROR)))
    fprintf(stderr, "Oracle - Error freeing error handle\n");
    if (connected && env && check_err(OCIHandleFree((void *) env, OCI_HTYPE_ENV)))
    fprintf(stderr, "Oracle - Error freeing environment handle\n");
    Anyone else had this happen? Any insights/help would be greatly appreciated!
    Oh, one more note: though the application is multithreaded, none of the database objects or connections is shared -- each thread makes its own connections and maintains database objects separately. I added the mutex locks because Helgrind was reporting race conditions on handle allocations and deallocations.
    Thanks,
    --Tina                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hmm, I believe I did have an OCIHandleFree on the session handle in an earlier version of the code. I can't remember why I took it out, but I do remember that there was a reason -- it was causing a problem. (Yeah, I know, vague enough for ya?) Anyway, the OCI documentation said that when you call OCIHandleFree on the environment handle, any child handles would be implicitly freed, so I assumed it wouldn't be a problem. Still, I'll try putting it back and see what happens. Thanks.
    Oh, and to answer your question (about netstat), it said the processes were ESTABLISHED. But the Oracle server was down (although the hosts it resided on were up). The connection attempt failed with the error message:
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Message was edited by:
    user613364

  • Cursors remained open after closing connection

    I am using OC4J 10g (Application Server) and Oracle10g DB. OC4J is maintaining the connection pool(com.evermind.sql.DriverManagerDataSource). I get the connection from pool and call DB procedure, then close resultset, statement and connection. It closes the opened cursors against resultset. But left some implicit cursors opened and never closed so cursor count is going to increase.
    If i dont use pool no cursor remained open and count is zero. It means the cursors of pooled connections are not closed.
    wait-timeout="60"
    min-connections="5"
    max-connections="100"
    inactivity-timeout="15"
    <property name="stmt-cache-size" value="2000"/>
    Tahir

    Hi Justin,
    Thnx for your reply and you're understanding is correct but the problem I face is when multiple concurrent users access the JSP page from which I'm actually calling the servlet to retrieve the image, the number of cursors being left open increases. As the load on the page increases (i.e. no of usesrs increase) oracle seems to have problems in garbage collecting the open cursors ... which eventually leads it to throw maximum cursors exceeded exceptions.
    Any suggestions ?
    -Athar

  • ODBC connection remains open after disconnect

    Hello,
    in my application I use 2 ODBC connects to 2 different ODBC drivers.
    My problem:
    When I close one connection (with DBDisconnect), the connection on the database remains open until I close the second one.
    Is this a known behavior?
    Is there a way to force the closing or to make it independant of the other connection?
    Regards
    Fred
    Solved!
    Go to Solution.

    As ODBC connections are not inherently included in the CVI environment, I looked up the DBDisconnect function and it says that the DBDisconnect function disconnects the last connected ODBC database. So it is expected behavior.
    Ian M.
    National Instruments

  • My Firefox.exe process remain open after I close the browser.If I open it it's says to open a new window.I need to close the process manualy(Ctrl+Alt+del).What can I do?Thanks .

    Need to close the process.

    It does take Firefox a while to shut down; it has to update some databases. But it should take less than a minute.
    In the support article, this problem is called a "hang at exit" because Firefox hangs when shutting down. Maybe something here will help: https://support.mozilla.com/en-US/kb/Firefox+hangs#Hang_at_exit
    Also, sometimes open Firefox windows disappear from the Task Bar. You can use Alt+Tab to switch to them if they remain open.

  • "file upload" window remains open after selecting a file. Have to "force quit" to get it to go away. How can I fix this?

    Every time I try to upload a file, the "file upload" window remains open and will not go away unless I force quit Firefox. The window stays in front of all other programs and applications. Is this a problem with Firefox or with OSX? Any idea how to solve it? I've tried clearing the cache & cookies, etc. Should I reinstall Firefox or is there a simpler solution?

    On Windows (don't know about Mac), the latest version will always take over the file association, and become the default for indd files. It's impossible to change it.
    But there is a plugin for ID that makes this possible. Never tried it myself.
    https://www.rorohiko.com/wordpress/downloads/lightning-brain-soxy/

  • SQL Connections remain open after Crystal Report closes

    I am wirting an interface to use the crystal report viewer to print reports, connecting to a Progress Open Edge 10.1B database.  From our application we declare the application, report, exportoptions and connectionproperties objects and pass these to the crystal reports viewer.  Once the report is printed we release the objects and set their variables for null.  However we are finding that the SQL connection to the database is remaining connected and we can only release the connection by manually going in a disconnecting.
    I have read in forums that people use .dispose or .close to release the connection, however we do not have access to these methods as we do not use .NET.  Are there any methods we can use to disconnect these sql connections?

    Hi Dean,
    Moved to the Legacy Application forums. Likely using the RDC as your report engine.
    You should still be able to close and dispose of the report objects. They are not specific to .NET.
    In VB it would look something like these lines::
        crReport.Close
        Set CrystalActiveXReportViewer1.ReportSource = Nothing
        Set crReport = Nothing
    Once the report is closed it should disconnect from the DB. If you close the application does that disconnect?
    Have you looked on 4GL's site for info on how to?
    Thank you
    Don

  • Database connection remains open after close being called

    I am using oracle OC4J as my application server. I am not using connection pool and I am using non-pooled datasource to get connection. The database connection is made at runtime and then closed. I want to test if the users' connection sessions have been killed after they logout the application. But when I checked the table v$session in the database, it shows one connection remaining. I checked my program, the close method has been called. Does anybody know the solution?

    Hi Chen,
    This is just a suggestion for something to try -- only if you haven't
    already tried it, that is!
    Try running OC4J in "debug" mode. Here are details on how to do that:
    http://kb.atlassian.com/content/atlassian/howto/orionproperties.jsp
    Hope this helps you!
    Good Luck,
    Avi.

  • RFC Connection remains open after portal logoff

    Hi,
    We have configured Universal Worklist in our EP7 EHP1 SPS4 Portal.
    When a user connects to the Portal and launches the UWL it creates an RFC connection to the backend ECC. However, when the user moves away from UWL iview or logs out or closes the browser the RFC connection in the backend still
    remains and is released only after the timeout value reached as set in ECC.
    Are there any settings on the portal or ECC to release the session immediately once  user moves away from UWL or logs out of portal ?
    Thanks,
    Savy.

    Hi my friend
    It costs time and resources to establish an RFC connection, therefore it is not immediately deleted but maintained by the system to be reused. But in case there're special purpose to control RFCs, here're 2 parameters to do so:
    The parameter gw/gw_disconnect is a timeout in seconds to close the TCP connection between two SAP gateways if there is no RFC connetion on it for the given timeout. But if there is an active RFC connection onit it will not be closed even if there is no traffic on that RFC connection. Thats why you need another parameter.
    The parameter gw/keepalive is used to periodically check all active RFC (and other) gateway connections if there was no traffic on them for the given time.
    Regards,

  • Some tabs remain open after closing them

    When I have opened a lot of tabs (10+) and I close them afterwards, sometimes a few of those tabs will still show in the tab bar. When I click them I can't view them though. It seems to be a problem with the tab bar, not with web pages.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Losing keyboard focus  when resetting

    I have Player object which is focusable and works fine. However when I try to reset the object with following code:
         public void reset(){
              t.stop();
              remove(player);
              player = new Player(50,60);
              add(player);
              x=50;y=60;
              t.start();
              System.out.println("reset");
         }I lose the focus on player. Everything else works fine but player isn't getting any keyevents after the reset.

    Ok here's sscce
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class resetTest extends JPanel{
    Player player = new Player();
         public static void main(String[] args){
              JFrame f = new JFrame("resetTest");
              f.add(new resetTest());
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.pack();
              f.setVisible(true);
         public resetTest(){
              add(player);
         public Dimension getPreferredSize(){
              return new Dimension(200,200);
         public void reset(){
              remove(player);
              player = new Player();
              add(player);
              System.out.println("reset");
         class Player extends JPanel implements KeyListener{
              public Player(){
                   this.setBorder(BorderFactory.createLineBorder(Color.black));
                   this.setFocusable(true);
                   this.addKeyListener(this);
              public void keyPressed(KeyEvent e){
                   System.out.println(e.getKeyCode());
                   if(e.getKeyCode() == 10){ ((resetTest)getParent()).reset();}
              public void keyReleased(KeyEvent e){}
              public void keyTyped(KeyEvent e){}
    }If you run this you'll notice that it notices key presses fine, but when you reset it with enter key it stops working.

  • JComboBox fails to popup list - mouse/keyboard coordinate problem?

    Have discovered the following phenomenon:
    my JComboBox is placed in a hierarchy of panels, the top of which
    is packaged via sun.beans.ole.Packager as ActiveX. THe ActiveX'ed
    bean is used in an MFC application, which uses the plugin as VM.
    The JComboBox failed to popup its selection list when the user
    clicked on the popup button or used the appropriate key combination.
    I found out, that if the application is resized/moved so that the JComboBox
    is not in the upper left quarter of the screen, then it can display its popup list
    without problem. Have not investigated on whether the "upper left" corner
    also means "including popup bounds", but it seems like it.
    Happens only in the plugin, not within regular Java application.
    Anyone out there with a similar problem? Or better, a solution?
    Have cross-posted to the Plugin group.
    And, of course, I am desperate for a solution! (Project release date lurking...)
    Sylvia

    Nubz,
    actually I'm still using a standard wired apple keyboard, wt the magic mouse, because the wire goes under my desk, and I was actually considering getting a trackpad. Still since my Yosemite upgrade, I'm having problem after problem, so I'm not sure I will even stay wt Mac. Honestly I've examined any and all solutions, in that support article, but none of them were relevant to my problem.
    I did check & repair my Yosemite Disk Permissions using Disk Utility, and although it found only a few things wrong, and none were related to my keyboard, or mouse (most were for my HP printer), repairs seemed to rectify the problem.

Maybe you are looking for