/*
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
public class Main extends JFrame {
private JLabel colorLabel;
private JSlider [] sl = new JSlider [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);
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]);
}
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));
c.add(colorLabel);
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));
}
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Main extends JFrame {
JPanel ManuPnl;
JLabel ManuLbl;
JButton[] dire = new JButton[2];
ImageIcon nowImg = new ImageIcon();
ImageIcon [] images = {new ImageIcon("C:\\Users\\user\\Desktop\\java images\\letter-d.png"),
new ImageIcon("C:\\Users\\user\\Desktop\\java images\\letter-o.png"),
new ImageIcon("C:\\Users\\user\\Desktop\\java images\\letter-g.png"),
new ImageIcon("C:\\Users\\user\\Desktop\\java images\\dog (1).png")};
int num = 0;
public Main() {
setTitle("Open Chanllenge 11");
setSize(400,500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container cnt = getContentPane();
cnt.setLayout(new BorderLayout());
ManuPnl = new JPanel();
ManuPnl.setBackground(Color.gray);
ManuPnl.setLayout(new FlowLayout(FlowLayout.CENTER, 15,10));
cnt.add(ManuPnl,BorderLayout.SOUTH);
nowImg = images[0];
ManuLbl = new JLabel(nowImg);
cnt.add(ManuLbl,BorderLayout.CENTER);
for(int i = 0; i < dire.length; i++) {
dire[i] = new JButton();
int n = i;
dire[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(n == 0) {
if(num == 0) {
num = 3;
}
else {
num --;
}
}
else {
if(num == 3) {
num = 0;
}
else {
num ++;
}
}
ManuLbl.setIcon(images[num]);
}
});
}
dire[0].setIcon(new ImageIcon("C:\\Users\\user\\Desktop\\java images\\left-arrow.png"));
ManuPnl.add(dire[0]);
dire[1].setIcon(new ImageIcon("C:\\Users\\user\\Desktop\\java images\\right-arrow.png"));
ManuPnl.add(dire[1]);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Main extends JFrame {
JButton[] buttons = {new JButton("저장"),
new JButton("찾기"),
new JButton("삭제"),
new JButton("단어")};
Color[][] colors = {{Color.yellow, Color.black},
{Color.green, Color.black},
{Color.magenta, Color.white},
{Color.cyan, Color.white}};
JPanel [] Pnls = new JPanel[3];
JTextField eng = new JTextField(13), kor = new JTextField(13);
JTextArea log = new JTextArea(11,30), words = new JTextArea(7,20);
public Main() {
setTitle("단어 사전 만들기");
setSize(450,350);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container cnt = getContentPane();
cnt.setLayout(new FlowLayout());
Pnls[0] = new JPanel();
Pnls[0].setSize(450,20);
Pnls[0].setBackground(Color.gray);
Pnls[0].add(new JLabel("영어"));
Pnls[0].add(eng);
Pnls[0].add(new JLabel("한글"));
Pnls[0].add(kor);
cnt.add(Pnls[0]);
Pnls[1] = new JPanel();
for(int i = 0; i < buttons.length; i++) {
buttons[i].setBackground(colors[i][0]);
buttons[i].setForeground(colors[i][1]);
buttons[i].setSize(75,50);
Pnls[1].add(buttons[i]);
}
cnt.add(Pnls[1]);
Pnls[2] = new JPanel();
Pnls[2].add(log);
cnt.add(Pnls[2]);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import javax.swing.*;
public class Main extends JFrame {
public Main() {
setTitle("Menu 만들기 예제");
createMenu();
setSize(250,200);
setVisible(true);
}
private void createMenu() {
JMenuBar mb = new JMenuBar();
JMenu screenMenu = new JMenu("screen");
screenMenu.add(new JMenuItem("Load"));
screenMenu.add(new JMenuItem("Hide"));
screenMenu.add(new JMenuItem("ReShow"));
screenMenu.addSeparator();
screenMenu.add(new JMenuItem("Exit"));
mb.add(screenMenu);
mb.add(new JMenu("Edit"));
mb.add(new JMenu("Source"));
mb.add(new JMenu("Project"));
mb.add(new JMenu("Run"));
setJMenuBar(mb);
}
public static void main(String[] args) {
new Main();
}
}
*/



