use of java.awt.Dialog in project jdk8u_jdk by JetBrains.
the class JOptionPane method createDialog.
private JDialog createDialog(Component parentComponent, String title, int style) throws HeadlessException {
final JDialog dialog;
Window window = JOptionPane.getWindowForComponent(parentComponent);
if (window instanceof Frame) {
dialog = new JDialog((Frame) window, title, true);
} else {
dialog = new JDialog((Dialog) window, title, true);
}
if (window instanceof SwingUtilities.SharedOwnerFrame) {
WindowListener ownerShutdownListener = SwingUtilities.getSharedOwnerFrameShutdownListener();
dialog.addWindowListener(ownerShutdownListener);
}
initDialog(dialog, style, parentComponent);
return dialog;
}
use of java.awt.Dialog in project jdk8u_jdk by JetBrains.
the class WindowDeadlockTest method main.
public static void main(String[] args) throws Exception {
Robot robot = Util.createRobot();
Frame main = new Frame("Main");
main.setBounds(0, 0, 200, 100);
main.setVisible(true);
Dialog first = new Dialog(main, "First");
first.setBounds(250, 0, 200, 100);
first.setVisible(true);
Dialog second = new Dialog(first, "Second");
second.setBounds(0, 150, 200, 100);
second.setVisible(true);
Util.waitForIdle(robot);
robot.delay(2000);
Dialog third = new Dialog(first, "Third", false);
third.setBounds(250, 150, 200, 100);
third.setVisible(true);
// the hang takes place here
first.setVisible(false);
Util.waitForIdle(robot);
robot.delay(2000);
third.dispose();
second.dispose();
first.dispose();
main.dispose();
}
use of java.awt.Dialog in project jdk8u_jdk by JetBrains.
the class HiDPIPropertiesWindowsTest method testScale.
private static void testScale(double scaleX, double scaleY) {
Dialog dialog = new Dialog((Frame) null, true) {
@Override
public void paint(Graphics g) {
super.paint(g);
AffineTransform tx = ((Graphics2D) g).getTransform();
dispose();
if (scaleX != tx.getScaleX() || scaleY != tx.getScaleY()) {
throw new RuntimeException(String.format("Wrong scale:" + "[%f, %f] instead of [%f, %f].", tx.getScaleX(), tx.getScaleY(), scaleX, scaleY));
}
}
};
dialog.setSize(200, 300);
dialog.setVisible(true);
}
use of java.awt.Dialog in project jdk8u_jdk by JetBrains.
the class DialogAboveFrameTest method main.
public static void main(String[] args) {
Robot robot = Util.createRobot();
Frame frame = new Frame("Frame");
frame.setBackground(Color.BLUE);
frame.setBounds(200, 50, 300, 300);
frame.setVisible(true);
Dialog dialog1 = new Dialog(frame, "Dialog 1", false);
dialog1.setBackground(Color.RED);
dialog1.setBounds(100, 100, 200, 200);
dialog1.setVisible(true);
Dialog dialog2 = new Dialog(frame, "Dialog 2", false);
dialog2.setBackground(Color.GREEN);
dialog2.setBounds(400, 100, 200, 200);
dialog2.setVisible(true);
Util.waitForIdle(robot);
Util.clickOnComp(dialog2, robot);
Util.waitForIdle(robot);
Point point = dialog1.getLocationOnScreen();
int x = point.x + (int) (dialog1.getWidth() * 0.9);
int y = point.y + (int) (dialog1.getHeight() * 0.9);
try {
if (!Util.testPixelColor(x, y, dialog1.getBackground(), 10, 100, robot)) {
throw new RuntimeException("Test FAILED: Dialog is behind the frame");
}
} finally {
frame.dispose();
dialog1.dispose();
dialog2.dispose();
}
}
use of java.awt.Dialog in project jdk8u_jdk by JetBrains.
the class ModalDialogOrderingTest method main.
public static void main(String[] args) {
final Frame frame = new Frame("Test");
frame.setSize(400, 400);
frame.setBackground(FRAME_COLOR);
frame.setVisible(true);
final Dialog modalDialog = new Dialog(null, true);
modalDialog.setTitle("Modal Dialog");
modalDialog.setSize(400, 200);
modalDialog.setBackground(DIALOG_COLOR);
modalDialog.setModal(true);
new Thread(new Runnable() {
@Override
public void run() {
runTest(modalDialog, frame);
}
}).start();
modalDialog.setVisible(true);
}
Aggregations