JDK-4318404 : Modal dialogs do not behave as documented even in separate AppContexts
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2000-03-02
  • Updated: 2000-03-06
  • Resolved: 2000-03-06
Related Reports
Duplicate :  
Description

Name: krT82822			Date: 03/02/2000


2 Mar 2000, eval1127@eng -- please see Comments section.

java version "1.2.2" (and kestrel-rc1)
HotSpot VM (1.0.1, mixed mode, build g)

The JDK1.2 javadoc says
<quote>
A modal dialog is one which blocks input to all other toplevel
windows in the app context, except for any windows created
with the dialog as their owner.
</quote>

I figured out how to create a separate AppContext. It still
does not work correctly.

Here is the test case


/**
 * MTGDialogTest.java
 *
 *
 * Created: Thu Feb 18 15:55:03 1999
 *
 * @author Sandip Chitale
 * @version
 */
import sun.awt.*;
import java.awt.*;
import java.awt.event.*;



public class MTGDialogTest extends Frame {
	
    private Dialog jd;

    private static int i = 0;
    private static int count = 0;
    
    public MTGDialogTest() {
        i++;
        setTitle(MTGDialogTest.class.getName() + "-" + i);

        jd = new Dialog(this, "JDialog"  + "-" + i ,  true);
		jd.setResizable(false);
        jd.addWindowListener(new WindowAdapter() {
				public void windowActivated(WindowEvent e) {}
				public void windowClosed(WindowEvent e) {}
				public void windowClosing(WindowEvent e)
{jd.setVisible(false);}
				public void windowDeactivated(WindowEvent e) {}
				public void windowDeiconified(WindowEvent e) {}
				public void windowIconified(WindowEvent e) {}
				public void windowOpened(WindowEvent e) {}});
        
        jd.setSize(200,200);
        
        Button b = new Button("Show dialog");
        b.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					jd.show();
				}});
        
        add(b, BorderLayout.CENTER);
        setBounds(count*50, count*50, 300,300);
		count++;
		

		addWindowListener(new WindowAdapter() {
				public void windowActivated(WindowEvent e) {}
				public void windowClosed(WindowEvent e) {}
				public void windowClosing(WindowEvent e)
{System.exit(0);}
				
				public void windowDeactivated(WindowEvent e) {}
				public void windowDeiconified(WindowEvent e) {}
				public void windowIconified(WindowEvent e) {}
				public void windowOpened(WindowEvent e) {}});
		System.out.println("----");
		System.out.println(AppContext.getAppContext());
		
System.out.println(Toolkit.getDefaultToolkit().getSystemEventQueue());
		
    }

    public static void main(String args[])
    {
		ThreadGroup tg = null;
	
		Thread t = null;
	
		for (int i = 0; i < 4; i++) {
			tg = new ThreadGroup("sandip" + i);
			t = new Thread(tg,
						   new Runnable() {
								   public void
run()
								   {
									   //
Comment the following to have shared AppContext vs separate AppContext per
									   //
threadgroup
									   
SunToolkit.createNewAppContext();
									   new
MTGDialogTest().setVisible(true);
								   }
							   }
						   );
			t.start();
		}
    }
    
} // MTGDialogTest
(Review ID: 101999) 
======================================================================

Comments
WORK AROUND Name: krT82822 Date: 03/02/2000 None. ======================================================================
11-06-2004

EVALUATION I doubt this is a showstopper for Kestrel. We should evaluate whether or not it is a priority for Merlin at some point in the future. eric.hawkes@eng 2000-03-03
03-03-2000