JAVA JCheckBox,JRadioButton Demo
Reference:최종명 외 2인,프로그래머를 위한 JAVA2 4E,홍릉출판사
CheckTest.java
CheckTest.java
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- protected JCheckBox breakfast,lunch,dinner;
- protected JRadioButton creditCard,cash;
- public CheckTest(){
- super("Check/Radio Test");
- breakfast.addItemListener(this);
- top.add(breakfast);
- lunch.addItemListener(this);
- top.add(lunch);
- dinner.addItemListener(this);
- top.add(dinner);
- getContentPane().add(top);
- cash.addItemListener(this);
- bottom.add(cash);
- bg.add(cash);
- creditCard.addItemListener(this);
- bottom.add(creditCard);
- bg.add(creditCard);
- getContentPane().add(bottom);
- setSize(300,200);
- setVisible(true);
- }
- int type = e.getStateChange();
- if(o == breakfast){
- }else{
- }
- }else if(o== lunch){
- }else{
- }
- }else if(o==dinner){
- }else{
- }
- }else if(o==cash){
- }else{
- }
- }else{
- }else{
- }
- }
- }
- new CheckTest();
- }
- }
댓글
댓글 쓰기