본문 바로가기
  • think normal
새로워지기/서른의 생활코딩

ex7) java.awt.*

by 청춘만화 2012. 3. 4.
/*
import java.awt.*;

class Frame01 extends Frame{
Button b1,b2,b3,b4 ;
public Frame01(String str){
super(str);
setSize(400, 400); //this 가 생략된 상태 (생성자안임으로)
setLocation(100, 100); //this 가 생략된 상태 (생성자안임으로)
setVisible(true);
}
}

public class Layout01 {
public static void main(String[] args) {
new Frame01("Frame01");
}
}
**/




/*
import java.awt.*;

class Frame01 extends Frame{
//Button b1,b2,b3,b4 ;
public Frame01(String str){
super(str);
add(new Button("Button 1"));
add(new Button("Button 2"));
add(new Button("Button 3"));
add(new Button("Button 4"));
setSize(400, 400);
setLocation(100, 100);
setVisible(true);
}
}
**/


/*
//FlowLayout
import java.awt.*;

class Frame01 extends Frame{
public Frame01(String str){
super(str);
setLayout(new FlowLayout());
add(new Button("Button 1"));
add(new Button("Button 2"));
add(new Button("Button 3"));
add(new Button("Button 4"));
setSize(400, 400);
setLocation(100, 100);
setVisible(true);
}
}
public class Layout01 {
public static void main(String[] args) {
new Frame01("Frame01");
}
}**/



/*
//FlowLayout
import java.awt.*;

class Frame01 extends Frame{
public Frame01(String str){
super(str);
setLayout(new FlowLayout(FlowLayout.LEFT,50,50));
add(new Button("Button 1"));
add(new Button("Button 2"));
add(new Button("Button 3"));
add(new Button("Button 4"));
setSize(400, 400);
setLocation(100, 100);
setVisible(true);
}
}
public class Layout01 {
public static void main(String[] args) {
new Frame01("Frame01");
}
}**/




/*
//BorderLayout
import java.awt.*;

class Frame01 extends Frame{
public Frame01(String str){
super(str);
//setLayout(new FlowLayout(FlowLayout.LEFT,50,50));
add(new Button("Button 1"), BorderLayout.NORTH);
add(new Button("Button 2"), BorderLayout.SOUTH);
add(new Button("Button 3"), BorderLayout.EAST);
add(new Button("Button 4"),BorderLayout.WEST);
add(new Button("Button 5"),BorderLayout.CENTER);
setSize(400, 400);
setLocation(100, 100);
setVisible(true);
}
}
public class Layout01 {
public static void main(String[] args) {
new Frame01("Frame01");
}
}**/


/*
//BorderLayout
import java.awt.*;

class Frame01 extends Frame{
public Frame01(String str){
super(str);
setLayout(new BorderLayout(20,20));
add(new Button("Button 1"), BorderLayout.NORTH);
add(new Button("Button 2"), BorderLayout.SOUTH);
add(new Button("Button 3"), BorderLayout.EAST);
add(new Button("Button 4"),BorderLayout.WEST);
add(new Button("Button 5"),BorderLayout.CENTER);
setSize(400, 400);
setLocation(100, 100);
setVisible(true);
}
}
public class Layout01 {
public static void main(String[] args) {
new Frame01("Frame01");
}
}*/




//GridLayout
import java.awt.*;

class Frame01 extends Frame{
public Frame01(String str){
super(str);
//setLayout(new GridLayout(3,2));
setLayout(new GridLayout(3,2,20,20));

add(new Button("Button 1"));
add(new Button("Button 2"));
add(new Button("Button 3"));
add(new Button("Button 4"));
add(new Button("Button 5"));
setSize(400, 400);
setLocation(100, 100);
setVisible(true);
}
}
public class Layout01 {
public static void main(String[] args) {
new Frame01("Frame01");
}
}

'새로워지기 > 서른의 생활코딩' 카테고리의 다른 글

java _2012.03.05  (0) 2012.03.06
ex8) java.awt.*  (0) 2012.03.04
ex6) java.awt.*  (0) 2012.03.04
ex5) java.awt.*  (0) 2012.03.04
ex4) java.awt.*  (0) 2012.03.04

댓글