/*
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
class Main extends JFrame{
private ImageIcon [] image = { new ImageIcon("hearts.png"),
new ImageIcon("pear.png"),
new ImageIcon("flower.png"),
new ImageIcon("forest1.png"),
new ImageIcon("forest.png")};
Vector<ImageIcon> v = new Vector<ImageIcon>();
JLabel imageLabel= new JLabel();
int i=0,t=0;
private JRadioButton[] radio = new JRadioButton[2];
private String [] names = {"left","right"};
public Main() {
setTitle("Image Gallery Practice Frame");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c= getContentPane();
c.setLayout(new BorderLayout());
JPanel Check= new JPanel();
JPanel Image = new JPanel();
Image.setLayout(new BorderLayout());
Image.setBackground(Color.GRAY);
Check.setLayout(new FlowLayout());
Check.setBackground(Color.LIGHT_GRAY);
c.add(Check,BorderLayout.NORTH);
c.add(Image,BorderLayout.CENTER);
v.add(image[0]);
v.add(image[1]);
v.add(image[2]);
v.add(image[3]);
v.add(image[4]);
ButtonGroup g= new ButtonGroup();
for(int i=0;i<radio.length;i++) {
radio[i]= new JRadioButton(names[i]);
g.add(radio[i]);
Check.add(radio[i]);
radio[i].addItemListener(new myItemListener());
}
Image.add(imageLabel, BorderLayout.CENTER);
imageLabel.setHorizontalAlignment(SwingConstants.CENTER);
imageLabel.setIcon(v.get(0));
Image.addMouseListener(new myMouseListener());
setSize(400,300);
setVisible(true);
}
class myItemListener implements ItemListener{
public void itemStateChanged(ItemEvent e) {
if(radio[0].isSelected()) {
t=-1;
}
else {
t=1;
}
}
}
class myMouseListener extends MouseAdapter{
public void mouseClicked(MouseEvent e) {
if(i==0&&t==-1) {
i=4;
}
else if(i==4&&t==1) {
i=0;
}
else {
i+=t;
}
imageLabel.setIcon(v.get(i));
}
}
public static void main(String[] args) {
new Main();
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Main extends JFrame{
ImageIcon [] image= {new ImageIcon("scissor.png"),
new ImageIcon("rock.png"),
new ImageIcon("paper.png")};
JButton [] RSP= new JButton[3];
int t= 0;
int i= 0;
JLabel imageLabelM= new JLabel();
JLabel me= new JLabel("Me: ");
JLabel imageLabelC= new JLabel();
JLabel com= new JLabel(" Computer: ");
JLabel resultL= new JLabel();
public Main() {
setTitle("가위 바위 보 게임");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c= getContentPane();
c.setLayout(null);
JPanel gameP= new JPanel();
gameP.setLayout(new FlowLayout());
gameP.setBackground(Color.LIGHT_GRAY);
gameP.setSize(500,100);
gameP.setLocation(0, 0);
c.add(gameP);
JPanel resultP= new JPanel();
resultP.setLayout(new FlowLayout());
resultP.setBackground(Color.YELLOW);
resultP.setSize(500,200);
resultP.setLocation(0, 100);
c.add(resultP);
resultP.add(me);
resultP.add(imageLabelM);
resultP.add(com);
resultP.add(imageLabelC);
resultL.setForeground(Color.RED);
resultP.add(resultL);
for(int i=0;i<3;i++) {//gameP 에 버튼 추가하기
RSP[i]= new JButton(image[i]);
gameP.add(RSP[i]);
RSP[i].addActionListener(new MyActionListener());
}
setSize(500,300);
setVisible(true);
imageLabelM.setVisible(false);
me.setVisible(false);
imageLabelC.setVisible(false);
com.setVisible(false);
resultL.setVisible(false);
}
class MyActionListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
imageLabelM.setVisible(true);
me.setVisible(true);
imageLabelC.setVisible(true);
com.setVisible(true);
resultL.setVisible(true);
t= (int)(Math.random()*3);
if(e.getSource()==RSP[0]) i=0;
else if(e.getSource()==RSP[1]) i=1;
else i=2;
if(i==t) resultL.setText(" Same");
else {
if(i==0&&t==1||i==1&&t==2||i==2&&t==0) resultL.setText(" Computer Win");
else resultL.setText(" You Win");
}
imageLabelM.setIcon(image[i]);
imageLabelC.setIcon(image[t]);
}
}
public static void main(String[] args) {
new Main();
}
}
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Main extends JFrame{
int n []= new int[10];
public Main() {
setTitle("Ten 레이블 클릭");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c= getContentPane();
for(int i=0;i<)
}
public static void main(String[] args) {
new Main();
}
}