728x90
반응형
import java.awt.*;
import java.awt.event.*;
public class Main {
public static void main(String[] args) {
Frame frame = new Frame();
frame.setTitle("액자");
frame.setBounds(100, 100, 600, 400);
frame.setLayout(new FlowLayout());
frame. setResizable(false);
// 라벨 만들기
Label label = new Label("문자열 : ");
frame.add(label);
// 버튼 만들기
Button button = new Button("버튼");
frame.add(button);
// 완성된 윈도우 보이기
frame.setVisible(true);
// 윈도우 창 닫기 활성화
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
}
});
}
}

728x90
반응형
'즐거운프로그래밍' 카테고리의 다른 글
[자바] AWT 패키지의 이해(콤보박스 컴포넌트, Choice Component) (0) | 2023.10.23 |
---|---|
[자바] AWT 패키지의 이해(체크박스 컴포넌트와 라디오 체크박스 / Checkbox, Checkbox radio Component) (1) | 2023.10.23 |
[자바] AWT 패키지의 이해(라벨 컴포넌트, Label Component) (0) | 2023.10.23 |
[자바] GUI 프로그램 기본 구조 예제 (1) | 2023.10.23 |
[자바] GUI 프로그램 기본 구조 (0) | 2023.10.23 |