1. 아래 그림과 같은 스위 프로그램을 작성하시오.( 크기는 400 * 300, 배경색은 노랑색 )
2. 아래그림과 같이 프로그램을 작성하시오.(배경색(rgb : 255, 255, 204))
소스코드
import javax.swing.*;
import java.awt.*;
public class FlowLayoutEx extends JFrame {
public FlowLayoutEx() {
setTitle("배경색과 버튼만들기");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Color rgb = new Color(255,255,205);
Container c = getContentPane();
c.setBackground(rgb);
c.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
c.add(new JButton("더하기"));
c.add(new JButton("빼기"));
c.add(new JButton("곱하기"));
c.add(new JButton("나누기"));
setSize(350, 200);
setVisible(true);
}
public static void main(String[] args) {
new FlowLayoutEx();
}
}
3. 아래그림과 같이 프로그램을 작성하시오.
4. 아래그림과 같이 프로그램을 작성하시오.
'프로그램언어 > 자바' 카테고리의 다른 글
이벤트 리스너 예제1 (0) | 2020.11.03 |
---|---|
이벤트 처리하기 (0) | 2020.11.02 |
컨테이너와 배치 (0) | 2020.11.02 |
AWT와 스윙(Swing) (0) | 2020.11.01 |
jsp파일에서 다음 주소검색창 열기 (0) | 2020.10.18 |