author | ssadetsky |
Wed, 03 Apr 2019 15:43:25 -0700 | |
branch | JDK-8200758-branch |
changeset 57303 | eff0cf668c29 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
19173
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
1 |
/* |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
4 |
* |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
8 |
* |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
13 |
* accompanied this code). |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
14 |
* |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
18 |
* |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
21 |
* questions. |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
22 |
*/ |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
23 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
24 |
import javax.swing.*; |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
25 |
import java.awt.*; |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
26 |
/* |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
27 |
* @test |
40128
e635645d2a8a
8160974: [TESTBUG] Mark more headful tests with @key headful.
goetz
parents:
28071
diff
changeset
|
28 |
* @key headful |
19173
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
29 |
* @bug 6495408 |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
30 |
* @summary REGRESSION: JTabbedPane throws ArrayIndexOutOfBoundsException |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
31 |
* @author Alexander Potochkin |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
32 |
* @run main bug6495408 |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
33 |
*/ |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
34 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
35 |
public class bug6495408 { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
36 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
37 |
static JTabbedPane tabbedPane; |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
38 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
39 |
public static void main(String[] args) throws Exception { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
40 |
final Robot robot = new Robot(); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
41 |
robot.setAutoDelay(50); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
42 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
43 |
SwingUtilities.invokeAndWait(new Runnable() { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
44 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
45 |
public void run() { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
46 |
final JFrame frame = new JFrame(); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
47 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
48 |
tabbedPane = new JTabbedPane(); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
49 |
tabbedPane.setTabPlacement(JTabbedPane.LEFT); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
50 |
tabbedPane.addTab("Hello", null); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
51 |
frame.add(tabbedPane); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
52 |
frame.setSize(400, 400); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
53 |
frame.setLocationRelativeTo(null); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
54 |
frame.setVisible(true); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
55 |
} |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
56 |
}); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
57 |
|
28071
3acb75b8df45
8063107: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents:
19173
diff
changeset
|
58 |
robot.waitForIdle(); |
19173
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
59 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
60 |
final Rectangle d = new Rectangle(); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
61 |
final Point p = new Point(); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
62 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
63 |
for (int i = 0; i < 7; i++) { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
64 |
SwingUtilities.invokeLater(new Runnable() { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
65 |
|
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
66 |
public void run() { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
67 |
int tab = tabbedPane.getTabCount() - 1; |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
68 |
Rectangle bounds = tabbedPane.getBoundsAt(tab); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
69 |
if (bounds != null) { |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
70 |
d.setBounds(bounds); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
71 |
p.setLocation(d.x + d.width / 2, d.y + d.height / 2); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
72 |
SwingUtilities.convertPointToScreen(p, tabbedPane); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
73 |
robot.mouseMove(p.x, p.y + d.height); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
74 |
tabbedPane.addTab("Hello", null); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
75 |
} |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
76 |
} |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
77 |
}); |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
78 |
} |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
79 |
} |
5c179adfb12b
7161568: [macosx] api/javax_swing/JTabbedPane/index2.html#varios fails
alexsch
parents:
diff
changeset
|
80 |
} |