반응형
super("title");
라벨 - JLabel label;
label = new JLabel("label");
버튼 - JButton Button; Button
= new JButton("but");
텍스트필드 - JTextField TextField; TextField
= new JTextField(10);
TextArea - JTextArea TextArea; TextArea
= new JTextArea(" ",3,10);
체크박스 - JCheckBox cb; cb=new JCheckBox("a");
콤보박스 - JComboBox jb; jb
.addItem("A"); jb.addItem("B"); jb.addItem("C");
라디오버튼
JRadioButton bb1,bb2; b
b1 = new JRadioButton("sel1",true); bb2 = new JRadioButton("sel2");
ButtonGroup bg = new ButtonGroup();
bg.add(bb1);bg.add(cb2);
더보기
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 package java_project;import java.awt.*;import javax.swing.*;public class pr1 extends JFrame{JLabel la1,la2; JButton b1,b2; JTextField tf1,tf2;JTextArea ta; JCheckBox cb1,cb2; JList la;JComboBox jb; JRadioButton bb1,bb2;pr1(){super("들어가기"); // new JFrame("");la1 = new JLabel("ID");la2 = new JLabel("PW");tf1 = new JTextField(10);tf2 = new JTextField(10);bb1 = new JRadioButton("회원",true);bb2 = new JRadioButton("관리자");b1 = new JButton("들어가기");b2 = new JButton("수정");JPanel p1 = new JPanel();p1.setLayout(new FlowLayout());p1.add("West",bb1); p1.add("East",bb2);// idJPanel p2 = new JPanel();p2.setLayout(new FlowLayout());p2.add("West",la1);p2.add("Center",tf1);//passwordJPanel p3 = new JPanel();p3.setLayout(new FlowLayout());p3.add("West",la2);p3.add("Center",tf2);JPanel p4 = new JPanel();p4.setLayout(new FlowLayout());p4.add("West",b1);p4.add("East",b2);JPanel p5 = new JPanel();p5.setLayout(new BorderLayout());p5.add("North",p2);p5.add("South",p3);this.setLayout(new BorderLayout());this.add("North",p1);this.add("Center",p5);this.add("South",p4);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 30this.pack(); // this.setSize(width,height);this.setVisible(true);}public static void main(String[] args) {new pr1();}}cs
더보기
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 package java_project;import java.awt.*;import javax.swing.*;public class pr2 extends JFrame{JLabel la1,la2,la3,la4; JButton b1;JTextArea li; JComboBox c;JRadioButton cb1,cb2,cb3;pr2(){super("(ID)님"); // new JFrame("");la1 = new JLabel("대여하기");la2 = new JLabel("책장르");la3 = new JLabel("책선택");la4 = new JLabel("대여기간");li = new JTextArea(" ",3,10);cb1 = new JRadioButton("3일",true);cb2 = new JRadioButton("5일");cb3 = new JRadioButton("7일");ButtonGroup bg = new ButtonGroup();bg.add(cb1);bg.add(cb2);bg.add(cb3);b1 = new JButton("확인");c=new JComboBox();c.addItem("A"); c.addItem("B"); c.addItem("D");// 대여하기JPanel p1 = new JPanel();p1.setLayout(new FlowLayout());p1.add(la2);p1.add(c);//책선택JPanel p2 = new JPanel();p2.setLayout(new FlowLayout());p2.add(la3);p2.add(li);//3일 5일~~JPanel p3 = new JPanel();p3.setLayout(new FlowLayout());p3.add(cb1);p3.add(cb2);p3.add(cb3);JPanel p4 = new JPanel();p4.setLayout(new BorderLayout());p4.add("North",p1);p4.add("South",p2);JPanel p5 = new JPanel();p5.setLayout(new BorderLayout());p5.add("North",la4);p5.add("South",p3);JPanel p6 = new JPanel();p6.setLayout(new BorderLayout());p6.add("North",p4);p6.add("South",p5);this.setLayout(new BorderLayout());this.add("North",la1);this.add("Center",p6);this.add("South",b1);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 30this.pack(); // this.setSize(width,height);this.setVisible(true);}public static void main(String[] args) {new pr2();}}cs
더보기
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 package java_project;import java.awt.*;import javax.swing.*;public class pr3 extends JFrame{JLabel la1,la2,la3,la4; JButton b1,b2;JTextField tf1,tf2,tf3; JComboBox c;pr3(){super("추가하기"); // new JFrame("");la1 = new JLabel("책장르");la2 = new JLabel("책이름");la3 = new JLabel("금액");la4 = new JLabel("출판사");b1 = new JButton("추가");b2 = new JButton("수정");tf1 = new JTextField(10);tf2 = new JTextField(10);tf3 = new JTextField(10);c=new JComboBox();c.addItem("A"); c.addItem("B"); c.addItem("C");JPanel p1 = new JPanel();p1.setLayout(new FlowLayout());p1.add(la1);p1.add(c);// 책이름 + textfiledJPanel p2 = new JPanel();p2.setLayout(new FlowLayout());p2.add(la2);p2.add(tf1);// 금액 + textfiledJPanel p3 = new JPanel();p3.setLayout(new FlowLayout());p3.add(la3);p3.add(tf2);// 출판사 + textfiledJPanel p4 = new JPanel();p4.setLayout(new FlowLayout());p4.add(la4);p4.add(tf3);// p2~p4 묶기JPanel p5 = new JPanel();p5.setLayout(new BorderLayout());p5.add("North",p2); p5.add("Center",p3); p5.add("South",p4);JPanel p6 = new JPanel();p6.setLayout(new FlowLayout());p6.add(b1);p6.add(b2);this.setLayout(new BorderLayout());this.add("North",p1);this.add("Center",p5);this.add("South",p6);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 30this.pack(); // this.setSize(width,height);this.setVisible(true);}public static void main(String[] args) {new pr3();}}cs
더보기
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 package java_project;import java.awt.*;import javax.swing.*;public class pr4 extends JFrame{JLabel la1,la2,la3;JButton b1,b2;pr4(){super("(ID)님"); // new JFrame("");la1 = new JLabel("대여하기");la2 = new JLabel("책장르");la3 = new JLabel("책선택");b1 = new JButton("확인");b2 = new JButton("수정하기");// 대여하기JPanel p1 = new JPanel();p1.setLayout(new FlowLayout());p1.add(la2);//금액JPanel p2 = new JPanel();p2.setLayout(new FlowLayout());p2.add(la3);// la2-3 묶기JPanel p3 = new JPanel();p3.setLayout(new BorderLayout());p3.add("North",p1);p3.add("South",p2);// 버튼 2개JPanel p4 = new JPanel();p4.setLayout(new FlowLayout());p4.add(b1); p4.add(b2);this.setLayout(new BorderLayout());this.add("North",la1);this.add("Center",p3);this.add("South",p4);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 30this.pack(); // this.setSize(width,height);this.setVisible(true);}public static void main(String[] args) {new pr4();}}cs
더보기package java_project;import java.awt.*;import javax.swing.*;public class pr5 extends JFrame{JLabel la1;JButton b1,b2;pr5(){super("(ID)님"); // new JFrame("");la1 = new JLabel("감사합니다.");b1 = new JButton("추가");b2 = new JButton("처음으로");// 버튼 2개JPanel p1 = new JPanel();p1.setLayout(new FlowLayout());p1.add(b1);p1.add(b2);this.setLayout(new BorderLayout());this.add("North",la1);this.add("South",p1);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 30this.pack(); // this.setSize(width,height);this.setVisible(true);}public static void main(String[] args) {new pr5();}}
반응형
'프로그래밍 > 시스템' 카테고리의 다른 글
[윈도우 프로그래밍] 윈도우 메뉴와 단축키 만들기 (0) | 2017.05.08 |
---|---|
[Java] NetBeans를 이용해서 GUI 만들기 (0) | 2017.05.05 |
[Java] GUI - NetBeans (0) | 2017.05.04 |
[윈도우 프로그래밍] WinMain 기본코딩 (0) | 2017.05.04 |
[C] 하위 4번째 비트가 항상 1인 숫자 하나를 랜덤하게 출력하는 프로그램 (0) | 2017.04.30 |