import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/*public class Main extends JFrame{
public Main() {
setTitle("8번문제 533p");
setSize(700,600);
setVisible(true);
Container c = getContentPane();
c.setLayout(new BorderLayout());
JPanel up = new JPanel();
JPanel gv = new JPanel();
JPanel dn = new JPanel();
c.add(up,BorderLayout.NORTH);
c.add(gv,BorderLayout.CENTER);
c.add(dn,BorderLayout.SOUTH);
up.setBackground(Color.LIGHT_GRAY);
up.add(new JButton("오푼"));
up.add(new JButton("클루즈"));
up.add(new JButton("아우트"));
gv.setBackground(Color.GRAY);
gv.setLayout(null);
for(int i = 0;i < 10;i++) {
JLabel l = new JLabel("*");
int x = (int)(Math.random()*200) + 30;
int y = (int)(Math.random()*240) + 20;
l.setLocation(x, y);
l.setSize(15, 15);
l.setForeground(Color.GREEN);
gv.add(l);
}
dn.setLayout(new FlowLayout());
//dn.setBackground(Color.WHITE);
dn.add(new JButton("워든 인푿"));
JTextField j = new JTextField(50);
dn.add(j);
}
public static void main(String[] args) {
new Main();
}
}*/
public class Main extends JFrame {
public Main() {
setTitle("10단원-실습 01 이베트 리씨너");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
JButton btn = new JButton("Atsion");
btn.addActionListener(new MyActionListener());
c.add(btn);
setSize(350,150);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
class MyActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
JButton b = (JButton)e.getSource();
if(b.getText().equals("Atsion"))
b.setText("앧션");
else
b.setText("Atsion");
}
}



