Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8192886

JCombo List is displayed in wrong location when using multiple monitors and attaching/detaching to a docking station

XMLWordPrintable

    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      C:\> java -version
      java version "1.8.0_25"
      Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      C:\>ver

      Microsoft Windows [Version 6.1.7601]


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Tested using both 1.6.0.25 and 1.8.0.60

      A DESCRIPTION OF THE PROBLEM :
      Only able to reproduce the issue using a javaws application in an environment with multiple monitors along with attaching the laptop to the docking station as well as when removing the laptop from the docking station.

      In my environment I have 3 external monitors.

      With the laptop in the docking station, when the javaws application is run and the laptop is removed, the display values for the ComboBox will appear disconnected. If the application disconnects when removing from the docking station, then simply restart the application (while disconnected) and the problem should be visible.

      The 2nd way the issue is visible is if the application is started while the laptop is detached from the docking station then reattached. Attempting to view the contents of the ComboBox is disconnected. If the application started AFTER attaching to the docking station, the issue isn't always visible unless you can keep the application active.

      In the actual application being used when the laptop is placed back on the docking station, the tooltips and even menu items will appear on different monitors.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Ensure a laptop, a docking station for the laptop and at least 2 external monitors are available.

      Create a simple JFrame with a ComboBox and about 5 entries.
      Incorporate this sample into a Java Web Start application.
      Run the application, then disconnect the laptop from the docking stations.
      If the application is still running, view the contents within the combobox and the list is disconnected.

      A 2nd way is to run the application while the laptop is disconnected, then attach the laptop to the docking stations.
      If the application is still running, view the contents within the combobox and the list is disconnected. The list could even appear on another monitor.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Combobox content should remain attached to the ComboBox when the laptop is connected and disconnected from the docking station when using javaws.
      ACTUAL -
      Disconnected JComboBox content, tooltips and menu items.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No crash or Errors generated.

      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------

      ===========================
      Java Source (TestJnlp.java)
      ===========================
      import java.awt.*;
      import javax.swing.*;
      import java.net.*;
      import javax.jnlp.*;
      import java.awt.event.ActionListener;
      import java.awt.event.ActionEvent;
      import java.awt.GraphicsConfiguration;
      import java.awt.GraphicsEnvironment;
      import java.awt.event.MouseAdapter;
      import java.awt.event.MouseEvent;


      public class TestJnlp {
        static BasicService basicService = null;
        public static void main(String args[]) {
          JFrame frame = new JFrame("Disconnected ComboBox List");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

          String country[]={"Item 1","Item 2","Item 3","Item 4","Item 5"};
          JComboBox cb=new JComboBox(country);
          JButton jb = new JButton("Press for ComboBox List");
          jb.setVisible(true);
          cb.setBounds(50, 50,90,20);
          jb.setBounds(50,300,200,30);
          jb.addActionListener(new ActionListener(){
                  public void actionPerformed(ActionEvent e)
                  {
                      cb.hidePopup();
                  }
              });

          jb.addMouseListener(new MouseAdapter() {

              public void mousePressed(MouseEvent e) {
                  cb.showPopup();
              }
          });

          frame.add(cb);
          frame.add(jb);
          frame.setLayout(null);
          frame.setSize(400,500);
          frame.setVisible(true);

        }
      }

      ===========================
      Create file : Test.jnlp
      Replace SERVERNAME with the actual server being used.
      ===========================
      <?xml version="1.0" encoding="utf-8"?>
      <jnlp spec="1.0+" codebase="http://SERVERNAME:8080/" href="Test.jnlp">
          <information>
              <title>Jnlp Testing</title>
              <vendor>GE</vendor>
              <homepage href="http://SERVERNAME:8080/" />
              <description>Testing Testing</description>
          </information>
          <security>
              <all-permissions/>
          </security>
          <resources>
              <j2se version="1.6+" />
              <jar href="TestJnlp.jar" />
          </resources>
          <application-desc main-class="TestJnlp" />
      </jnlp>

      ===========================
      Build Steps
      ===========================
      > javac TestJnlp.java
      > jar -uvf TestJnlp.jar *.class
      ---Sign the JAR file just created.
      ---Move both the TestJnlp.jar and the Test.jnlp files to the ROOT directory of the webserver being used.

      ===========================
      Execution
      ===========================
      ----------------
      Test 1
      ----------------
      Ensure the laptop is on the docking station and execute the following command.
      > javaws -verbose http://SERVERNAME:8080/Test.jnlp

      Once the JFrame appears, remove the laptop from the docking station and open the laptop lid.
      Once the JFrame refreshes on the laptop monitor attempt to view the content of the ComboBox.
      If the application isn't running, restart it while the laptop is disconnected and view the content of the ComboBox.


      ----------------
      Test 2 - not as consistent
      ----------------
      Ensure the laptop is disconnected from the docking station and execute the following command.
      > javaws -verbose http://SERVERNAME:8080/Test.jnlp

      Once the JFrame appears, attach the laptop to the docking station.
      Once the JFrame refreshes on the external monitors attempt to view the content of the ComboBox.
      If the application isn't running, restarting it won't recreate the issue.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Stop the application and restart after the laptop is attached or detached from the docking station, but this doesn't always work.

            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: