~cpp
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class AppletTest extends JApplet implements ActionListener {
JButton 버튼1, 버튼2 ;
Icon 아�콘;
Font font;
public void init() {
버튼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,
아�콘);
}
}
}