Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/swing/JTabbedPane/6416920/bug6416920.java
41153 views
1
/*
2
* Copyright (c) 2011, 2018, 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 6416920
27
* @summary Ensures that selected tab is painted properly in the scroll tab layout
28
* under WindowsLookAndFeel in Windows' "Windows XP" theme.
29
* @author Mikhail Lapshin
30
* @library /test/lib
31
* @build jdk.test.lib.Platform
32
* @run main bug6416920
33
*/
34
35
import javax.swing.plaf.basic.BasicTabbedPaneUI;
36
import javax.swing.JTabbedPane;
37
import javax.swing.SwingConstants;
38
import java.awt.Rectangle;
39
import java.awt.Insets;
40
41
import jdk.test.lib.Platform;
42
43
public class bug6416920 extends BasicTabbedPaneUI {
44
public AccessibleTabbedPaneLayout layout = new AccessibleTabbedPaneLayout();
45
46
public static void main(String[] args) {
47
48
if (!Platform.isWindows()) {
49
return;
50
}
51
52
bug6416920 test = new bug6416920();
53
test.layout.padSelectedTab(SwingConstants.TOP, 0);
54
if (test.rects[0].width < 0) {
55
throw new RuntimeException("A selected tab isn't painted properly " +
56
"in the scroll tab layout under WindowsLookAndFeel " +
57
"in Windows' \"Windows XP\" theme.");
58
}
59
}
60
61
public bug6416920() {
62
super();
63
64
// Set parameters for the padSelectedTab() method
65
selectedTabPadInsets = new Insets(0, 0, 0, 0);
66
67
tabPane = new JTabbedPane();
68
tabPane.setSize(100, 0);
69
tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
70
71
rects = new Rectangle[1];
72
rects[0] = new Rectangle(150, 0, 0, 0);
73
}
74
75
public class AccessibleTabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout {
76
public void padSelectedTab(int tabPlacement, int selectedIndex) {
77
super.padSelectedTab(tabPlacement, selectedIndex);
78
}
79
}
80
}
81
82