Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/JInternalFrame/Test6802868.java
38839 views
1
/*
2
* Copyright (c) 2009, 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
* @bug 6802868
27
* @summary JInternalFrame is not maximized when maximized parent frame
28
* @author Alexander Potochkin
29
* @library ..
30
*/
31
32
import java.awt.Dimension;
33
import java.awt.Point;
34
import java.beans.PropertyVetoException;
35
import javax.swing.JDesktopPane;
36
import javax.swing.JFrame;
37
import javax.swing.JInternalFrame;
38
39
public class Test6802868 {
40
41
public static void main(String[] args) throws Throwable {
42
SwingTest.start(Test6802868.class);
43
}
44
45
private final JFrame frame;
46
private final JInternalFrame internal;
47
private Dimension size;
48
private Point location;
49
50
public Test6802868(JFrame frame) {
51
JDesktopPane desktop = new JDesktopPane();
52
53
this.frame = frame;
54
this.frame.add(desktop);
55
56
this.internal = new JInternalFrame(getClass().getName(), true, true, true, true);
57
this.internal.setVisible(true);
58
59
desktop.add(this.internal);
60
}
61
62
public void firstAction() throws PropertyVetoException {
63
this.internal.setMaximum(true);
64
}
65
66
public void firstTest() {
67
this.size = this.internal.getSize();
68
resizeFrame();
69
}
70
71
public void firstValidation() {
72
if (this.internal.getSize().equals(this.size)) {
73
throw new Error("InternalFrame hasn't changed its size");
74
}
75
}
76
77
public void secondAction() throws PropertyVetoException {
78
this.internal.setIcon(true);
79
}
80
81
public void secondTest() {
82
this.location = this.internal.getDesktopIcon().getLocation();
83
resizeFrame();
84
}
85
86
public void secondValidation() {
87
if (this.internal.getDesktopIcon().getLocation().equals(this.location)) {
88
throw new Error("JDesktopIcon hasn't moved");
89
}
90
}
91
92
private void resizeFrame() {
93
Dimension size = this.frame.getSize();
94
size.width += 10;
95
size.height += 10;
96
this.frame.setSize(size);
97
}
98
}
99
100