U E D R , A S I H C RSS

Button/영동

... .
--

~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);
	}
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:40
Processing time 0.0086 sec