ì�Œ... ì°¸ê³ í•œë‹¤ëŠ”ê²Œ ì˜ˆì œë¥¼ ê±°ì�˜ ë² ë�¼ë‹¤ì‹œí”¼ í•´ë²„ë ¸ë„¤ìš”.
ë² ê¼ˆë‹¤ê³ ê¼ ë‚˜ì�œê±´ 아닙니다 다만 ëª¨ë“ ë�¼ì�¸ì�„ 다 ì�´í•´ë§Œ 했다면 ë�©ë‹ˆë‹¤ --ìƒ�ê·œ
~cpp
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JOptionPaneTest extends JFrame implements ActionListener {
JButton 버튼1, 버튼2 ;
Icon 아�콘;
Font font;
public JOptionPaneTest() {
super("JOptionPaneTest");
버튼1 = new JButton("1번");
버튼1.addActionListener(this);
버튼2 = new JButton("2번");
버튼2.addActionListener(this);
아�콘 = new ImageIcon("aaa.jpg");
JPanel panel = new JPanel();
panel.add(버튼1);
panel.add(버튼2);
getContentPane().add(panel);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == 버튼1) {
JOptionPane.showMessageDialog(
this,
"1번",
"1ë²ˆì„ íƒ�",
JOptionPane.YES_NO_OPTION,
아�콘);
} else if (ae.getSource() == 버튼2) {
Object res =
JOptionPane.showInputDialog(
this,
"2번",
"2ë²ˆì„ íƒ�",
JOptionPane.QUESTION_MESSAGE,
아�콘,
new Object[] { "2-1", "2-2", "2-3" },
"2-1");
JOptionPane.showMessageDialog(
this,
"ì„ íƒ�한 것: " + res,
"ì„ íƒ�ê²°ê³¼",
JOptionPane.INFORMATION_MESSAGE,
아�콘);
}
}
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame f = new JOptionPaneTest();
f.setSize(200, 150);
f.setVisible(true);
}
}










