test/jdk/java/awt/Frame/UnfocusableMaximizedFrameResizablity/UnfocusableMaximizedFrameResizablity.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 @test |
25 @test |
26 @key headful |
26 @key headful |
27 @bug 4980161 7158623 8204860 8208125 |
27 @bug 4980161 7158623 8204860 8208125 8215280 |
28 @summary Setting focusable window state to false makes the maximized frame resizable |
28 @summary Setting focusable window state to false makes the maximized frame resizable |
29 @compile UnfocusableMaximizedFrameResizablity.java |
29 @compile UnfocusableMaximizedFrameResizablity.java |
30 @run main UnfocusableMaximizedFrameResizablity |
30 @run main UnfocusableMaximizedFrameResizablity |
31 */ |
31 */ |
32 |
32 |
45 private static Thread mainThread = null; |
45 private static Thread mainThread = null; |
46 private static int sleepTime = 300000; |
46 private static int sleepTime = 300000; |
47 |
47 |
48 private static void createAndShowFrame() throws Exception { |
48 private static void createAndShowFrame() throws Exception { |
49 |
49 |
|
50 //MAXIMIZED_BOTH frame is resizable on Mac OS by default. Nothing to test. |
|
51 if (System.getProperty("os.name").toLowerCase().startsWith("mac")) { |
|
52 cleanup(); |
|
53 return; |
|
54 } |
|
55 |
50 //The MAXIMIZED_BOTH state is not supported by the toolkit. Nothing to test. |
56 //The MAXIMIZED_BOTH state is not supported by the toolkit. Nothing to test. |
51 if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { |
57 if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { |
|
58 cleanup(); |
52 return; |
59 return; |
53 } |
60 } |
54 |
61 |
55 frame = new Frame("Unfocusable frame"); |
62 frame = new Frame("Unfocusable frame"); |
56 frame.setMaximizedBounds(new Rectangle(0, 0, 300, 300)); |
63 frame.setMaximizedBounds(new Rectangle(0, 0, 300, 300)); |
91 } |
98 } |
92 cleanup(); |
99 cleanup(); |
93 } |
100 } |
94 |
101 |
95 private static void cleanup() { |
102 private static void cleanup() { |
96 frame.dispose(); |
103 if (frame != null) { |
|
104 frame.dispose(); |
|
105 } |
97 isProgInterruption = true; |
106 isProgInterruption = true; |
98 mainThread.interrupt(); |
107 mainThread.interrupt(); |
99 } |
108 } |
100 |
109 |
101 public static void main(String args[]) throws Exception { |
110 public static void main(String args[]) throws Exception { |