Lớp JOptionPane trong Java Swing

STT
Phương thức & Miêu tả

1
void selectInitialValue()

Yêu cầu giá trị khởi tạo ban đầu để được lựa chọn, mà sẽ thiết lập focus tới giá trị đó

2
void setIcon(Icon newIcon)

Thiết lập icon để hiển thị

3
void setInitialSelectionValue(Object newValue)

Thiết lập giá trị input mà được hiển thị ban đầu như là selected tới người dùng

4
void setInitialValue(Object newInitialValue)

Thiết lập giá trị ban đầu để được kích hoạt. Đây là thành phần mà có focus khi pane được hiển thị ban đầu

5
void setInputValue(Object newValue)

Thiết lập giá trị input mà là selected hoặc input bởi người dùng

6
void setMessage(Object newMessage)

Thiết lập đối tượng message của option pane

7
void setMessageType(int newType)

Thiết lập kiểu thông điệp của option pane

8
void setOptions(Object[] newOptions)

Thiết lập các tùy chọn mà pane này hiển thị

9
void setOptionType(int newType)

Thiết lập các tùy chọn để hiển thị

10
static voidsetRootFrame(Frame newRootFrame)

Thiết lập frame để sử dụng cho các phương thức lớp mà chưa được cung cấp frame nào

11
void setSelectionValues(Object[] newValues)

Thiết lập các giá trị selection cho một pane mà cung cấp cho người dùng một danh sách item để lựa chọn từ đó

12
void setUI(OptionPaneUI ui)

Thiết lập đối tượng UI mà triển khai L&F cho thành phần này

13
void setValue(Object newValue)

Thiết lập giá trị mà người dùng đã lựa chọn

14
void setWantsInput(boolean newValue)

Thiết lập thuộc tính wantsInput

15
static int showConfirmDialog(Component parentComponent, Object message)

Hiển thị một hộp thoại với các tùy chọn Yes, No và Cancel với title là Select an Option

16
static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType)

Hiển thị một hộp thoại, với số tùy chọn được xác định bởi tham số optionType

17
static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)

Hiển thị một hộp thoại, với số tùy chọn được xác định bởi tham số optionType, và tham số messageType xác định icon để hiển thị

18
static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)

Hiển thị một hộp thoại với icon đã cho, với số tùy chọn được xác định bởi tham số optionType

19
static String showInputDialog(Component parentComponent, Object message, Object initialSelectionValue)

Hiển thị một hộp thoại dạng question-message yêu cầu input từ người dùng được tạo ra từ parentComponent

20
static String showInputDialog(Component parentComponent, Object message, String title, int essageType)

Hiển thị một hộp thoại dạng question-message yêu cầu input từ người dùng được tạo ra từ parentComponent với hộp thoại có title và messageType

21
static Object showInternalInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)

Gợi ý người dùng nhập input trong một hộp thoại nội tại, ở đây sự lựa chọn ban đầu, sự lựa chọn có thể có, và tất cả tùy chọn khác có thể được xác định

22
JDialog createDialog(Component parentComponent, String title)

Tạo và trả về một JDialog mới mà bao quanh optionpane này được căn chỉnh vào giữa parentComponent trong frame của parentComponent

23
JDialog createDialog(String title)

Tạo và trả về một JDialog mới (không phải là cha) với title đã cho

24
JInternalFrame createInternalFrame(Component parentComponent, String title)

Tạo và trả về một instance của JInternalFrame