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 /* @test
25 @bug 8075314
26 @summary All the InternalFrames will be maximized after maximizing only one
27 of the InternalFrame with the special options "-client -Xmixed
28 -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel".
29 @author Semyon Sadetsky
30 */
31
32
33 import javax.swing.*;
34 import java.beans.PropertyVetoException;
35
36 public class bug8075314 {
37
38
39 private static JFrame frame;
40 private static JInternalFrame frame1;
41 private static JInternalFrame frame2;
42
43 public static void main(String[] args) throws Exception {
44 for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager
45 .getInstalledLookAndFeels()) {
46 UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
47 try {
48 SwingUtilities.invokeAndWait(new Runnable() {
49 public void run() {
50 frame = new JFrame();
51 frame.setUndecorated(true);
52 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
54 }
55 });
56
57 SwingUtilities.invokeAndWait(new Runnable() {
58 @Override
59 public void run() {
60 try {
61 frame1.setMaximum(true);
62 frame1.setClosed(true);
63 if (frame2.isMaximum()) {
64 throw new RuntimeException(
65 "Frame2 is maximized!");
66 }
67 } catch (PropertyVetoException e) {
68 throw new RuntimeException(e);
69 }
70
71 }
72 });
73 } finally {
74 frame.dispose();
75 }
76 }
77 System.out.println("ok");
78 }
79
80 private static void setup(JFrame frame) {
81 JDesktopPane desktop = new JDesktopPane();
82 frame.setContentPane(desktop);
83
84 frame1 = new JInternalFrame("1", true, true, true, true);
85 frame1.setBounds(40, 40, 300, 200);
86 frame1.setVisible(true);
87 desktop.add(frame1);
88 frame2 = new JInternalFrame("2", true, true, true, true);
89 frame2.setBounds(20, 20, 300, 200);
90 frame2.setVisible(true);
91 desktop.add(frame2);
92
93 frame.setSize(500, 400);
94 frame.setVisible(true);
|
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 * @key headful
27 * @bug 8075314
28 * @summary All the InternalFrames will be maximized after maximizing only one
29 * of the InternalFrame with the special options "-client -Xmixed
30 * -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel".
31 * @author Semyon Sadetsky
32 */
33
34 import javax.swing.*;
35 import java.beans.PropertyVetoException;
36
37 public class bug8075314 {
38
39
40 private static JFrame frame;
41 private static JInternalFrame frame1;
42 private static JInternalFrame frame2;
43
44 public static void main(String[] args) throws Exception {
45 for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager
46 .getInstalledLookAndFeels()) {
47 UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
48 try {
49 SwingUtilities.invokeAndWait(new Runnable() {
50 public void run() {
51 frame = new JFrame();
52 frame.setUndecorated(true);
53 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
55 }
56 });
57
58 SwingUtilities.invokeAndWait(new Runnable() {
59 @Override
60 public void run() {
61 try {
62 frame1.setMaximum(true);
63 frame1.setClosed(true);
64 if (frame2.isMaximum()) {
65 throw new RuntimeException(
66 "Frame2 is maximized!");
67 }
68 } catch (PropertyVetoException e) {
69 throw new RuntimeException(e);
70 }
71
72 }
73 });
74 } finally {
75 if (frame != null) { frame.dispose(); }
76 }
77 }
78 System.out.println("ok");
79 }
80
81 private static void setup(JFrame frame) {
82 JDesktopPane desktop = new JDesktopPane();
83 frame.setContentPane(desktop);
84
85 frame1 = new JInternalFrame("1", true, true, true, true);
86 frame1.setBounds(40, 40, 300, 200);
87 frame1.setVisible(true);
88 desktop.add(frame1);
89 frame2 = new JInternalFrame("2", true, true, true, true);
90 frame2.setBounds(20, 20, 300, 200);
91 frame2.setVisible(true);
92 desktop.add(frame2);
93
94 frame.setSize(500, 400);
95 frame.setVisible(true);
|