본문 바로가기
반응형

자바101

자바 소스코드: Grid Layout 프레임 만들기(전화 다이얼) package javaapplication5; import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*; class GL extends JFrame{ GL() { this.setTitle("Grid Layout"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); c.setLayout(new GridLayout(4,3));//4x3 c.add(new JButton("1")); c.add(new JButton("2")); c.add(new JButton("3")); c.add(new JButton("4.. 2016. 10. 3.
자바 소스코드: Border Layout 프레임 만들기 package javaapplication4; import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*; class BL extends JFrame{ BL() { this.setTitle("Border Layout"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container container = getContentPane(); container.setLayout(new BorderLayout(30,40)); container.add(new JButton("add"),BorderLayout.WEST); container.add(new JButton.. 2016. 10. 3.
자바 소스코드: Flow Layout 프레임 만들기 package javaapplication4; import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*; class FL extends JFrame{ FL() { this.setTitle("Flow Layout"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container container = getContentPane(); container.setLayout(new FlowLayout(FlowLayout.LEFT,30,40)); container.add(new JButton("add")); container.add(new JButton("sub".. 2016. 10. 3.
자바 소스코드: 프레임 속 버튼과 배경 만들기 package javaapplication2; import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*; class ContentPane extends JFrame{ ContentPane() { this.setTitle("두번째 프레임"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //프레임 속 꾸미기 Container contentPane = getContentPane(); contentPane.setBackground(Color.ORANGE); contentPane.setLayout(new FlowLayout()); contentPane.add(.. 2016. 10. 3.
반응형