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

[macosx] Frame.setExtendedState() doesn't work for undecorated windows

XMLWordPrintable

    • b18
    • generic
    • os_x
    • Verified

        http://java.net/jira/browse/MACOSX_PORT-35 submitted 2011/04/27 by Artem Ananiev
        Run the attached test. It creates a simple undecorated window and register a mouse listener. When clicked, the window is maximized with a call to setExtendedState(MAXIMIZED_BOTH). However, the maximization only works for decorated windows, while undecorated windows just move to the left bottom corner of the screen.
        The test case:

        import java.awt.*;
        import java.awt.event.*;

        public class CheckExtendedState {

            public static void main(String[] args) {

        final Frame f = new Frame();
        f.setUndecorated(true);
        f.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
        f.setExtendedState(Frame.MAXIMIZED_BOTH);
        }
        });
        f.addKeyListener(new KeyAdapter() {
                    public void keyTyped(KeyEvent e) {
        if (e.getKeyChar() == 'g') {
        System.exit(0);
        }
        }
        });
        f.setSize(640, 480);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
            }

        }

              anthony Anthony Petrov (Inactive)
              vasya Vassili Igouchkine (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: