JDK-4124096 : modal dialogs don't properly block input to all windows on Solaris/1.2
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1,1.1.4,1.1.5,1.1.6,1.2.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS:
    solaris_2.5.1,solaris_2.6,windows_95 solaris_2.5.1,solaris_2.6,windows_95
  • CPU: generic,x86,sparc
  • Submitted: 1998-03-31
  • Updated: 1999-11-23
  • Resolved: 1998-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.1.8 1.1.8Fixed 1.2.0Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
The following application displays a JDialog that is created by the
following constructor:
  new JDialog(new JFrame(), "Modal Dialog", true)

The dialog created by this application is modal on Windows NT, but not
on Solaris.
========================================================================= 
/* 
 * ModalDialogTest.java
 * JDialog created with modality parameter set to true is not modal on 
 * Solaris
 * 
 */

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.*;
import java.awt.swing.*;

public class ModalDialogTest extends JPanel implements ActionListener {
   JDialog dialog = new JDialog(new JFrame(), "Modal Dialog", true);

   public static void main( String[] argv ) {
     new ModalDialogTest();
   }

   public ModalDialogTest() {
      JFrame frame = new JFrame("Modal Dialog Test");
      JPanel controlPanel = new JPanel();
      JPanel infoPanel = new JPanel();
      JButton showButton = new JButton("Show Modal Dialog");
      JButton testButton = new JButton("Test");

      frame.getContentPane().setLayout(new BorderLayout());
      infoPanel.setLayout(new GridLayout(0,1));
      showButton.setOpaque(true);
      showButton.setBackground(Color.yellow);
      testButton.setOpaque(true);
      testButton.setBackground(Color.pink);
      controlPanel.add(showButton);
      controlPanel.add(testButton);
      infoPanel.add(new JLabel("Click the \"Show Modal Dialog\" button to display a modal JDialog."));
      infoPanel.add(new JLabel("Click the \"Test\" button to verify dialog modality."));
      frame.getContentPane().add(BorderLayout.NORTH, controlPanel);
      frame.getContentPane().add(BorderLayout.SOUTH, infoPanel);
      dialog.setSize(200,200);

      showButton.addActionListener(this);
      testButton.addActionListener(this);

      frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {System.exit(0);}
        public void windowClosed(WindowEvent e) {System.exit(0);}
      });

      frame.pack();
      frame.setSize(450, 120);
      frame.setVisible(true);
   }

   public void actionPerformed(ActionEvent evt) {
     String command = evt.getActionCommand();

     if (command == "Show Modal Dialog") {
       System.out.println("*** Invoking JDialog.show() ***");
       dialog.setLocation(200,200);
       dialog.show();
     }
     else if (command == "Test") {
       System.out.println("*** Test ***");
     }
   } 

}
========================================================================= 

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.1.8 generic FIXED IN: 1.1.8 1.2fcs INTEGRATED IN: 1.1.8 1.2fcs VERIFIED IN: 1.2fcs
14-06-2004

EVALUATION cannot verify the bug, no regression test provided. tao.zhang@eng 1999-03-01 This is a bug with AWT modality in JDK1.2 (this program works correctly on Solaris if run with JDK1.1.6 using the com.sun.java.swing classes). There is a long sordid history with this problem: The question is whether or not a modal dialog should block input ONLY to it's owner frame, or whether it should block input to ALL other showing windows. About a year ago, there was confusion about this and so Solaris was changed to make modality disable ONLY the owner frame on Solaris. Unfortunately this was inconsistent with the way modality worked on Windows, so we decided to define modality as blocking input to ALL windows, and so Solaris AWT was fixed in one of the JDK1.1.X releases (Xianfa made the fix to 1.1.5 I think). Oddly enough, the sources for 1.2 & 1.1.x look the same, so I'm not sure why it works with 1.1.x and not with 1.2. amy.fowler@Eng 1998-05-26 Both 1.1.x and 1.2 have the same dialog modality FULL_APPLICATION_MODAL. A frame and its dialog has the same modality in both JDK versions. xianfa.deng@Eng 1998-06-18 When a modal dialog parented to another frame, Motif still let the events going through the queue for the other frame. Certain events have to avoid the event preposting when a modal dialog is up. Fixed in 1.2fcs. xianfa.deng@Eng 1998-09-14
14-09-1998