코드는 대략 이렇구요
import java.awt.*;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Gui2 extends JFrame {
Gui2(){
setTitle("GUI");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = getContentPane();
contentPane.setBackground(Color.WHITE);
contentPane.setLayout(new FlowLayout(FlowLayout.LEFT,30,30));
JPanel JpLeft = new JPanel();
JpLeft.setLayout(new GridLayout(5,5));
JpLeft.setBackground(Color.YELLOW);
JpLeft.setSize(200,300);
contentPane.add(JpLeft, BorderLayout.WEST);
JLabel Jlb1 = new JLabel(" Type ID");
JLabel Jlb2 = new JLabel(" Password");
JTextField id = new JTextField(12);
JTextField pw = new JTextField(12);
JpLeft.add(Jlb1);
JpLeft.add(id);
JpLeft.add(Jlb2);
JpLeft.add(pw);
JPanel Jpright = new JPanel();
Jpright.setLayout(new GridLayout(7,0));
Jpright.setBackground(Color.GREEN);
Jpright.setSize(200,300);
contentPane.add(Jpright, BorderLayout.EAST);
JLabel Jlb3 = new JLabel(" Please Check!!");
JCheckBox cS = new JCheckBox("C# JCheckBox");
JCheckBox cP = new JCheckBox("C++ JCheckBox");
Jpright.add(Jlb3);
Jpright.add(cS);
Jpright.add(cP);
JButton Jbt = new JButton("OK");
JPanel bP = new JPanel();
contentPane.add(bP, BorderLayout.CENTER);
bP.add(Jbt);
setSize(400,300);
setVisible(true);
}
public static void main(String[] args) {
new Gui2();
}
}
결과물이
요렇게 나와야하는데 배치하는게 너무힘들어요 ㅠㅠ 도와주세요