JDK-6709904 : JDialogs do not appear on correct workspace under CDE
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: solaris_10
  • CPU: x86
  • Submitted: 2008-06-03
  • Updated: 2011-02-16
  • Resolved: 2008-06-19
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
SunOS merxia 5.10 Generic sun4u sparc

A DESCRIPTION OF THE PROBLEM :
When you open a JDialog parented to a JFrame on a CDE workspace other than the one from which you started the Java application, the dialog incorrectly appears on the original workspace.

That is to say, if you start your application on workspace One, then drag the frame to workspace Two, and then launch a dialog, the dialog appears back on workspace One (and as a result, you don't see it, and are left wondering where the dialog is).

The issue doesn't occur on KDE's multiple desktops -- it seems particular to CDE's workspaces.

This might be related to Bug ID: 6429749 JDialog does not disappear with setVisible(false) when changing workspace

Not a high priority issue, but something worth investigating.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In workspace One, run the attached program on CDE, which opens two frames. Drag the second frame (the one titled "Put me on the second workspace") to workspace Two. Then click the button contained therein titled "Show dialog". Note that the dialog doesn't appear -- it's back on workspace One.

Once you switch workspaces, however, odd things start happening -- the dialog appears on *both* workspaces, and one of them won't interact properly.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected the dialog to appear on workspace Two, or more generally, to appear on whatever workspace on which its parent sits.
ACTUAL -
The dialog appears on workspace One.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.event.*;

public class CDETest {
    public static void main(String[] args) throws Exception {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        JFrame f1 = new JFrame("Put me on the first workspace");
        f1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        f1.setSize(360, 260);
        f1.setLocationRelativeTo(null);
        f1.setVisible(true);

        final JFrame f2 = new JFrame("Put me on the second workspace");
        f2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        f2.setSize(300, 200);
        f2.setLocationRelativeTo(null);
        f2.add(new JButton(new AbstractAction("Show dialog") {
            public void actionPerformed(ActionEvent event) {
                JDialog d1 = new JDialog(f2, true);
                d1.add(new JLabel("I should be on the second workspace"));
                d1.pack();
                d1.setVisible(true);
            }
        }));
        f2.setVisible(true);
    }
---------- END SOURCE ----------

Comments
EVALUATION The reason of this behavior is override-redirect nature of java.awt.Window. It is changed in jdk7 but will not be changed in earlier releases as it is too risky a change.
19-06-2008