1 package com.calipso.reportgenerator.userinterface; 2 3 import javax.swing.*; 4 import java.awt.*; 5 6 12 13 public class UPBooleanCheckBox extends JPanel implements UPComponent { 14 15 private JRadioButton btTrue; 16 private JRadioButton btFalse; 17 18 public UPBooleanCheckBox(LayoutManager layout, boolean isDoubleBuffered) { 19 super(layout, isDoubleBuffered); 20 initialize(); 21 } 22 23 public UPBooleanCheckBox(LayoutManager layout) { 24 super(layout); 25 initialize(); 26 } 27 28 public UPBooleanCheckBox(boolean isDoubleBuffered) { 29 super(isDoubleBuffered); 30 initialize(); 31 } 32 33 public UPBooleanCheckBox() { 34 initialize(); 35 } 36 37 private void initialize() { 38 setLayout(new FlowLayout()); 39 ButtonGroup group = new ButtonGroup(); 40 btTrue = new JRadioButton("True"); 41 btTrue.setSelected(true); 42 btFalse = new JRadioButton("False"); 43 btFalse.setSelected(false); 44 group.add(btTrue); 45 group.add(btFalse); 46 add(btTrue); 47 add(btFalse); 48 } 49 50 public Object getComponentValue() { 51 if(btTrue.isSelected()) { 52 return new Boolean ("true"); 53 } else { 54 return new Boolean ("false"); 55 } 56 } 57 58 } 59 | Popular Tags |