/*
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Main extends JFrame{
JTextField priceT= new JTextField(10);
JTextField th50T= new JTextField(13);
JTextField th10T= new JTextField(13);
JTextField th1T= new JTextField(13);
JTextField h5T= new JTextField(13);
JTextField h1T= new JTextField(13);
JTextField t5T= new JTextField(13);
JTextField t1T= new JTextField(14);
JTextField o1T= new JTextField(13);
JButton cal= new JButton("계산");
JCheckBox [] check= new JCheckBox[7];
int [] t= new int[check.length];
public Main(){
setTitle("Money Changer");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c= getContentPane();
for(int i=0; i<check.length ;i++) {
check[i] = new JCheckBox();
check[i].addItemListener(new myItemListener());
}
c.setLayout(new FlowLayout());
c.setBackground(Color.MAGENTA);
JLabel price= new JLabel("금액");
JLabel th50= new JLabel("오만원");
JLabel th10= new JLabel("만원");
JLabel th1= new JLabel("천원");
JLabel h5= new JLabel("500원");
JLabel h1= new JLabel("100원");
JLabel t5= new JLabel("50원");
JLabel t1= new JLabel("10원");
JLabel o1= new JLabel("1원");
c.add(price); c.add(priceT); c.add(cal);
c.add(th50); c.add(th50T); c.add(check[0]);
c.add(th10); c.add(th10T); c.add(check[1]);
c.add(th1); c.add(th1T); c.add(check[2]);
c.add(h5); c.add(h5T); c.add(check[3]);
c.add(h1); c.add(h1T); c.add(check[4]);
c.add(t5); c.add(t5T); c.add(check[5]);
c.add(t1); c.add(t1T); c.add(check[6]);
c.add(o1); c.add(o1T);
cal.addActionListener(new myActionListener());
setSize(250,300);
setVisible(true);
}
class myItemListener implements ItemListener{
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange()==ItemEvent.SELECTED) {
if(check[0]==e.getItem()) {
t[0]= 50000;
}
if(check[1]==e.getItem()) {
t[1]= 10000;
}
if (check[2]==e.getItem()) {
t[2]= 1000;
}
if(check[3]==e.getItem()) {
t[3]= 500;
}
if(check[4]==e.getItem()) {
t[4]= 100;
}
if(check[5]==e.getItem()) {
t[5]= 50;
}
if(check[6]==e.getItem()) {
t[6]= 10;
}
}
else {
if(check[0]==e.getItem()) {
t[0]= 0;
}
if(check[1]==e.getItem()) {
t[1]= 0;
}
if (check[2]==e.getItem()) {
t[2]= 0;
}
if(check[3]==e.getItem()) {
t[3]= 0;
}
if(check[4]==e.getItem()) {
t[4]= 0;
}
if(check[5]==e.getItem()) {
t[5]= 0;
}
if(check[6]==e.getItem()) {
t[6]= 0;
}
}
}
}
class myActionListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
int money = Integer.valueOf(priceT.getText());
int sum=0;
for(int i=0;i<check.length;i++) {
if(t[i]!=0) {
sum=money/t[i];
money=money-sum*t[i];
if(i==0) {
th50T.setText(Integer.toString(sum));
}
if(i==1) {
th10T.setText(Integer.toString(sum));
}
if(i==2) {
th1T.setText(Integer.toString(sum));
}
if(i==3) {
h5T.setText(Integer.toString(sum));
}
if(i==4) {
h1T.setText(Integer.toString(sum));
}
if(i==5) {
t5T.setText(Integer.toString(sum));
}
if(i==6) {
t1T.setText(Integer.toString(sum));
}
}
else {
sum=0;
if(i==0) {
th50T.setText(Integer.toString(sum));
}
if(i==1) {
th10T.setText(Integer.toString(sum));
}
if(i==2) {
th1T.setText(Integer.toString(sum));
}
if(i==3) {
h5T.setText(Integer.toString(sum));
}
if(i==4) {
h1T.setText(Integer.toString(sum));
}
if(i==5) {
t5T.setText(Integer.toString(sum));
}
if(i==6) {
t1T.setText(Integer.toString(sum));
}
}
}
o1T.setText(Integer.toString(money));
}
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
public class Main extends JFrame{
JLabel colorLabel;
JSlider [] sl= new JSlider[3];
JLabel [] la = new JLabel[3];
public Main() {
setTitle("슬라이더와 ChangeEvent 예제");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c=getContentPane();
c.setLayout(new FlowLayout());
colorLabel = new JLabel(" SLIDER EXAMPLE ");
for(int i=0;i<sl.length;i++) {
sl[i]=new JSlider(JSlider.HORIZONTAL,0,255,128);
la[i] = new JLabel("128");
sl[i].setPaintLabels(true);
sl[i].setPaintTicks(true);
sl[i].setPaintTrack(true);
sl[i].setMajorTickSpacing(50);
sl[i].setMinorTickSpacing(10);
sl[i].addChangeListener(new MyChangeListener());
c.add(sl[i]);
c.add(la[i]);
}
sl[0].setForeground(Color.RED);
sl[1].setForeground(Color.GREEN);
sl[2].setForeground(Color.BLUE);
int r = sl[0].getValue();
int g = sl[1].getValue();
int b = sl[2].getValue();
colorLabel.setOpaque(true);
colorLabel.setBackground(new Color(r,g,b));
setSize(300,230);
setVisible(true);
}
class MyChangeListener implements ChangeListener{
public void stateChanged(ChangeEvent e) {
int r = sl[0].getValue();
int g = sl[1].getValue();
int b = sl[2].getValue();
colorLabel.setBackground(new Color(r,g,b));
int s1=sl[0].getValue(),s2=sl[1].getValue(),s3=sl[2].getValue();
la[0].setText(Integer.toString(s1));
la[1].setText(Integer.toString(s2));
la[2].setText(Integer.toString(s3));
}
}
public static void main(String[] args) {
new Main();
}
}
*/



