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();
}
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();
}
}
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);
}
}
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;
}
Aggregations