//import java.util.Scanner;
//
//abstract class Converter {
//
// abstract protected double convert(double src);
//
// abstract protected String getSrcString();
//
// abstract protected String getDestString();
//
// protected double ratio;
//
// public void run() {
//
// Scanner scanner = new Scanner(System.in);
//
// System.out.println(getSrcString() + "을" + getDestString() + "로 바꿉니다.");
//
// System.out.print(getSrcString() + "을 입력하세요>>");
//
// double val = scanner.nextDouble();
//
// double res = convert(val);
//
// System.out.println("변환결과: " + res + getDestString() + "입니다");
//
// scanner.close();
//
// }
//
//}
//
//class Km2Mile extends Converter
//
//{
//
// public Km2Mile(double res)
//
// {
//
// this.ratio = res;
//
// }
//
// protected double convert(double src) {
//
// return src / ratio;
//
// }
//
// protected String getSrcString() {
//
// return "Km";
//
// }
//
// protected String getDestString() {
//
//// TODO Auto-generated method stub
//
// return "mile";
//
// }
//
//}
//
//class Main {
//
// public static void main(String[] args) {
//
// Km2Mile toMile = new Km2Mile(1.6);
//
// toMile.run();
//
// }
//
//}
/*
class Point{
private int x,y;
public Point(int x,int y) {this.x=x;this.y=y;}
public int getX() {return x;}
public int getY() {return y;}
protected void move(int x,int y) {this.x=x; this.y=y;}
}
class ColorPoint extends Point
{
String color;
public ColorPoint()
{
this(0,0);
}
public ColorPoint(int x,int y)
{
super(x,y);
color="black";
}
public void setColor(String color)
{
this.color=color;
}
public void setXY(int x,int y)
{
move(x,y);
}
public String toString()
{
return color+"색의 ("+getX()+","+getY()+")의 점 ";
}
}
class Main
{
public static void main(String[] args) {
ColorPoint zeroPoint=new ColorPoint();
System.out.println(zeroPoint.toString()+"입니다.");
ColorPoint cp =new ColorPoint(10,10);
cp.setXY(5,5);
cp.setColor("RED");
System.out.println(cp.toString()+"입니다.");
}
}
*/
/*
GUI : Graphical User Interface (그림으로 사용자와 소통)
컨테이너 : 종이 (프레임frame,패널panel 등등 )
컴포넌트 : 스티커 (버튼, 레이블, 텍스트필드 등등)
swing vs awt
*/
/* gui 기본 틀!!!!
import java.awt.*;
import javax.swing.*;
class Main extends JFrame{
public Main() {
//컨테이너.. 컴포넌트.. 이런거 설정
setSize(500, 300); // 필수) 프레임 크기 설정 (가로길이,세로길이)
setVisible(true); // 필수) 프레임을 보여주겠습니다!
}
public static void main(String[] args) {
Main m = new Main(); // 메인 객체 생성
}
}
*/
/*
import java.awt.*;
import javax.swing.*;
class Main extends JFrame{
public Main() {
setTitle("지성이의 첫 GUI"); //프레임 제목 설정
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //창닫으면 프로그램종료
Container c = getContentPane(); // 프레임의 이름을 c로 하겠다!
c.setBackground(Color.orange); // 프레임c의 배경색 설정
c.setLayout(new FlowLayout()); // 프레임c의 배치관리자 설정
JLabel la = new JLabel("지성아안녕!"); // 레이블? 라벨? 생성
la.setForeground(Color.BLUE); // 라벨의 글자색 파란색으로 설정
c.add(la); // 프레임에 라벨 추가
JButton b1 = new JButton("press!"); // 버튼 생성
b1.setBackground(Color.RED); // 배경색 설정
b1.setForeground(Color.white);// 글자색 설정
c.add(b1);
JTextField tf = new JTextField("아이디를 입력하세요!"); //텍스트필드 생성
c.add(tf);
c.add(new JButton("exit")); // 이름이 없는 버튼을 생성하면서 프레임에 바로 추가
// (나중에 얘를 변경하려면 쪼금 힘들어짐..)
setSize(1000, 200); // 필수) 프레임 크기 설정 (가로길이,세로길이)
setVisible(true); // 필수) 프레임을 보여주겠습니다!
}
public static void main(String[] args) {
Main m = new Main(); // 메인 객체 생성
}
}
*/
import java.awt.*;
import javax.swing.*;
class Main extends JFrame
{
public Main(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c=getContentPane();
setSize(500,300);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}