//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("레이블 예제");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Container c = getContentPane();
// c.setLayout(new FlowLayout());
//
//
//
// JLabel textLabel = new JLabel("사랑합니다.");
//
// ImageIcon beauty = new ImageIcon("love.png");
// JLabel imageLabel = new JLabel(beauty);
//
// ImageIcon x = new ImageIcon("phone-call.png");
// JLabel label = new JLabel("보고싶으면 전화하세요.",x, SwingConstants.CENTER);
//
// c.add(textLabel);
// c.add(imageLabel);
// c.add(label);
//
// setSize(400,600);
// setVisible(true);
// }
//
// public static void main(String[] args) {
// new Main();
// }
//}
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("이미지 버튼 예제");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Container c = getContentPane();
// c.setLayout(new FlowLayout());
//
// ImageIcon normalIcon = new ImageIcon("phone-call (1).png");
// ImageIcon rolloverIcon = new ImageIcon("phone-call (2).png");
// ImageIcon pressedIcon = new ImageIcon("phone-call (3).png");
//
// JButton btn = new JButton("call~~", normalIcon);
// btn.setPressedIcon(pressedIcon);
// btn.setRolloverIcon(rolloverIcon);
// c.add(btn);
//
// setSize(250,150);
// setVisible(true);
// }
// public static void main(String[] args) {
// new Main();
// }
//}
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("체크박스 만들기 예제");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Container c = getContentPane();
// c.setLayout(new FlowLayout());
//
// ImageIcon cherryIcon = new ImageIcon("cherry (1).png");
//
// ImageIcon selectedCherryIcon = new ImageIcon("\"cherry (1).png\"");
//
// JCheckBox apple = new JCheckBox("사괴");
// JCheckBox pear = new JCheckBox("배", true);
// JCheckBox cherry = new JCheckBox("체리", cherryIcon);
//
// cherry.setBorderPainted(true);
// cherry.setSelectedIcon(selectedCherryIcon);
//
// c.add(apple);
// c.add(pear);
// c.add(cherry);
//
// setSize(250,150);
// setVisible(true);
// }
// public static void main(String[] args) {
// new Main();
// }
//}
//import javax.swing.*;
//import java.awt.event.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// private JCheckBox[] fruits = new JCheckBox [3];
// private String[] names = {"사과", "배", "체리"};
//
// private JLabel sumLabel;
//
// public Main() {
// setTitle("체크박스와 ItemEvent 예제");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Container c = getContentPane();
// c.setLayout(new FlowLayout());
//
// c.add(new JLabel("사과 100원, 배 500원, 체리 20000원"));
//
// MyItemListener listener = new MyItemListener();
// for(int i=0; i<fruits.length; i++) {
// fruits[i] = new JCheckBox(names[i]);
// fruits[i].setBorderPainted(true);
// c.add(fruits[i]);
// fruits[i].addItemListener(listener);
// }
//
// sumLabel = new JLabel("현제 0원 입니다.");
// c.add(sumLabel);
//
// setSize(250,250);
// setVisible(true);
// }
//
// class MyItemListener implements ItemListener {
// private int sum = 0;
//
// public void itemStateChanged(ItemEvent e) {
// if(e.getStateChange() == ItemEvent.SELECTED) {
// if(e.getItem() == fruits[0])
// sum += 100;
// else if(e.getItem() == fruits[1])
// sum +=500;
// else
// sum += 20000;
// }
// else {
// if(e.getItem() == fruits[0])
// sum -= 100;
// else if(e.getItem() == fruits[1])
// sum -= 500;
// else
// sum -= 20000;
// }
// sumLabel.setText("현재 "+ sum + "원 입니다.");
// }
// }
// public static void main(String[] args) {
// new Main();
// }
//}
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("라디오버튼 만들기 예제");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Container c = getContentPane();
// c.setLayout(new FlowLayout());
//
// ImageIcon cherryIcon = new ImageIcon("cherry (1).png");
// ImageIcon selectedCherryIcon = new ImageIcon("cherry.png");
//
// ButtonGroup g = new ButtonGroup();
//
// JRadioButton apple = new JRadioButton("사과");
// JRadioButton pear = new JRadioButton("배", true);
// JRadioButton cherry = new JRadioButton("체리", cherryIcon);
//
// cherry.setBorderPainted(true);
// cherry.setSelectedIcon(selectedCherryIcon);
//
// g.add(apple);
// g.add(pear);
// g.add(cherry);
//
// c.add(apple);
// c.add(pear);
// c.add(cherry);
//
// setSize(250,150);
// setVisible(true);
// }
// public static void main(String[] args) {
// new Main();
// }
//}
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Main extends JFrame {
private JRadioButton[] radio = new JRadioButton [3];
private String[] text = {"사과", "배", "체리"};
private ImageIcon[] image = {
new ImageIcon(""),
new ImageIcon(""),
new ImageIcon("")};
private JLabel imageLabel = new JLabel();
public Main() {
setTitle("라디오버튼 Item Event 예제");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new BorderLayout());
JPanel radioPanel = new JPanel();
}
}



