Path: blob/master/test/jdk/javax/swing/JInternalFrame/8075314/bug8075314.java
41153 views
/*1* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @key headful26* @bug 807531427* @summary All the InternalFrames will be maximized after maximizing only one28* of the InternalFrame with the special options "-client -Xmixed29* -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel".30* @author Semyon Sadetsky31*/3233import javax.swing.*;34import java.beans.PropertyVetoException;3536public class bug8075314 {373839private static JFrame frame;40private static JInternalFrame frame1;41private static JInternalFrame frame2;4243public static void main(String[] args) throws Exception {44for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager45.getInstalledLookAndFeels()) {46UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());47try {48SwingUtilities.invokeAndWait(new Runnable() {49public void run() {50frame = new JFrame();51frame.setUndecorated(true);52frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);53setup(frame);54}55});5657SwingUtilities.invokeAndWait(new Runnable() {58@Override59public void run() {60try {61frame1.setMaximum(true);62frame1.setClosed(true);63if (frame2.isMaximum()) {64throw new RuntimeException(65"Frame2 is maximized!");66}67} catch (PropertyVetoException e) {68throw new RuntimeException(e);69}7071}72});73} finally {74if (frame != null) { frame.dispose(); }75}76}77System.out.println("ok");78}7980private static void setup(JFrame frame) {81JDesktopPane desktop = new JDesktopPane();82frame.setContentPane(desktop);8384frame1 = new JInternalFrame("1", true, true, true, true);85frame1.setBounds(40, 40, 300, 200);86frame1.setVisible(true);87desktop.add(frame1);88frame2 = new JInternalFrame("2", true, true, true, true);89frame2.setBounds(20, 20, 300, 200);90frame2.setVisible(true);91desktop.add(frame2);9293frame.setSize(500, 400);94frame.setVisible(true);95}96}979899