Java JOptionPane
JOptionPane 使用整理
Import 起手式
1 | import javax.swing.JOptionPane; |
Kind
- showConfirmDialog(): Asks a confirming question, like yes/no/cancel.
1
showConfirmDialog();
- showInputDialog(): Prompt for some input.
1
showInputDialog();
- showMessageDialog(): Tell the user about something that has happened.
1 | showMessageDialog(); |
- showOptionDialog(): The Grand Unification of the above three.
1
2
3JOptionPane.showOptionDialog(parentComponent, Object Message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue);
//JOptionPane.showOptionDialog(父元素元件, 顯示的訊息, 顯示的訊息標題, 顯示選項類型, 顯示的訊息類型, 圖示, 按鈕的選項, 預設按鈕);