author | rchamyal |
Tue, 24 May 2016 14:30:31 +0530 | |
changeset 38994 | a6b14a17689b |
parent 36868 | 9d0d667bff5c |
child 40128 | e635645d2a8a |
permissions | -rw-r--r-- |
36868
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
1 |
/* |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
4 |
* |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
8 |
* |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
13 |
* accompanied this code). |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
14 |
* |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
18 |
* |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
21 |
* questions. |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
22 |
*/ |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
23 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
24 |
/* |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
25 |
* @test |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
26 |
* @bug 8145896 |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
27 |
* @summary JInternalFrame setMaximum before adding to desktop throws null pointer exception |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
28 |
* @library ../../regtesthelpers |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
29 |
* @build Util |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
30 |
* @run main TestJInternalFrameMaximize |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
31 |
*/ |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
32 |
import java.awt.Point; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
33 |
import java.awt.Robot; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
34 |
import java.awt.event.ActionEvent; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
35 |
import java.awt.event.InputEvent; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
36 |
import java.beans.PropertyVetoException; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
37 |
import javax.swing.JFrame; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
38 |
import javax.swing.JDesktopPane; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
39 |
import javax.swing.JMenu; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
40 |
import javax.swing.JMenuBar; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
41 |
import javax.swing.JMenuItem; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
42 |
import javax.swing.JInternalFrame; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
43 |
import javax.swing.SwingUtilities; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
44 |
import javax.swing.UIManager; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
45 |
import javax.swing.UnsupportedLookAndFeelException; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
46 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
47 |
public class TestJInternalFrameMaximize { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
48 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
49 |
private static JDesktopPane desktopPane; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
50 |
private static JFrame frame; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
51 |
private static int count = 0; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
52 |
private static JMenu menu; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
53 |
private static JMenuBar menuBar; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
54 |
private static JMenuItem menuItem; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
55 |
private static Robot robot; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
56 |
private static volatile String errorMessage = ""; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
57 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
58 |
public static void main(String[] args) throws Exception { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
59 |
robot = new Robot(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
60 |
UIManager.LookAndFeelInfo[] lookAndFeelArray |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
61 |
= UIManager.getInstalledLookAndFeels(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
62 |
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
63 |
String lookAndFeelString = lookAndFeelItem.getClassName(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
64 |
if (tryLookAndFeel(lookAndFeelString)) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
65 |
createUI(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
66 |
robot.waitForIdle(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
67 |
executeTest(); |
38994
a6b14a17689b
8153282: [TEST_BUG] some new JInternalFrame tests fail
rchamyal
parents:
36868
diff
changeset
|
68 |
robot.delay(1000); |
36868
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
69 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
70 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
71 |
if (!"".equals(errorMessage)) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
72 |
throw new RuntimeException(errorMessage); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
73 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
74 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
75 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
76 |
private static boolean tryLookAndFeel(String lookAndFeelString) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
77 |
try { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
78 |
UIManager.setLookAndFeel(lookAndFeelString); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
79 |
return true; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
80 |
} catch (UnsupportedLookAndFeelException | ClassNotFoundException | |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
81 |
InstantiationException | IllegalAccessException e) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
82 |
errorMessage += e.getMessage() + "\n"; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
83 |
System.err.println("Caught Exception: " + e.getMessage()); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
84 |
return false; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
85 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
86 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
87 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
88 |
private static void createUI() throws Exception { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
89 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
90 |
SwingUtilities.invokeAndWait(() -> { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
91 |
frame = new JFrame("Test Frame"); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
92 |
desktopPane = new JDesktopPane(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
93 |
frame.getContentPane().add(desktopPane); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
94 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
95 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
96 |
menuBar = new JMenuBar(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
97 |
frame.setJMenuBar(menuBar); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
98 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
99 |
menu = new JMenu("File"); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
100 |
menuBar.add(menu); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
101 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
102 |
menuItem = new JMenuItem("New Child"); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
103 |
menuItem.addActionListener((ActionEvent e) -> { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
104 |
try { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
105 |
JInternalFrame f = new JInternalFrame("Child " |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
106 |
+ (++count), true, true, true, true); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
107 |
f.setSize(200, 300); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
108 |
f.setLocation(count * 20, count * 20); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
109 |
f.setMaximum(true); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
110 |
desktopPane.add(f); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
111 |
f.setVisible(true); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
112 |
} catch (PropertyVetoException ex) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
113 |
} catch (RuntimeException ex) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
114 |
errorMessage = "Test Failed"; |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
115 |
} finally { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
116 |
frame.dispose(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
117 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
118 |
}); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
119 |
menu.add(menuItem); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
120 |
frame.setSize(500, 500); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
121 |
frame.setLocationRelativeTo(null); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
122 |
frame.setVisible(true); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
123 |
}); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
124 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
125 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
126 |
private static void executeTest() throws Exception { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
127 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
128 |
Point point = Util.getCenterPoint(menu); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
129 |
performMouseOperations(point); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
130 |
point = Util.getCenterPoint(menuItem); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
131 |
performMouseOperations(point); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
132 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
133 |
|
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
134 |
private static void performMouseOperations(Point point) { |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
135 |
robot.mouseMove(point.x, point.y); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
136 |
robot.mousePress(InputEvent.BUTTON1_MASK); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
137 |
robot.mouseRelease(InputEvent.BUTTON1_MASK); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
138 |
robot.delay(1000); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
139 |
robot.waitForIdle(); |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
140 |
} |
9d0d667bff5c
8145896: JInternalFrame setMaximum before adding to desktop throws null pointer exception
rchamyal
parents:
diff
changeset
|
141 |
} |