4.消息弹出窗口
[img]http://dl.iteye.com/upload/attachment/402670/dc9e98a1-9dfa-321f-ad45-1737f686991d.png[/img]
5.确认弹出窗口
[img]http://dl.iteye.com/upload/attachment/402672/13a4065b-ebd8-3563-bf1b-2ca02e21494b.png[/img]
6.输入弹出窗口
[img]http://dl.iteye.com/upload/attachment/402674/7b8c8b48-e69b-3493-8894-065c0b367a02.png[/img]
更多敬请访问:
http://www.java2s.com/CN/Tutorial/Java/0240__Swing/0960__JOptionPane-Dialog.htm
[img]http://dl.iteye.com/upload/attachment/402670/dc9e98a1-9dfa-321f-ad45-1737f686991d.png[/img]
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class MessagePopUps {
public static void main(String[] a) {
JFrame parent = new JFrame();
JOptionPane.showMessageDialog(parent, "Printing complete");
// JOptionPane.showInternalMessageDialog(parent, "Printing complete");
}
}
5.确认弹出窗口
[img]http://dl.iteye.com/upload/attachment/402672/13a4065b-ebd8-3563-bf1b-2ca02e21494b.png[/img]
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class ConfirmPopUps {
public static void main(String[] a) {
JFrame frame = new JFrame();
int result = JOptionPane.showConfirmDialog(frame, "Continue printing?");
// JOptionPane.showInternalConfirmDialog(desktop, "Continue printing?");
System.out.println(JOptionPane.CANCEL_OPTION == result);
}
}
6.输入弹出窗口
[img]http://dl.iteye.com/upload/attachment/402674/7b8c8b48-e69b-3493-8894-065c0b367a02.png[/img]
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class InputPopUps {
public static void main(String[] a) {
JFrame frame = new JFrame();
Object result = JOptionPane.showInputDialog(frame, "Enter printer name:");
System.out.println(result);
}
}
更多敬请访问:
http://www.java2s.com/CN/Tutorial/Java/0240__Swing/0960__JOptionPane-Dialog.htm