< prev index next >
test/java/awt/Window/ChangeWindowResizabilty/ChangeWindowResizabiltyTest.java
Print this page
*** 19,29 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! /* @bug 8166897
@summary Some font overlap in the Optionpane dialog.
@run main ChangeWindowResizabiltyTest
*/
import java.awt.*;
--- 19,31 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! /*
! @test
! @bug 8166897
@summary Some font overlap in the Optionpane dialog.
@run main ChangeWindowResizabiltyTest
*/
import java.awt.*;
*** 31,64 ****
public class ChangeWindowResizabiltyTest {
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
for(int i = 0; i < 10; i++) {
Dialog dialog = new Dialog((Frame) null);
Component panel = new Panel();
panel.setPreferredSize(new Dimension(200, 100));
dialog.add(panel);
dialog.pack();
dialog.setVisible(true);
dialog.setResizable(false);
robot.waitForIdle();
robot.delay(200);
! System.out.println(panel.getLocationOnScreen());
! System.out.println(dialog.getLocationOnScreen());
if (panel.getLocationOnScreen().y <
dialog.getLocationOnScreen().y + dialog.getInsets().top) {
dialog.dispose();
throw new RuntimeException(
"Wrong content position after setResizable(false)");
}
dialog.setResizable(true);
robot.waitForIdle();
robot.delay(200);
! System.out.println(panel.getLocationOnScreen());
! System.out.println(dialog.getLocationOnScreen());
if (panel.getLocationOnScreen().y <
dialog.getLocationOnScreen().y + dialog.getInsets().top) {
dialog.dispose();
throw new RuntimeException(
"Wrong content position after setResizable(true)");
--- 33,99 ----
public class ChangeWindowResizabiltyTest {
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
for(int i = 0; i < 10; i++) {
Dialog dialog = new Dialog((Frame) null);
+ dialog.setLocation(100, 100);
Component panel = new Panel();
panel.setPreferredSize(new Dimension(200, 100));
dialog.add(panel);
dialog.pack();
dialog.setVisible(true);
+ robot.waitForIdle();
+ robot.delay(200);
+
+ Point frameLoc = dialog.getLocationOnScreen();
+ Point contentLoc = panel.getLocationOnScreen();
+
+ System.out.println("Decor location " + frameLoc);
+ System.out.println("Content location " + contentLoc);
dialog.setResizable(false);
robot.waitForIdle();
robot.delay(200);
! Point l = dialog.getLocationOnScreen();
! if (!l.equals(frameLoc)) {
! dialog.dispose();
! throw new RuntimeException("Decorated frame location moved " +
! "after setResizable(false)" + l);
! }
!
! l = panel.getLocationOnScreen();
! if (!l.equals(contentLoc)) {
! dialog.dispose();
! throw new RuntimeException("Content location moved after " +
! "setResizable(false)" + l);
! }
!
if (panel.getLocationOnScreen().y <
dialog.getLocationOnScreen().y + dialog.getInsets().top) {
dialog.dispose();
throw new RuntimeException(
"Wrong content position after setResizable(false)");
}
dialog.setResizable(true);
robot.waitForIdle();
robot.delay(200);
!
! l = dialog.getLocationOnScreen();
! if (!l.equals(frameLoc)) {
! dialog.dispose();
! throw new RuntimeException("Decorated frame location moved " +
! "after setResizable(true)" + l);
! }
!
! l = panel.getLocationOnScreen();
! if (!l.equals(contentLoc)) {
! dialog.dispose();
! throw new RuntimeException("Content location moved after " +
! "setResizable(true)" + l);
! }
if (panel.getLocationOnScreen().y <
dialog.getLocationOnScreen().y + dialog.getInsets().top) {
dialog.dispose();
throw new RuntimeException(
"Wrong content position after setResizable(true)");
< prev index next >