gui小计算器的程序写法
- import java.awt.BorderLayout;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import java.awt.BorderLayout;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.JButton;
- import java.awt.Color;
- import javax.swing.JTextArea;
- import javax.swing.GroupLayout;
- import javax.swing.GroupLayout.Alignment;
- import javax.swing.LayoutStyle.ComponentPlacement;
- import javax.swing.JCheckBox;
- import javax.swing.JTextField;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.SwingConstants;
- import java.awt.Font;
- public class gui1 extends JFrame {
- private JPanel contentPane;
- private JTextField textField;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- gui1 frame = new gui1();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public void f1(){
- //获取文本框的内容
- textField.getText();
- //对字符串进行解析(获取你有用的信息)//1+1=
- //System.out.println(textField.getText());
- //1+1=
- //截取+号之前的数据,+号之后=号之前的数据
- int aa1 =(textField.getText()).indexOf("+");
- int aa2 =(textField.getText()).indexOf("-");
- int aa3 =(textField.getText()).indexOf("*");
- int aa4 =(textField.getText()).indexOf("/");
- //判断加减乘除
- if(-!=aa1){
- int a=(textField.getText()).indexOf("+");
- //int b=(textField.getText()).indexOf("+1");
- int d=(textField.getText()).indexOf("=");
- String str1=new String();
- String str2=new String();
- str1=(textField.getText()).substring(,a);
- str2=(textField.getText()).substring(a+,d);
- //截取到了之后,结果是个字符串,要进行转换,转换成int
- int e1=Integer.parseInt(str1);
- int e2=Integer.parseInt(str2);
- //执行操作,计算(用方法实现),返回值int
- gui1 ss=new gui1();
- ss.f(e1,e2);
- textField.setText(""+ss.f(e1,e2));
- }else if(-!=aa2){
- int a=(textField.getText()).indexOf("-");
- //int b=(textField.getText()).indexOf("+1");
- int d=(textField.getText()).indexOf("=");
- String str1=new String();
- String str2=new String();
- str1=(textField.getText()).substring(,a);
- str2=(textField.getText()).substring(a+,d);
- //截取到了之后,结果是个字符串,要进行转换,转换成int
- int e1=Integer.parseInt(str1);
- int e2=Integer.parseInt(str2);
- //执行操作,计算(用方法实现),返回值int
- gui1 ss=new gui1();
- ss.f4(e1,e2);
- textField.setText(""+ss.f4(e1,e2));
- }else if(-!=aa3){
- int a=(textField.getText()).indexOf("*");
- //int b=(textField.getText()).indexOf("+1");
- int d=(textField.getText()).indexOf("=");
- String str1=new String();
- String str2=new String();
- str1=(textField.getText()).substring(,a);
- str2=(textField.getText()).substring(a+,d);
- //截取到了之后,结果是个字符串,要进行转换,转换成int
- int e1=Integer.parseInt(str1);
- int e2=Integer.parseInt(str2);
- //执行操作,计算(用方法实现),返回值int
- gui1 ss=new gui1();
- ss.f2(e1,e2);
- textField.setText(""+ss.f2(e1,e2));
- }else if(-!=aa4){
- int a=(textField.getText()).indexOf("/");
- //int b=(textField.getText()).indexOf("+1");
- int d=(textField.getText()).indexOf("=");
- String str1=new String();
- String str2=new String();
- str1=(textField.getText()).substring(,a);
- str2=(textField.getText()).substring(a+,d);
- //截取到了之后,结果是个字符串,要进行转换,转换成int
- int e1=Integer.parseInt(str1);
- int e2=Integer.parseInt(str2);
- //执行操作,计算(用方法实现),返回值int
- gui1 ss=new gui1();
- ss.f3(e1,e2);
- textField.setText(""+ss.f3(e1,e2));
- }
- //输出结果,settext(string t),字符串,int转成成string,作为入参{String = 1+“1”}
- //String a1=(String)"a2";
- //输出结果:把之前的=号公式,要放在前面
- }
- public int f(int w,int r){
- int p=w+r;
- return p;
- }
- public int f4(int w,int r){
- int p=w-r;
- return p;
- }
- public int f2(int w,int r){
- int p=w*r;
- return p;
- }
- public int f3(int w,int r){
- int p=w/r;
- return p;
- }
- public gui1() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(, , , );
- contentPane = new JPanel();
- contentPane.setBackground(Color.LIGHT_GRAY);
- contentPane.setForeground(Color.GREEN);
- contentPane.setBorder(new EmptyBorder(, , , ));
- setContentPane(contentPane);
- JButton btnNewButton_8 = new JButton("m-");
- btnNewButton_8.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- }
- });
- btnNewButton_8.setBackground(Color.ORANGE);
- JButton btnNewButton_6 = new JButton("+");
- JButton btnNewButton_18 = new JButton("*");
- JButton btnNewButton_20 = new JButton("\u221A ");
- JButton btnNewButton_22 = new JButton("%");
- JButton btnNewButton_21 = new JButton("1/x");
- textField = new JTextField();
- textField.setColumns();
- JButton btnNewButton = new JButton("MC");
- btnNewButton.setBackground(Color.LIGHT_GRAY);
- JButton btnMr = new JButton("MR");
- JButton btnMs = new JButton("MS");
- JButton btnM = new JButton("M+");
- JButton btnM_1 = new JButton("M-");
- JButton button_4 = new JButton("<--");
- button_4.setFont(new Font("宋体", Font.PLAIN, ));
- button_4.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- }
- });
- JButton button_5 = new JButton("");
- button_5.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_6 = new JButton("");
- button_6.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_7 = new JButton("");
- button_7.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_8 = new JButton("");
- button_8.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- String inputValue = JOptionPane.showInputDialog("请输入密码:");
- }
- });
- JButton btnCe = new JButton("CE");
- JButton button_10 = new JButton("");
- button_10.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_11 = new JButton("");
- button_11.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_12 = new JButton("");
- button_12.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton btnC = new JButton("C");
- btnC.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText("");
- }
- });
- JButton button_14 = new JButton("\u00B1");
- JButton button_15 = new JButton("\u221A");
- button_15.setFont(new Font("宋体", Font.PLAIN, ));
- button_15.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- textField.setText(textField.getText()+"√");
- }
- });
- JButton button_16 = new JButton("");
- button_16.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_17 = new JButton("/");
- button_17.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"/");
- }
- });
- JButton button_18 = new JButton("%");
- JButton button_19 = new JButton("");
- button_19.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_20 = new JButton("*");
- button_20.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"*");
- }
- });
- JButton btnx = new JButton("1/x");
- btnx.setFont(new Font("微软雅黑", Font.PLAIN, ));
- btnx.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- }
- });
- JButton button_22 = new JButton("");
- button_22.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"");
- }
- });
- JButton button_23 = new JButton("-");
- button_23.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"-");
- }
- });
- JButton button_24 = new JButton(".");
- button_24.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+".");
- }
- });
- JButton button_25 = new JButton("+");
- button_25.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textField.setText(textField.getText()+"+");
- //JOptionPane.showConfirmDialog(null,
- // "请选择", "titie", JOptionPane.YES_NO_OPTION);
- }
- });
- JButton button_26 = new JButton("=");
- button_26.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- //等于、、结果输出
- textField.setText(textField.getText()+"=");
- f1();
- }
- });
- GroupLayout gl_contentPane = new GroupLayout(contentPane);
- gl_contentPane.setHorizontalGroup(
- gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(button_6, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_7, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(button_11, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_12, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
- .addComponent(button_8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_19, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_20, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnx, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_22, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_23, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_24, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_25, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_26, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap()
- .addComponent(btnNewButton_6, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(btnNewButton_21, GroupLayout.DEFAULT_SIZE, , Short.MAX_VALUE)
- .addComponent(btnNewButton_22, GroupLayout.DEFAULT_SIZE, , Short.MAX_VALUE)
- .addComponent(btnNewButton_20, GroupLayout.DEFAULT_SIZE, , Short.MAX_VALUE))
- .addGap()
- .addComponent(btnNewButton_18))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap()
- .addComponent(btnNewButton_8)
- .addGap())))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnMr, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnMs, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnM, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnM_1, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addComponent(textField, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_4, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnCe, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnC, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_14, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_15, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_5, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_10, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_16, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_17, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_18, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
- .addContainerGap())
- );
- gl_contentPane.setVerticalGroup(
- gl_contentPane.createParallelGroup(Alignment.TRAILING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addContainerGap()
- .addComponent(textField, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(btnMr, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(btnMs, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(btnM, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(btnM_1, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(button_4, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(btnCe, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(btnC, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_14, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_15, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(btnNewButton_20)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnNewButton_22)
- .addPreferredGap(ComponentPlacement.RELATED))
- .addComponent(btnNewButton_8, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
- .addComponent(btnNewButton_18)
- .addComponent(btnNewButton_21))
- .addGap()
- .addComponent(btnNewButton_6))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_5, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_6, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_10, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_11, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_16, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_19, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_17, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_20, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(button_12, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_7, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_22, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_23, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(button_25, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_24, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addComponent(button_8, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addComponent(button_18, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(btnx, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_26, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
- .addGap())
- );
- contentPane.setLayout(gl_contentPane);
- }
- }
gui小计算器的程序写法的更多相关文章
- 算法课上机实验(一个简单的GUI排序算法比较程序)
(在家里的电脑上Linux Deepin截的图,屏幕大一点的话,deepin用着还挺不错的说) 这个应该是大二的算法课程上机实验时做的一个小程序,也是我的第一个GUI小程序,实现什么的都记不清了,只记 ...
- 用PYTHON首选的GUI库WXPYTHON做程序界面
大家好,我是A8U神经网络,今天又要跟大家分享一下wxWidgets开发神经网络程序界面的一些经验,希望对开发有兴趣的朋友有所帮助.跨平台的GUI工具库以GTK +,Qt和wxWidgets闻名. G ...
- 架构师JavaScript 的对象继承方式,有几种程序写法?
架构师JavaScript 的对象继承方式,有几种程序写法? 一.对象冒充 其原理如下:构造函数使用 this 关键字给所有属性和方法赋值(即采用类声明的构造函数方式).因为构造函数只是一个函数, ...
- Java实现 蓝桥杯 历届试题 小计算器
历届试题 小计算器 时间限制:1.0s 内存限制:256.0MB 问题描述 模拟程序型计算器,依次输入指令,可能包含的指令有 1. 数字:'NUM X',X为一个只包含大写字母和数字的字符串,表示一个 ...
- js小程序写法优化
(function(){ var gcld_but = document.getElementById("gcld_but"), gcld_but_li = gcld_but.ge ...
- Java GUI小程序--画板
画板效果 (以前写在Csdn上的博文,没去水印,Csdn名字同博客园) 布局类: package gary; import java.awt.Color; import java.awt.even ...
- python 爬取糗事百科 gui小程序
前言:有时候无聊看一些搞笑的段子,糗事百科还是个不错的网站,所以就想用Python来玩一下.也比较简单,就写出来分享一下.嘿嘿 环境:Python 2.7 + win7 现在开始,打开糗事百科网站,先 ...
- GUI小程序---理解GUI
package com.gui; import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent ...
- python库的tkinter带你进入GUI世界(计算器简单功能)
前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者: 一个处女座的程序猿 PS:如有需要Python学习资料的小伙伴可以加 ...
随机推荐
- 自动化web前端测试,自动登录网站.目前发现最靠谱的方法是imacros
imacros免费版 登录宏代码的示例: //首先登出URL GOTO=http://yoursite/logout.html//打开登录页面URL GOTO=http://yoursite/logi ...
- 数据库的范式,第一、二、三、四、五范式、BC范式
数据库的规范化(上一篇博客有写到)的程度不同,便有了这么多种范式.数据库范式是数据库设计必不可少的知识,没有对范式的理解,就无法设计出高效率.优雅的数据库,甚至设计出错误误的数据库.课本中的定义比较抽 ...
- OpenWrt 对外网开放vsftp服务和samba服务
对WAN开放vsFTP OpenWrt默认启动了vsftp服务, 在Luci上没找到配置界面, 但是后台是有这个服务的, 如果在Openwrt的lan下, 可以直接使用FileZilla之类的客户端连 ...
- mycat偶尔会出现JVM报错double free or corruption并崩溃退出
mycat偶尔会出现JVM报错double free or corruption并崩溃退出 没有复杂的sql,也没有大量的io INFO | jvm | // :: | *** Error in `j ...
- Python的虚拟机安装已经如何配置Scrapy for Mac
时间:2018年2月21日 因为时间问题,以下笔记就粗略记录.仅作为个人笔记为用 安装virtualenv和virtualenvwrapper 如何安装的细节下面这篇也有介绍,包括如何使用切换虚拟机也 ...
- 整体C#与Sql培训内容及结构
图如果看不清可以右键存图片到本地
- 在 java 开发接口中需要注意的问题
1 在开发过程中免不了对接上游或下游,有合作就要保证入参.出参的准确性.一个接口一般只能处理有限情况下的情况,因此在逻辑处理前要对入参进行校验. 2 在自己的逻辑处理过程中,要时刻持有怀疑的态度.假设 ...
- Asp.Net Newtonsoft.Json使用教程
json序列化和反序列化的使用教程 实体 public class wendaModel { private string _title; private string _cons; public s ...
- iOS开发下载文件速度计算
当我们写下载界面的时候,需要向用户展示每秒下载多少KB,这个时候就需要计算速度.如下: 我用的是AFNetworking来做下载的,我们拿AFHTTPRequestOperation来举列,AFHTT ...
- 关于Cocos的内存管理机制引发一些异常的解决方案
错误:引发了异常: 读取访问权限冲突. this 是 0xDDDDDDDD.或者hero是 0xDDDDDDDD.hero是在GameController里创建的对象 这个的意思是this所指向的内存 ...