When I click on the down arrow of a standard JComboBox in an applet and the list of strings are displayed, if I then drag the browser window, the drop down list stays in the same place instead of either being closed or moving with the browser window. I started noticing this when I started using Java 7, but I think this also occurs with Java 6 and 5. When run within the applet viewer in Eclipse, moving the applet window there closes the drop-down during the process of moving the window. Anybody else noticing this ? If so are any suggestions for a possible solution. Ideally I'd want the list to move with the browser window without the drop-down closing.
My example code that demonstrates the problem is as follows:
I also see the behaviour (java 6).
this appears to occur because part of the popup is drawn outside the bounds of the applet area,
and, just a guess, some other painting process takes over (native?).
the workaround is to ensure the applet area is tall enough, changing (for the demo code)
but you also need to add the combo box to a JPanel, otherwise the comboBox will take up all the space,
and regardless of the height, the popup will still be drawn outside the area.
Joined: Aug 14, 2012
Yes, that works on Java 6 but not with 7.
The application I'm maintaining isn't having the issue with 6 or lower, since it adds a combobox to a panel as suggested and that panel is well within the applet bounds.
I've corrected (or rather you've corrected !) the example so that this fails on Java 7 only: