import java.awt.*;
import javax.swing.*;
import java.util.*;
class Main extends JFrame{
Main(){
setTitle("진우의 뀨번째 GUI입니다");
setSize(500,300);
setVisible(true);
Container c = getContentPane(); //현재의 프레임을 c라고 부를게 !
//Layout 설정
//1. flowlayout FlowLayout layout = new FlowLayout();
//2. girdlayout 격자 GridLayout layout = new GridLayout(행개수,열개수);
//3. BorderLayout BorderLayout layout = new BorderLayout();
c.setLayout(new FlowLayout());
//컴포넌트 생성
JButton b1 = new JButton("button1");
// JButton b2 = new JButton("button2");
// JButton b3 = new JButton("button3");
b1.setBackground(Color.YELLOW); //배경색설정
b1.setForeground(Color.RED); //글자색설정
//컨테이너에 컴포넌트 붙이기
c.add(b1);
// c.add(b2);
// c.add(b3);
// JButton b4 = new JButton("button4");
//c.add(b4,BorderLayout.WEST); //BorderLayout일때는 NORTH, CENTER, SOUTH, WEST, EAST 중 위치를 정해줘야한다!!꼮!!
JLabel la = new JLabel("ID : ");
c.add(la);
JTextField tf = new JTextField("여기에 아이디를 입력하세요");
c.add(tf);
}
public static void main(String[] args) {
new Main();
}
}
import java.awt.*;
import javax.swing.*;
import java.util.*;
class Main extends JFrame{
Main(){
setSize(500,300);
setVisible(true);
Container c = getContentPane();
JButton b1 = new JButton("ok");
JButton b2 = new JButton("cancel");
JButton b3 = new JButton("Ignore");
c.add(b1);
c.add(b2);
c.add(b3);
FlowLayout layout = new FlowLayout( );
b1.setForeground(Color.BLUE);
b2.setForeground(Color.BLUE);
b3.setForeground(Color.BLUE);
b1.setBackground(Color.magenta);
b2.setBackground(Color.magenta);
b3.setBackground(Color.magenta);
c.setBackground(Color.CYAN);
c.setLayout(layout);
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import java.awt.*;
import javax.swing.*;
import java.util.*;
class Main extends JFrame{
Main(){
setVisible(true);
setSize(700,700);
FlowLayout l = new FlowLayout();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
c.add( new JButton("add"));
c.add( new JButton("sub"));
c.add( new JButton("mul"));
c.add( new JButton("div"));
c.add( new JButton("Calculate"));
}
public static void main(String[] args) {
new Main();
}
}
*/
import java.awt.*;
import javax.swing.*;
import java.util.*;
class Main extends JFrame{
Main(){
setSize(700,700);
setVisible(true);
Container c = getContentPane();
//c.setLayout(new FlowLayout());
c.setLayout(new GridLayout(1,10));
c.setBackground(Color.BLUE);
for(int i=0;i<10;i++) {
//int -> String Integer.toString(i) 정수를 문자열로 바꾸기!!꼭 기억하기~~~~!!!!!
JButton b = new JButton(Integer.toString(i));
c.add(b);
}
}
public static void main(String[] args) {
new Main();
}
}