/*
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Main extends JFrame{
public JLabel la = new JLabel("Love Java");
int size;
Font f;
public Main() {
f = la.getFont();
size = f.getSize();
la.setFont(new Font("Arial", Font.PLAIN, 10));
setTitle("+,-키로 폰트 크기 조절");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.add(la);
c.setLayout(new FlowLayout());
c.addKeyListener(new MyKeyListener());
setSize(350,150);
setVisible(true);
c.setFocusable(true);
c.requestFocus();
}
public static void main(String[] args) {
new Main();
}
class MyKeyListener implements KeyListener{
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
Container contentPane = (Container)e.getSource();
if(e.getKeyChar() == '+') {
la.setFont(new Font("Arial", Font.PLAIN, size+5));
}
else if (e.getKeyChar()=='-') {
la.setFont(new Font("Arial", Font.PLAIN, size-5));
}
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
}
}
*/
/*
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Main extends JFrame {
JLabel la = new JLabel("C");
public Main() {
setTitle("클릭 연습 용 응용프로그램");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(null);
la.addMouseListener(new MyMouseListener());
la.setLocation(100,100);
la.setSize(50,50 );
c.add(la);
setSize(500,500);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
class MyMouseListener implements MouseListener{
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
int x = (int)(Math.random()*500);
int y = (int)(Math.random()*500);
la.setLocation(x,y);
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
}
}
*/
/*
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Main extends JFrame{
JLabel la = new JLabel("Love Java");
int size;
Font f;
public Main() {
setTitle("마우스 휠을 굴려 폰트 크기 조절");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f = la.getFont();
size = f.getSize();
Container c = getContentPane();
c.setLayout(new FlowLayout());
c.add(la);
c.addMouseWheelListener(new MyMouseWheelListener());
setSize(500,500);
setVisible(true);
c.setFocusable(true);
c.requestFocus();
}
public static void main(String[] args) {
new Main();
}
class MyMouseWheelListener implements MouseWheelListener{
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
// TODO Auto-generated method stub
int n = e.getWheelRotation();
if(n<0) {
size += 5;
la.setFont(new Font("Arial", Font.PLAIN, size));
}
else {
size -= 5;
if(size>=5) {
la.setFont(new Font("Arial", Font.PLAIN, size));
}
else {
size = 5;
la.setFont(new Font("Arial", Font.PLAIN, size));
}
}
}
}
}
*/
/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame{
public Main() {
super("JComponent의 공통메소드 예제");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout()); setSize(500,500);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
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("images/beauty.jpg");
JLabel imageLabel = new JLabel(beauty);
ImageIcon normalIcon = new ImageIcon("images/normalIcon.gif");
JLabel label = new JLabel("보고싶으면 전화하세요",
normalIcon, 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 java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame{
public Main() {
ImageIcon cherryIcon = new ImageIcon("주소");
ImageIcon selectedCherryIcon = (~)
JCheckBox apple = new JCheckBox("사과",true);// 처음부터 선택 상태 시작
JCheckBox pear = new JCheckBox("배");//해제 상태 시작
JCheckBox cherry = new JCheckBox("체리", cherryIcon); // 해제 상태 + 이미지만 가진 체크 박스 생성
}
public static void main(String[] args) {
}
}
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame{
private JCheckBox []
public Main() {
}
public static void main(String[] args) {
new Main();
}
}