📄 mutichoiceitem.java
字号:
package viewer;
import javax.swing.JCheckBox;
import java.awt.Rectangle;
import javax.swing.JToggleButton;
import model.persistency.PersistentItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JOptionPane;
import java.awt.Point;
import java.awt.Dimension;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class MutiChoiceItem extends TestFrame{
PersistentItem item;
// String answer;
JCheckBox aCheckBox = new JCheckBox();
JCheckBox bCheckBox = new JCheckBox();
JCheckBox cCheckBox = new JCheckBox();
JCheckBox dCheckBox = new JCheckBox();
public MutiChoiceItem(PersistentItem it) {
super(it);
// JOptionPane.showConfirmDialog(null,"into jbint3");
this.item = it;
// answer = new String();
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
//this.setJMenuBar(jMenuBar1);
setSize(new Dimension(525, 440));
setTitle("OLTS System");
// JOptionPane.showConfirmDialog(null,"into jbint");
// aCheckBox.setActionCommand("aCheckBox");
aCheckBox.setText("A");
aCheckBox.setBounds(new Rectangle(25, 244, 42, 22));
//dCheckBox.setActionCommand("dCheckBox");
dCheckBox.setText("D");
dCheckBox.setBounds(new Rectangle(178, 244, 51, 23));
//cCheckBox.setActionCommand("cCheckBox");
cCheckBox.setText("C");
cCheckBox.setBounds(new Rectangle(128, 244, 34, 20));
bCheckBox.setText("B");
bCheckBox.setBounds(new Rectangle(77, 244, 35, 22));
//bCheckBox.setActionCommand("bCheckBox");
this.getContentPane().add(aCheckBox);
this.getContentPane().add(bCheckBox);
this.getContentPane().add(cCheckBox);
this.getContentPane().add(dCheckBox);
aCheckBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
trace("A",aCheckBox);}
});
bCheckBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
trace("A",aCheckBox);}
});
cCheckBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
trace("A",aCheckBox);}
});
dCheckBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
trace("A",aCheckBox);}
});
}
private void trace(String a, JCheckBox cb){
if(cb.isSelected())
super.answer = super.answer + a;
JOptionPane.showConfirmDialog(null,super.answer);
}
}//~~
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -