/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame {
JTextField uptf = new JTextField(20);
JTextField dntf = new JTextField(20);
public Main() {
setTitle("");
setSize(500, 500);
setVisible(true);
Container c = getContentPane();
c.setLayout(new BorderLayout());
JPanel up = new JPanel();
JPanel ce = new JPanel();
JPanel dn = new JPanel();
up.setBackground(Color.darkGray); // 배경색 설정
c.add(up, BorderLayout.NORTH); // 컨테이너에 부착
JLabel nla = new JLabel("수식");
nla.setForeground(Color.WHITE);
up.add(nla);
up.add(uptf);
//////////////////////////
ce.setBackground(Color.LIGHT_GRAY);
c.add(ce, BorderLayout.CENTER);
ce.setLayout(new GridLayout(4, 4));
for (int i = 0; i < 10; i++) {
JButton u = new JButton(Integer.toString(i));
ce.add(u);
}
JButton del = new JButton("C/CE(AC)");
del.setForeground(Color.lightGray);
ce.add(del);
JButton eq = new JButton("=");
eq.setForeground(Color.GREEN);
ce.add(eq);
JButton add = new JButton("+");
ce.add(add);
JButton sub = (new JButton("-"));
ce.add(sub);
JButton mul = (new JButton("×"));
ce.add(mul);
JButton div = (new JButton("÷"));
ce.add(div);
////////////////////////
dn.setBackground(Color.darkGray);
c.add(dn, BorderLayout.SOUTH);
JLabel nnla = new JLabel("결과");
nnla.setForeground(Color.WHITE);
dn.add(nnla);
dn.add(dntf);
// ce 패널에 있는 모든 컴포넌트 가져오기
Component btns[] = ce.getComponents();
// 모든 컴포넌트에 액션리스너 붙이기
for (int i = 0; i < btns.length; i++)
((JButton) btns[i]).addActionListener(new Act());
// 추가할것 : =눌렀을때 계산결과 출력하기
/////////////////
}
class Act implements ActionListener {
public void actionPerformed(ActionEvent e) {
JButton b = (JButton) e.getSource();
if (b.getText().equals("=")) {
cal();
} else if (b.getText().equals("C/CE(AC)")) {
uptf.setText("");
} else {
uptf.setText(uptf.getText() + b.getText());
}
}
public void cal() {
String r = uptf.getText();
// r[i] -> r.charAt(i)
for(int i = 0; i)
if (c == '+') {
dntf.setText(Integer.toString(a + b));
}
if (c == '-') {
dntf.setText(Integer.toString(a - b));
}
if (c == '×') {
dntf.setText(Integer.toString(a * b));
}
if (c == '÷') {
dntf.setText(Integer.toString(a / b));
}
}
}
public static void main(String[] args) {
new Main();
}
}
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame {
ImageIcon s = new ImageIcon("img\\rock.png");
ImageIcon v = new ImageIcon("img\\sissor2.png");
ImageIcon g = new ImageIcon("img\\paper.png");
JButton sis = new JButton(s);
JButton rok = new JButton(v);
JButton pap = new JButton(g);
JLabel imgme = new JLabel();
JLabel imgcu = new JLabel();
public Main() {
setSize(1500, 1200);
setVisible(true);
Container c = getContentPane();
setLayout(new BorderLayout());
JPanel choice = new JPanel();
choice.setBackground(Color.DARK_GRAY);
c.add(choice, BorderLayout.NORTH);
JPanel game = new JPanel();
c.add(game, BorderLayout.CENTER);
game.setBackground(Color.GRAY);
sis.addActionListener(new Act());
rok.addActionListener(new Act());
pap.addActionListener(new Act());
choice.add(sis);
choice.add(rok);
choice.add(pap);
JLabel gamme = new JLabel("me");
JLabel gamcu = new JLabel("cu");
JLabel gamew = new JLabel("GAME !!");
gamew.setForeground(Color.GREEN);
game.add(imgme);
game.add(gamme);
game.add(imgcu);
game.add(gamcu);
game.add(gamew);
}
class Act implements ActionListener {
public void actionPerformed(ActionEvent e) {
JButton b = (JButton)e.getSource();
if(b.equals(sis))
imgme.setIcon(s);
else if(b.equals(rok))
imgme.setIcon(v);
else
imgme.setIcon(g);
}
}
public static void main(String[] args) {
new Main();
}
}



