JoptionPane 대화 상자 데모
package Assis;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class OptionPaneDemo extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
//
JButton btnMessage = new JButton(" ");
JButton btnConfirm = new JButton(" ");
JButton btnInput = new JButton(" ");
JButton btnOption = new JButton(" ");
public OptionPaneDemo() {
//
super("JOptionPaneDemo Demo");
//
btnMessage.addActionListener(this);
btnConfirm.addActionListener(this);
btnInput.addActionListener(this);
btnOption.addActionListener(this);
// FlowLayout
getContentPane().setLayout(new FlowLayout());
//
getContentPane().add(btnMessage);
getContentPane().add(btnConfirm);
getContentPane().add(btnInput);
getContentPane().add(btnOption);
//
pack();
setVisible(true);
}
//
public static void main(String[] args) {
OptionPaneDemo frame = new OptionPaneDemo();
// ( )
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
//
public void actionPerformed(ActionEvent e) {
Object objCommand = e.getSource();
if (objCommand == btnMessage)
JOptionPane.showMessageDialog(this, " ");
else if (objCommand == btnConfirm)
JOptionPane.showConfirmDialog(this, " ");
else if (objCommand == btnInput)
JOptionPane.showInputDialog(this, " ");
else {
Object[] options = { " ", " " };
JOptionPane.showOptionDialog(this, " ", " ",
JOptionPane.YES_OPTION, JOptionPane.QUESTION_MESSAGE, null,
options, options[0]);
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
node.js 파충류 프레임워크 node-crawler 첫 체험바이두 파충류라는 단어는 일반적으로 나타나는python 관련 자료이다. py에도 파충류 프레임이 많은데, 예를 들면 scrapy, Portia, Crawley 등이다. 이전에는 개인적으로 C#로 파충류를 만드는 것을...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.