use of javax.swing.JDialog in project jdk8u_jdk by JetBrains.
the class TexturePaintPrintingTest method doTest.
private static void doTest(Runnable action) {
String description = " A TexturePaint graphics will be shown on console.\n" + " The same graphics is sent to printer.\n" + " Please verify if TexturePaint shading is printed.\n" + " If none is printed, press FAIL else press PASS";
final JDialog dialog = new JDialog();
dialog.setTitle("printSelectionTest");
JTextArea textArea = new JTextArea(description);
textArea.setEditable(false);
final JButton testButton = new JButton("Start Test");
final JButton passButton = new JButton("PASS");
passButton.setEnabled(false);
passButton.addActionListener((e) -> {
f.dispose();
dialog.dispose();
pass();
});
final JButton failButton = new JButton("FAIL");
failButton.setEnabled(false);
failButton.addActionListener((e) -> {
f.dispose();
dialog.dispose();
fail();
});
testButton.addActionListener((e) -> {
testButton.setEnabled(false);
action.run();
passButton.setEnabled(true);
failButton.setEnabled(true);
});
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(textArea, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(testButton);
buttonPanel.add(passButton);
buttonPanel.add(failButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
dialog.add(mainPanel);
dialog.pack();
dialog.setVisible(true);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.out.println("main dialog closing");
testGeneratedInterrupt = false;
mainThread.interrupt();
}
});
}
use of javax.swing.JDialog in project jdk8u_jdk by JetBrains.
the class Listener method testHidenChildDispose.
/**
* Test if a dialog that has never been shown fire
* the WINDOW_CLOSED event on parent dispose().
* @throws Exception
*/
public static void testHidenChildDispose() throws Exception {
JFrame f = new JFrame();
JDialog dlg = new JDialog(f);
Listener l = new Listener();
dlg.addWindowListener(l);
f.dispose();
waitEvents();
assertEquals(0, l.getCount());
}
use of javax.swing.JDialog in project jdk8u_jdk by JetBrains.
the class Listener method testVisibleChildParentDispose.
/**
* Test if a dialog fire the WINDOW_CLOSED event
* on parent dispose().
* @throws Exception
*/
public static void testVisibleChildParentDispose() throws Exception {
JFrame f = new JFrame();
JDialog dlg = new JDialog(f);
Listener l = new Listener();
dlg.addWindowListener(l);
dlg.setVisible(true);
f.dispose();
waitEvents();
assertEquals(1, l.getCount());
}
use of javax.swing.JDialog in project jdk8u_jdk by JetBrains.
the class WrongBackgroundColor method main.
public static void main(final String[] args) throws InvocationTargetException, InterruptedException {
SwingUtilities.invokeAndWait(() -> {
UIDefaults ui = UIManager.getDefaults();
ui.put("control", new ColorUIResource(54, 54, 54));
final JDialog dialog = new JDialog();
final JFrame frame = new JFrame();
frame.pack();
dialog.pack();
final Color dialogBackground = dialog.getBackground();
final Color frameBackground = frame.getBackground();
frame.dispose();
dialog.dispose();
if (!dialogBackground.equals(frameBackground)) {
System.err.println("Expected:" + frameBackground);
System.err.println("Actual:" + dialogBackground);
throw new RuntimeException("Wrong background color");
}
});
}
use of javax.swing.JDialog in project android_frameworks_base by AOSPA.
the class UI method showWaitDialog.
public void showWaitDialog() {
if (currentWaitDialog == null) {
currentWaitDialog = new JDialog(this, "Please wait...", true);
currentWaitDialog.getContentPane().add(new JLabel("Please be patient."), BorderLayout.CENTER);
JProgressBar progress = new JProgressBar(JProgressBar.HORIZONTAL);
progress.setIndeterminate(true);
currentWaitDialog.getContentPane().add(progress, BorderLayout.SOUTH);
currentWaitDialog.setSize(200, 100);
currentWaitDialog.setLocationRelativeTo(null);
showWaitDialogLater();
}
}
Aggregations