U E D R , A S I H C RSS

Convert App Into Applet/영동

~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,
				아이콘);
		}
	}
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0071 sec