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