zoukankan      html  css  js  c++  java
  • 计算器

    1,利用AWT组件实现计算器的可视化界面。

    2,掌握布局管理器的实现。

    3,计算器的实现利用了网页布局管理器。

    4,布局管理类的实现要在框架之上进行实现。

    5,遇到的问题:实现一个四行四列的计算器,第一次运行的时候是四行四列,第二次运行的时候是三行四列,第三次运行的时候又会恢复之前

    正常的四行四列,

    import java.awt.*;
    public class LoginFrame extends Frame{
     public LoginFrame()
     {
      super("计算器");
      this.setSize(200,130);
      this.setLocation(300,240);//设置组件的显示位置
      this.setBackground(Color.lightGray);//设置组件的背景颜色
      this.setVisible(true);//显示框架窗口
      this.setLayout(new GridLayout(4,4));
      this.add(new Button("7"));
      this.add(new Button("8"));
      this.add(new Button("9"));
      this.add(new Button("/"));
      this.add(new Button("4"));
      this.add(new Button("5"));
      this.add(new Button("6"));
      this.add(new Button("*"));
      this.add(new Button("1"));
      this.add(new Button("2"));
      this.add(new Button("3"));
      this.add(new Button("-"));
      this.add(new Button("0"));
      this.add(new Button("."));
      this.add(new Button("="));
      this.add(new Button("+"));

    }
     public static void main(String arg[])
     {
      new LoginFrame();
     }

    }

  • 相关阅读:
    5大用例设计笔试大题,附详细解析!
    面试被问到:fiddler 在工作中有哪些应用?怎么破?
    Jmeter设置中文
    Git 操作
    测压数据处理脚本
    python通过126邮箱发送邮件
    Python读取Mysql数据并写入Excel
    Git基本操作命令
    python接口自动化框架探讨
    寒假每日一题(B
  • 原文地址:https://www.cnblogs.com/sdn1229/p/6862449.html
Copyright © 2011-2022 走看看