티스토리 뷰

import java.awt.*;
import javax.swing.*;

public class Exam31_1 extends JFrame {
	private Label title_lb = new Label("여기가 제목입니다.", Label.RIGHT);
	private TextField title_tf = new TextField();
	private TextArea contents_ta = new TextArea();
	private Button register_bt = new Button("글등록");

	private GridLayout gl1 = new GridLayout(4, 1);
	private BorderLayout bl = new BorderLayout(10, 10);

	private Panel p1 = new Panel();
	private Panel p2 = new Panel();

	private BorderLayout bl1 = new BorderLayout();
	private FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);

	public Exam31_1(String title) {
		super(title);
		super.setSize(500, 300);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		this.init();

		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension frame = super.getSize();

		int xpos = (int) (screen.getWidth() - frame.getWidth()) / 2;
		int ypos = (int) (screen.getHeight() - frame.getWidth()) / 2;
		super.setLocation(xpos, ypos);

		super.setResizable(false);
		super.setVisible(true);
	}

	public void init() {
		this.setLayout(bl);

		this.add("North", p1);
		p1.setLayout(bl1);
		p1.add("West", title_lb);
		p1.add("Center", title_tf);

		this.add("Center", contents_ta);

		this.add("South", p2);
		p2.setLayout(fl);
		p2.add(register_bt);
	}

	public static void main(String[] args) {
		new Exam31_1("title");
	}
}
반응형
LIST

'공부합시다 > 찍먹' 카테고리의 다른 글

[혼공자] Chapter 02. 확인문제  (0) 2021.04.07
[JAVA] 이벤트 처리 기법 프로그램  (0) 2021.04.06
[JAVA] 계산기 버튼 만들기  (0) 2021.04.05
[JAVA] File Dialog  (0) 2021.04.05
[JAVA] Choice class와 Choice List  (0) 2021.04.05
댓글
링크
공지사항
최근에 올라온 글