Mac awt regression? (was JDK-8017189: [macosx]Step9: After openning the "File" menu, the items are disabled; regression since b94)

Weijun Wang weijun.wang at oracle.com
Tue Jun 25 05:39:52 UTC 2013


Hi All

Sorry to write in HTML. I need to add a table.

The bug is about after several clicks on policytool a menu item is
disabled. I've simplified the tool to a small program (attached) with
the same behavior. Running the program in JDK 7 and 8 on Mac shows these
differences:


	JDK 7
	JDK 8
Start the app 	New in File menu is enabled
	New in File menu is enabled (same as JDK 7)
Click button one, dialog one pops up
	File menu disappears
	New in File menu is disabled
Click button two, dialog two pops up
	
	File menu disappears
Close dialog two
	
	No change
Close dialog one
	File menu reappear with New enabled
	File menu reappears, but New still disabled
Command+Q to quite the app
	
	


Is this a regression?

Thanks
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/security-dev/attachments/20130625/c6f6860d/attachment.htm>
-------------- next part --------------
import java.awt.*;
import java.awt.event.*;

public class A2 {

    public static void main(String args[]) {
        ToolWindow tw = new ToolWindow();
        tw.displayToolWindow();
    }
}

class ToolWindow extends Frame {
    void displayToolWindow() {

        setBounds(135, 80, 500, 500);

        MenuBar menuBar = new MenuBar();
        Menu menu = new Menu("File");
        menu.add("New");
        menuBar.add(menu);
        setMenuBar(menuBar);

        Button button = new Button("One");
        button.addActionListener(new MainWindowListener(this));
        this.add(button);

        setVisible(true);
    }
}

class ToolDialog extends Dialog {
    ToolWindow tw;

    ToolDialog(String title, ToolWindow tw) {
        super(tw, true);
        setTitle(title);
        this.tw = tw;
        addWindowListener(new ChildWindowListener(this));
    }

    void displayPolicyEntryDialog(boolean edit) {

        Point location = tw.getLocationOnScreen();
        setBounds(location.x + 75, location.y + 200, 650, 500);

        Button button = new Button("Add Two");
        button.addActionListener(new AddPrinButtonListener(this));
        this.add(button);
        setVisible(true);
    }

    void displayPrincipalDialog() {
        ToolDialog newTD = new ToolDialog("Two", tw);
        Point location = getLocationOnScreen();
        newTD.setBounds(location.x + 50, location.y + 100, 650, 190);
        newTD.setVisible(true);
    }
}

class MainWindowListener implements ActionListener {

    private ToolWindow tw;

    MainWindowListener(ToolWindow tw) {
        this.tw = tw;
    }

    public void actionPerformed(ActionEvent e) {
        ToolDialog td = new ToolDialog("One", tw);
        td.displayPolicyEntryDialog(false);
    }
}

class AddPrinButtonListener implements ActionListener {

    private ToolDialog td;

    AddPrinButtonListener(ToolDialog td) {
        this.td = td;
    }

    public void actionPerformed(ActionEvent e) {
        td.displayPrincipalDialog();
    }
}

class ChildWindowListener implements WindowListener {
    private ToolDialog td;

    ChildWindowListener(ToolDialog td) {
        this.td = td;
    }

    public void windowClosing(WindowEvent we) {
        td.setVisible(false);
        td.dispose();
    }

    public void windowOpened(WindowEvent we) { }
    public void windowClosed(WindowEvent we) {}
    public void windowIconified(WindowEvent we) {}
    public void windowDeiconified(WindowEvent we) {}
    public void windowActivated(WindowEvent we) {}
    public void windowDeactivated(WindowEvent we) {}
}


More information about the security-dev mailing list