/*
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame{
public Main() {
setTitle("1");
setSize(1000,1000);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(null);
JLabel la = new JLabel("Hello, Press Buton!");
la.setLocation(130,50);
la.setSize(200,20);
c.add(la);
for(int i=1; i<=9; i++) {
JButton b = new JButton(Integer.toString(i));
int x = (int)(Math.random()*1000)+1;
int y = (int)(Math.random()*1000)+1;
b.setLocation(x, y);
b.setSize(200, 200);
c.add(b);
}
setSize(300, 200);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame{
public Main() {
setTitle("OPEN CHALLENGE 8");
setVisible(true);
setSize(200,200);
Container c = getContentPane();
c.setLayout(new BorderLayout(30, 20));
JPanel up = new JPanel();
c.add(up,BorderLayout.NORTH);
up.setBackground(Color.gray);
up.add(new JButton("OPEN"));
up.add(new JButton("READ"));
up.add(new JButton("CLOSE"));
JPanel up1 = new JPanel();
c.add(up1,BorderLayout.CENTER);
up1.add(new JLabel("HELLO JAVA!"));
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame{
public Main() {
setTitle("TEN COLOR BUTTONS FRAME");
setVisible(true);
setSize(300,300);
Container c = getContentPane();
c.setLayout(new GridLayout(1, 10));
Color [] color = { Color.RED, Color.ORANGE, Color.YELLOW, Color.green,Color.CYAN, Color.BLUE, Color.MAGENTA, Color.GRAY,
Color.PINK, Color.LIGHT_GRAY};
for(int i=0; i<=10; i++) {
JButton button = new JButton(Integer.toString(i));
button.setOpaque(true);
button.setBackground(color[i]);
c.add(button);
}
}
public static void main(String[] args) {
new Main();
}
}*/
/*
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame{
public Main() {
setTitle("TEN COLOR BUTTONS FRAME");
setVisible(true);
setSize(300,300);
Container c = getContentPane();
c.setLayout(null);
setTitle("RANDOM LABELS");
for(int i=1; i<=20; i++) {
JLabel la = new JLabel(Integer.toString(i));
int x = (int)(Math.random()*300)+1;
int y = (int)(Math.random()*300)+1;
la.setLocation(x,y);
la.setSize(20,20);
la.setForeground(Color.magenta);
c.add(la);
}
}
public static void main(String[] args) {
new Main();
}
}*/
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame{
public Main() {
setTitle(" ");
setVisible(true);
setSize(300,300);
Container c = getContentPane();
c.setLayout(new BorderLayout());
//////////////////////
JPanel up = new JPanel();
c.add(up,BorderLayout.NORTH);
up.setBackground(Color.YELLOW);
up.add(new JButton("새로 배치"));
up.add(new JButton("종료"));
////////////////////////////
JPanel ce = new JPanel();
c.add(ce,BorderLayout.CENTER);
ce.setBackground(Color.WHITE);
ce.setLayout(null);
for(int i=1; i<=10; i++) {
JLabel la = new JLabel("*");
int x = (int)(Math.random()*250)+1;
int y = (int)(Math.random()*200)+20;
la.setLocation(x,y);
la.setSize(20,20);
la.setForeground(Color.red);
ce.add(la);
}
//////////////////
JPanel de = new JPanel();
c.add(de,BorderLayout.SOUTH);
de.setBackground(Color.GRAY);
de.add(new JButton("별 개수 수정"));
de.add(new JTextField(25));
}
public static void main(String[] args) {
new Main();
}
}