FULL PRODUCT VERSION :
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
The screen devices in GraphicsEnvironment seems to be not refresh on runtime by running your application with JavaWebstart. This lead into positioning problems if you drag the frame to the second screen device. For example JOptionePane dialogs displayed not in the middle of the frame. The dialog appears on the other screen. Same with drop-down-popup of a combobox, drop-down appears on other screen device.
Run the same application direct with the java command all works as expected.
REGRESSION. Last worked in version 6u45
ADDITIONAL REGRESSION INFORMATION:
JRE-Version 1.6.0_45-b06 Java HotSpot(TM) 64-Bit Server VM
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- You need two screen devices for example a laptop and an external screen
- Change os settings to use only one screen device
- Start my test-example with javaws (make a jar of the test class and use the added jnlp-file to run javaws on localhost)
- Click button "Show JOptionPane", standard output shows
-- getScreenDevices: 1
-- getDevice().getIDstring():\Display0
-- OptionPane dialog appears in the middle of the frame
-- Close OptionPane
- Don't stop the test application
- Change os settings to extended desktop both screen devices now active
- Click the button "Show JOptionPane" again, standard output shows
-- getScreenDevices: 1
-- getDevice().getIDstring():\Display0
-- OptionPane dialog appears in the middle of the frame
-- Close OptionPane
- Move frame to second screen device
- Click button "Show JOptionPane" again, standard output shows
-- getScreenDevices: 1
-- getDevice().getIDstring():\Display0
-- OptionPane dialog appears on other screen device
-- Close OptionPane
- Collapse the combobox
-- combobox drop-down appears on other screen devices
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After adding second screen device on runtime the optionpane behavior and the combobox drop-down should work as before.
ACTUAL -
- Two screen devices are active and the application have been moved to display1 but output shows:
- getScreenDevices: 1
- getDevice().getIDstring():\Display0
and OptionPane dialog and combobox-drop-down appears on the other screen device
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class ScreenLocationTest extends JFrame
{
public ScreenLocationTest()
{
super("Test");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getContentPane().add(this.createUI(), BorderLayout.CENTER);
pack();
setVisible(true);
}
private JPanel createUI()
{
JPanel panel = new JPanel(new FlowLayout());
JButton button = new JButton("Show JOptionPane");
button.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
System.out.println("GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices().length:"
+ GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices().length);
System.out.println("ScreenLocationTest.this.getGraphicsConfiguration().getDevice().getIDstring():" + ScreenLocationTest.this.getGraphicsConfiguration().getDevice().getIDstring());
JOptionPane.showConfirmDialog(ScreenLocationTest.this, "Message", "Title", JOptionPane.YES_NO_OPTION);
}
});
panel.add(button);
JComboBox combobox = new JComboBox(new Object[]{"Item1","Item2","Item3"});
panel.add(combobox);
return panel;
}
public static void main(String[] args)
{
new ScreenLocationTest();
}
}
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
codebase="file:///E:/temp/screen-test/"
href="test.jnlp">
<information>
<title>Test-Screen</title>
</information>
<update check="always"/>
<resources>
<java version="1.6+" java-vm-args="-Xms24m -Xmx1024m"/>
<jar href="screentest.jar"/>
</resources>
<application-desc main-class="tup.jrw.tools.testlabor.ScreenLocationTest">
</application-desc>
</jnlp>
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Restart the application after added an additional screen device.