Search in sources :

Example 31 with Dialog

use of java.awt.Dialog in project jdk8u_jdk by JetBrains.

the class NpeOnCloseTest method main.

public static void main(String[] args) {
    Frame frame1 = new Frame("frame 1");
    frame1.setBounds(0, 0, 100, 100);
    frame1.setVisible(true);
    Util.waitForIdle(null);
    Frame frame2 = new Frame("frame 2");
    frame2.setBounds(150, 0, 100, 100);
    frame2.setVisible(true);
    Util.waitForIdle(null);
    Frame frame3 = new Frame("frame 3");
    final Dialog dialog = new Dialog(frame3, "dialog", true);
    dialog.setBounds(300, 0, 100, 100);
    EventQueue.invokeLater(new Runnable() {

        public void run() {
            dialog.setVisible(true);
        }
    });
    try {
        EventQueue.invokeAndWait(new Runnable() {

            public void run() {
            }
        });
        Util.waitForIdle(null);
        EventQueue.invokeAndWait(new Runnable() {

            public void run() {
                dialog.dispose();
            }
        });
    } catch (InterruptedException ie) {
        throw new RuntimeException(ie);
    } catch (InvocationTargetException ite) {
        throw new RuntimeException(ite);
    }
    frame1.dispose();
    frame2.dispose();
    frame3.dispose();
}
Also used : Frame(java.awt.Frame) Dialog(java.awt.Dialog) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 32 with Dialog

use of java.awt.Dialog in project jdk8u_jdk by JetBrains.

the class ScaledTransform method testScaleFactor.

private static void testScaleFactor(final GraphicsConfiguration gc) {
    final Dialog dialog = new Dialog((Frame) null, "Test", true, gc);
    try {
        dialog.setSize(100, 100);
        Panel panel = new Panel() {

            @Override
            public void paint(Graphics g) {
                if (g instanceof Graphics2D) {
                    AffineTransform gcTx = gc.getDefaultTransform();
                    AffineTransform gTx = ((Graphics2D) g).getTransform();
                    passed = gcTx.getScaleX() == gTx.getScaleX() && gcTx.getScaleY() == gTx.getScaleY();
                } else {
                    passed = true;
                }
                dialog.setVisible(false);
            }
        };
        dialog.add(panel);
        dialog.setVisible(true);
        if (!passed) {
            throw new RuntimeException("Transform is not scaled!");
        }
    } finally {
        dialog.dispose();
    }
}
Also used : Graphics(java.awt.Graphics) Panel(java.awt.Panel) Dialog(java.awt.Dialog) AffineTransform(java.awt.geom.AffineTransform) Graphics2D(java.awt.Graphics2D)

Example 33 with Dialog

use of java.awt.Dialog in project jdk8u_jdk by JetBrains.

the class Util method clickOnTitle.

/*
     * Clicks on a title of Frame/Dialog.
     * WARNING: it may fail on some platforms when the window is not wide enough.
     */
public static void clickOnTitle(final Window decoratedWindow, final Robot robot) {
    if (decoratedWindow instanceof Frame || decoratedWindow instanceof Dialog) {
        Point p = getTitlePoint(decoratedWindow);
        robot.mouseMove(p.x, p.y);
        robot.delay(50);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.delay(50);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
    }
}
Also used : Frame(java.awt.Frame) Dialog(java.awt.Dialog) Point(java.awt.Point)

Example 34 with Dialog

use of java.awt.Dialog in project adempiere by adempiere.

the class CField method displayPopup.

//  setUI
/**
	 *  Display Popup.
	 *  Called from AdempiereComboPopup and allows to implement
	 *  alternative actions than showing the popup
	 *  @return if true, the popup should be displayed
	 */
public boolean displayPopup() {
    if (m_popupClass == null)
        return false;
    //
    try {
        //  Get Owner & Create Popup Instance
        Window win = SwingUtilities.getWindowAncestor(this);
        CFieldPopup popup = null;
        if (win instanceof Dialog) {
            Constructor<?> constructor = m_popupClass.getConstructor(new Class<?>[] { Dialog.class, String.class, Boolean.class });
            popup = (CFieldPopup) constructor.newInstance(new Object[] { (Dialog) win, m_title, new Boolean(true) });
        } else if (win instanceof Frame) {
            Constructor<?> constructor = m_popupClass.getConstructor(new Class[] { Frame.class, String.class, Boolean.class });
            popup = (CFieldPopup) constructor.newInstance(new Object[] { (Frame) win, m_title, new Boolean(true) });
        }
        if (popup == null)
            return false;
        //  Start Popup
        popup.setValue(m_editor.getItem());
        popup.setFormat(m_editor.getFormat());
        popup.show();
        m_editor.setItem(popup.getValue());
        popup = null;
    } catch (Exception e) {
        notifyUser(e);
    }
    //
    return false;
}
Also used : Window(java.awt.Window) Frame(java.awt.Frame) Dialog(java.awt.Dialog) Constructor(java.lang.reflect.Constructor)

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