📄 classdao.java~4~
字号:
package classone.com;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.FlowLayout;
import javax.swing.JTextField;
import java.awt.*;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ClassDAO extends JFrame {
JPanel contentPane;
JTextField txtcount = new JTextField();
JMenuBar jMenuBar1 = new JMenuBar();
JMenu jMenu1 = new JMenu();
JMenuItem jMenuItem1 = new JMenuItem();
JMenuItem jMenuItem2 = new JMenuItem();
JMenu jMenu2 = new JMenu();
JButton btn7 = new JButton();
JButton btn8 = new JButton();
JButton btn9 = new JButton();
JButton btnexpect = new JButton();
JButton btn4 = new JButton();
JButton btn5 = new JButton();
JButton btn6 = new JButton();
JButton btnride = new JButton();
JButton btn1 = new JButton();
JButton btn2 = new JButton();
JButton btn3 = new JButton();
JButton btnminus = new JButton();
JButton btn0 = new JButton();
JButton btnc = new JButton();
JButton btnplus = new JButton();
JButton btnup_to = new JButton();
public ClassDAO() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
this.setJMenuBar(jMenuBar1);
setSize(new Dimension(400, 300));
setTitle("计算机");
txtcount.setText("");
txtcount.setBounds(new Rectangle(62, 29, 265, 34));
jMenu1.setText("编辑(E)");
jMenuItem1.setText("复制(C) Ctri+C");
jMenuItem2.setText("粘贴(P) Ctri+v");
jMenu2.setText("帮助");
btn7.setBounds(new Rectangle(65, 78, 52, 33));
btn7.setText("7");
btn7.addActionListener(new ClassDAO_jButton1_actionAdapter(this));
btn8.setBounds(new Rectangle(133, 78, 52, 33));
btn8.setText("8");
btn8.addActionListener(new ClassDAO_btn8_actionAdapter(this));
btn9.setBounds(new Rectangle(200, 78, 52, 34));
btn9.setText("9");
btn9.addActionListener(new ClassDAO_btn9_actionAdapter(this));
btnexpect.setBounds(new Rectangle(270, 78, 52, 33));
btnexpect.setText("/");
btnexpect.addActionListener(new ClassDAO_btnexpect_actionAdapter(this));
btn4.setBounds(new Rectangle(64, 123, 52, 33));
btn4.setText("4");
btn4.addActionListener(new ClassDAO_btn4_actionAdapter(this));
btn5.setBounds(new Rectangle(133, 123, 52, 33));
btn5.setText("5");
btn5.addActionListener(new ClassDAO_btn5_actionAdapter(this));
btn6.setBounds(new Rectangle(200, 123, 52, 33));
btn6.setText("6");
btn6.addActionListener(new ClassDAO_btn6_actionAdapter(this));
btnride.setBounds(new Rectangle(270, 123, 52, 33));
btnride.setText("*");
btnride.addActionListener(new ClassDAO_btnride_actionAdapter(this));
btn1.setBounds(new Rectangle(66, 173, 52, 33));
btn1.setText("1");
btn1.addActionListener(new ClassDAO_btn1_actionAdapter(this));
btn2.setBounds(new Rectangle(133, 173, 52, 33));
btn2.setText("2");
btn2.addActionListener(new ClassDAO_btn2_actionAdapter(this));
btn3.setBounds(new Rectangle(200, 173, 52, 33));
btn3.setText("3");
btn3.addActionListener(new ClassDAO_jButton11_actionAdapter(this));
btnminus.setBounds(new Rectangle(270, 173, 52, 33));
btnminus.setText("-");
btnminus.addActionListener(new ClassDAO_btnminus_actionAdapter(this));
btn0.setBounds(new Rectangle(65, 223, 52, 33));
btn0.setText("0");
btn0.addActionListener(new ClassDAO_btn0_actionAdapter(this));
btnc.setBounds(new Rectangle(133, 223, 52, 33));
btnc.setText("c");
btnplus.setBounds(new Rectangle(270, 223, 52, 33));
btnplus.setText("+");
btnplus.addActionListener(new ClassDAO_btnplus_actionAdapter(this));
btnup_to.setBounds(new Rectangle(200, 223, 52, 33));
btnup_to.setText("=");
btnup_to.addActionListener(new ClassDAO_btnup_to_actionAdapter(this));
txtcount.addActionListener(new ClassDAO_txtcount_actionAdapter(this));
btnc.addActionListener(new ClassDAO_btnc_actionAdapter(this));
jMenuBar1.add(jMenu1);
jMenuBar1.add(jMenu2);
jMenu1.add(jMenuItem1);
jMenu1.add(jMenuItem2);
contentPane.add(txtcount);
contentPane.add(btnexpect);
contentPane.add(btn7);
contentPane.add(btn9);
contentPane.add(btn4);
contentPane.add(btn6);
contentPane.add(btnride);
contentPane.add(btn1);
contentPane.add(btnminus);
contentPane.add(btn0);
contentPane.add(btnplus);
contentPane.add(btn3);
contentPane.add(btnup_to);
contentPane.add(btn2);
contentPane.add(btnc);
contentPane.add(btn5);
contentPane.add(btn8);
}
boolean flag = false;
String op1;
String op2;
double count;
String action;
public void jButton1_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn7.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn7.getActionCommand());
}
}
public void jButton11_actionPerformed(ActionEvent e) {
}
public void txtcount_actionPerformed(ActionEvent e) {
}
public void btn8_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn8.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn8.getActionCommand());
}
}
public void btn9_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn9.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn9.getActionCommand());
}
}
public void btn4_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn4.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn4.getActionCommand());
}
}
public void btn5_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn5.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn5.getActionCommand());
}
}
public void btn6_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn6.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn6.getActionCommand());
}
}
public void btn1_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn1.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn1.getActionCommand());
}
}
public void btn2_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn2.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn2.getActionCommand());
}
}
public void btn3_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn3.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn3.getActionCommand());
}
}
public void btn0_actionPerformed(ActionEvent e) {
if (flag) {
txtcount.setText(btn0.getActionCommand());
flag = false;
} else {
txtcount.setText(txtcount.getText() + btn0.getActionCommand());
}
}
public void btnplus_actionPerformed(ActionEvent e) {
// op1 = Integer.parseInt(txtcount.getText());
String action = "plus";
flag = true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -