jdk/test/javax/swing/JInternalFrame/8075314/bug8075314.java
author ssadetsky
Fri, 03 Apr 2015 16:40:34 +0400
changeset 29892 2552120a1589
child 46151 5fa789776f7d
permissions -rw-r--r--
8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel Reviewed-by: serb, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29892
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     1
/*
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     4
 *
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     8
 *
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    13
 * accompanied this code).
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    14
 *
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    18
 *
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    21
 * questions.
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    22
 */
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    23
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    24
/* @test
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    25
   @bug 8075314
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    26
   @summary All the InternalFrames will be maximized after maximizing only one
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    27
   of the InternalFrame with the special options "-client -Xmixed
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    28
   -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel".
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    29
   @author Semyon Sadetsky
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    30
  */
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    31
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    32
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    33
import javax.swing.*;
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    34
import java.beans.PropertyVetoException;
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    35
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    36
public class bug8075314 {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    37
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    38
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    39
    private static JFrame frame;
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    40
    private static JInternalFrame frame1;
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    41
    private static JInternalFrame frame2;
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    42
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    43
    public static void main(String[] args) throws Exception {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    44
        for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    45
                .getInstalledLookAndFeels()) {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    46
            UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    47
            try {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    48
                SwingUtilities.invokeAndWait(new Runnable() {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    49
                    public void run() {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    50
                        frame = new JFrame();
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    51
                        frame.setUndecorated(true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    52
                        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    53
                        setup(frame);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    54
                    }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    55
                });
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    56
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    57
                SwingUtilities.invokeAndWait(new Runnable() {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    58
                    @Override
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    59
                    public void run() {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    60
                        try {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    61
                            frame1.setMaximum(true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    62
                            frame1.setClosed(true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    63
                            if (frame2.isMaximum()) {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    64
                                throw new RuntimeException(
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    65
                                        "Frame2 is maximized!");
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    66
                            }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    67
                        } catch (PropertyVetoException e) {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    68
                            throw new RuntimeException(e);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    69
                        }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    70
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    71
                    }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    72
                });
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    73
            } finally {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    74
                frame.dispose();
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    75
            }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    76
        }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    77
        System.out.println("ok");
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    78
    }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    79
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    80
    private static void setup(JFrame frame) {
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    81
        JDesktopPane desktop = new JDesktopPane();
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    82
        frame.setContentPane(desktop);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    83
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    84
        frame1 = new JInternalFrame("1", true, true, true, true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    85
        frame1.setBounds(40, 40, 300, 200);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    86
        frame1.setVisible(true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    87
        desktop.add(frame1);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    88
        frame2 = new JInternalFrame("2", true, true, true, true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    89
        frame2.setBounds(20, 20, 300, 200);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    90
        frame2.setVisible(true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    91
        desktop.add(frame2);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    92
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    93
        frame.setSize(500, 400);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    94
        frame.setVisible(true);
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    95
    }
2552120a1589 8075314: All the InternalFrames will be maximized after maximizing only one of the InternalFrame with WindowsLookAndFeel
ssadetsky
parents:
diff changeset
    96
}