public boolean Refresh=false;//设置lab是否要在输入数据的时候刷新,初始为否
public static void main(String args[]) {
System.out.println("Starting Jsp2003...");
lab.setAlignment(Label.RIGHT);
lab.setBackground(Color.lightGray);
lab.setForeground(Color.BLUE);
lab.setFont(new Font("Serief",Font.BOLD,18));
lab.setBounds(14,33,216,40);
mainFrame.add(lab);
CheckboxGroup grp=new CheckboxGroup();
ckb8.setCheckboxGroup(grp);
ckb10.setCheckboxGroup(grp);
ckb16.setCheckboxGroup(grp);
ckb8.setBounds(14,75,55,25);
ckb10.setBounds(69,75,55,25);
ckb16.setBounds(124,75,65,25);
ckb8.setState(false);
ckb10.setState(true);
ckb16.setState(false);
mainFrame.add(ckb8);
mainFrame.add(ckb10);
mainFrame.add(ckb16);
pnl1.setBounds(14,140,120,150);
pnl2.setBounds(144,140,40,150);
pnl3.setBounds(14,100,170,36);
pnl4.setBounds(190,100,40,190);
pnl1.add(bt7);
pnl1.add(bt8);
pnl1.add(bt9);
pnl1.add(bt4);
pnl1.add(bt5);
pnl1.add(bt6);
pnl1.add(bt1);
pnl1.add(bt2);
pnl1.add(bt3);
pnl1.add(bt0);
pnl1.add(btdot);
pnl1.add(btequ);
pnl2.add(btadd);
pnl2.add(btsub);
pnl2.add(btmul);
pnl2.add(btdev);
pnl3.add(btt);
pnl3.add(btc);
pnl4.add(btA);
pnl4.add(btB);
pnl4.add(btC);
pnl4.add(btD);
pnl4.add(btE);
pnl4.add(btF);
btA.enable(false);
btB.enable(false);
btC.enable(false);
btD.enable(false);
btE.enable(false);
btF.enable(false);
mainFrame.add(pnl1);
mainFrame.add(pnl2);
mainFrame.add(pnl3);
mainFrame.add(pnl4);
mainFrame.setResizable(false);
mainFrame.setLayout(null);
mainFrame.setSize(240,300 );
mainFrame.setTitle("计算器");
mainFrame.setVisible(true);
ckb8.addItemListener(mainFrame);
ckb10.addItemListener(mainFrame);
ckb16.addItemListener(mainFrame);
//把事件聆听者向各个组键注册
bt1.addActionListener(mainFrame);
bt2.addActionListener(mainFrame);
bt3.addActionListener(mainFrame);
bt4.addActionListener(mainFrame);
bt5.addActionListener(mainFrame);
bt6.addActionListener(mainFrame);
bt7.addActionListener(mainFrame);
bt8.addActionListener(mainFrame);
bt9.addActionListener(mainFrame);
bt0.addActionListener(mainFrame);
btadd.addActionListener(mainFrame);
btsub.addActionListener(mainFrame);
btmul.addActionListener(mainFrame);
btdev.addActionListener(mainFrame);
btt.addActionListener(mainFrame);
btc.addActionListener(mainFrame);
btdot.addActionListener(mainFrame);
btequ.addActionListener(mainFrame);
btA.addActionListener(mainFrame);
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页