Search in sources :

Example 26 with Dialog

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;
}
Also used : Window(java.awt.Window) Frame(java.awt.Frame) WindowListener(java.awt.event.WindowListener) Dialog(java.awt.Dialog)

Example 27 with 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();
}
Also used : Frame(java.awt.Frame) Dialog(java.awt.Dialog) Robot(java.awt.Robot)

Example 28 with Dialog

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);
}
Also used : Graphics(java.awt.Graphics) Dialog(java.awt.Dialog) AffineTransform(java.awt.geom.AffineTransform) Graphics2D(java.awt.Graphics2D)

Example 29 with Dialog

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();
    }
}
Also used : Frame(java.awt.Frame) Dialog(java.awt.Dialog) Point(java.awt.Point) Robot(java.awt.Robot) Point(java.awt.Point)

Example 30 with Dialog

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);
}
Also used : Frame(java.awt.Frame) Dialog(java.awt.Dialog)

Aggregations

Dialog (java.awt.Dialog)34 Frame (java.awt.Frame)19 Window (java.awt.Window)8 JButton (javax.swing.JButton)5 Container (java.awt.Container)4 Graphics (java.awt.Graphics)4 Panel (java.awt.Panel)4 JInternalFrame (javax.swing.JInternalFrame)4 JPanel (javax.swing.JPanel)4 ElementNotFoundException (com.axway.ats.uiengine.exceptions.ElementNotFoundException)3 BorderLayout (java.awt.BorderLayout)3 Point (java.awt.Point)3 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 WindowAdapter (java.awt.event.WindowAdapter)3 WindowEvent (java.awt.event.WindowEvent)3 DialogControls (org.gephi.datalab.spi.DialogControls)3 AttributeColumnsManipulatorUI (org.gephi.datalab.spi.columns.AttributeColumnsManipulatorUI)3 DialogDescriptor (org.openide.DialogDescriptor)3 Button (java.awt.Button)2