zoukankan      html  css  js  c++  java
  • 构建之法——现代软件工程


     import java.awt.*;
    import java.awt.event.ActionListener;
     
    import javax.swing.*;
     
     public class F {
     JFrame frame = new JFrame("计算机");
     
     JPanel pl = new JPanel();
     
     JPanel p2 = new JPanel();
     
     static JTextField show = new JTextField();
     
     static JButton b0 = new JButton("0");
     
     static JButton b1 = new JButton("1");
     
     static JButton b2 = new JButton("2");
     
     static JButton b3 = new JButton("3");
     
     static JButton b4 = new JButton("4");
     
     static JButton b5 = new JButton("5");
     
     static JButton b6 = new JButton("6");
     
     static JButton b7 = new JButton("7");
     
     static JButton b8 = new JButton("8");
     
     static JButton b9 = new JButton("9");
     
     JButton bjia = new JButton("+");
     
     JButton bjian = new JButton("-");
     
     JButton bcheng = new JButton("*");
     
     JButton bchu = new JButton("/");
     
     JButton bdian = new JButton(".");
     
     JButton bdeng = new JButton("=");
     
     JButton bqingchu = new JButton("清除");
     
     public void y() {
     pl.setLayout(new GridLayout(1, 1));
     pl.add(show);
     }
     
     public void p() {
     b1.addActionListener(new U());
     b2.addActionListener(new U());
     b3.addActionListener(new U());
     b4.addActionListener(new U());
     b5.addActionListener(new U());
     b6.addActionListener(new U());
     b7.addActionListener(new U());
     b8.addActionListener(new U());
     b9.addActionListener(new U());
     b0.addActionListener(new U());
     
     bjia.addActionListener(new Fu());
     bjian.addActionListener(new Fu());
     bcheng.addActionListener(new Fu());
     bchu.addActionListener(new Fu());
     
     bdeng.addActionListener(new Deng());
     bqingchu.addActionListener(new Qing());
     
     p2.setLayout(new GridLayout(6, 3));
     p2.add(b1);
     p2.add(b2);
     p2.add(b3);
     p2.add(b4);
     p2.add(b5);
     p2.add(b6);
     p2.add(b7);
     p2.add(b8);
     p2.add(b9);
     p2.add(b0);
     p2.add(bjia);
     p2.add(bjian);
     p2.add(bcheng);
     p2.add(bchu);
     p2.add(bdian);
     p2.add(bqingchu);
     p2.add(bdeng);
     }
     
     public void o() {
     frame.setLayout(new BorderLayout());
     frame.add(pl, BorderLayout.NORTH);
     frame.add(p2, BorderLayout.CENTER);
     frame.setSize(400, 300);
     frame.setVisible(true);
     
     }
     
     public static void main(String[] args) {
     F f = new F();
     f.y();
     f.p();
     f.o();
     
     }
     
     }
     ////

     import java.awt.event.ActionEvent;
     import java.awt.event.ActionListener;
     
     public class ya implements ActionListener {
     public static String str = "";
     
     public static String a = "";
     
     public static String b = "";
     
     public static String k = "";
     
     public void actionPerformed(ActionEvent e) {
     String w = e.getActionCommand();//字
     
     if (k.equals("")) {
     a += w;
     F.show.setText(a);
     
     } else {
     b += w;
     F.show.setText(b);
     }
     
     }
     
     }
    ////
    import java.awt.event.ActionEvent;
     import java.awt.event.ActionListener;
     
     public class Deng implements ActionListener {
     
     public void actionPerformed(ActionEvent e) {
     int a = Integer.parseInt(U.a);
     int b = Integer.parseInt(U.b);
     int c = 0;
     if (U.k.equals("+")) {
     c = a + b;
     
     } else
     
     if (U.k.equals("-")) {
     c = a - b;
     
     } else
     
     if (U.k.equals("*")) {
     c = a * b;
     
     } else
     
     if (U.k.equals("/")) {
     c = a / b;
     
     } else {
     
     }
     
     String d = String.valueOf(c);
     F.show.setText(d);
     U.a = d;
     U.b = "";
     U.k = "";
     }
     }
    ///

     import java.awt.event.ActionEvent;
     import java.awt.event.ActionListener;
     
     public class Qing implements ActionListener {
     
     public void actionPerformed(ActionEvent e) {
     U.a = "";
     U.b = "";
     U.k = "";
     F.show.setText("");
     
     }
     
     }
    ///

     import java.awt.event.ActionEvent;
     import java.awt.event.ActionListener;
     
     public class Qing implements ActionListener {
     
     public void actionPerformed(ActionEvent e) {
     U.a = "";
     U.b = "";
     U.k = "";
     F.show.setText("");
     
     }
     
     }
    ///
    2
      编程太难,无法搞定。写出来一点,但无法运行。

  • 相关阅读:
    反射(8)程序集反射 Type 类
    反射(5)CLR 运行时探测程序集引用的步骤
    反射(1)程序集基础知识
    csc.exe(C# 编译器)
    证书(1)数字签名基础知识
    反射(7)动态程序集加载Load方法
    SignTool.exe(签名工具)
    反射(3)程序集加载 Assembly类
    关于卡巴斯基安全免疫区随笔
    文本提取工具 TextHelper
  • 原文地址:https://www.cnblogs.com/yuanai/p/4422989.html
Copyright © 2011-2022 走看看