Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/awt/Frame/ResizeAfterSetFont/ResizeAfterSetFont.java
41153 views
1
/*
2
* Copyright (c) 2012, 2016, 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
* Portions Copyright (c) 2012 IBM Corporation
26
*/
27
28
/*
29
@test
30
@key headful
31
@bug 7170655
32
@summary Frame size does not change after changing font
33
@author Jonathan Lu
34
@library ../../regtesthelpers
35
@build Util
36
@run main ResizeAfterSetFont
37
*/
38
39
import java.awt.*;
40
import test.java.awt.regtesthelpers.Util;
41
42
public class ResizeAfterSetFont {
43
44
public static void main(String[] args) throws Exception {
45
Frame frame = new Frame("bug7170655");
46
frame.setLayout(new BorderLayout());
47
frame.setBackground(Color.LIGHT_GRAY);
48
49
Panel panel = new Panel();
50
panel.setLayout(new GridLayout(0, 1, 1, 1));
51
52
Label label = new Label("Test Label");
53
label.setBackground(Color.white);
54
label.setForeground(Color.RED);
55
label.setFont(new Font("Dialog", Font.PLAIN, 12));
56
57
panel.add(label);
58
frame.add(panel, "South");
59
frame.pack();
60
frame.setVisible(true);
61
62
Util.waitForIdle(null);
63
64
Dimension dimBefore = frame.getSize();
65
label.setFont(new Font("Dialog", Font.PLAIN, 24));
66
67
frame.validate();
68
frame.pack();
69
Dimension dimAfter = frame.getSize();
70
71
if (dimBefore.equals(dimAfter)) {
72
throw new Exception(
73
"Frame size does not change after Label.setFont()!");
74
}
75
}
76
}
77
78