java简单计算器带日期显示_带有时间显示的计算器JAVA程序,如何把时间模块添加进去...

importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Date;importjava.text.SimpleDateFormat;importjava.util.TimerTask;importjava.util.Calendar;import...

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.Date;

import java.text.SimpleDateFormat;

import java.util.TimerTask;

import java.util.Calendar;

import java.util.Timer;

public class Calculationer extends JFrame implements ActionListener {

private JPanel panel = new JPanel();

private JTextField text1 = new JTextField();

private JTextField text2,field;

private Calendar c=Calendar.getInstance();

private JButton[] number = new JButton[11];

private JButton bt1, bt2, bt3, bt4, bt5, bt6, bt7, bt8, bt9, bt10,bt11;

String string = "";

Label labelSpace; //labelSpace单纯做摆设,控制面板的形状

Label nowtime;//定义一个系统时间标签,用于显示获取当前系统时间

JLabel label=new JLabel();

public static void setTime() //设置时间

{

}

public Calculationer() {

setTitle("简单计算器");

this.setResizable(false);

for (int i = 0; i < 10; i++) {

number[i] = new JButton("" + i);

number[i].addActionListener(this);

}

bt1 = new JButton(".");

bt1.addActionListener(this);

bt2 = new JButton("=");

bt2.addActionListener(this);

bt3 = new JButton("+");

bt3.setForeground(Color.blue);

bt3.addActionListener(this);

bt4 = new JButton("—");

bt4.addActionListener(this);

bt4.setForeground(Color.blue);

bt5 = new JButton("X");

bt5.addActionListener(this);

bt5.setForeground(Color.blue);

bt6 = new JButton("÷");

bt6.addActionListener(this);

bt6.setForeground(Color.blue);

bt7 = new JButton("√");

bt7.setForeground(Color.red);

bt7.addActionListener(this);

bt8 = new JButton("Re");

bt8.addActionListener(this);

bt8.setForeground(Color.red);

bt9 = new JButton("㎡");

bt9.addActionListener(this);

bt9.setForeground(Color.red);

bt10 = new JButton("/");

bt10.addActionListener(this);

bt10.setForeground(Color.cyan);

bt11 = new JButton("Time");

bt11.setForeground(Color.black);

panel.setLayout(new GridLayout(5,5,3,3));

text2=new JTextField(" 感谢使用 !");

field=new JTextField(50);

field.addActionListener(this);

text1.setEditable(false);

field.setEditable(false);

text2.setEditable(false);

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值