快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

连点器代码java 连点器编写

java编一个计算器的代码

界面漂亮堪比系统自带计算器,功能完美加减乘除开平方等等全部具备,还有清零按钮,小数点的使用,连加连乘功能完全参考系统官方计算器经过长期调试改进而成,马上拷贝代码拿去试试看吧,绝不后悔!

创新互联建站是网站建设技术企业,为成都企业提供专业的做网站、网站制作,网站设计,网站制作,网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制适合企业的网站。十余年品质,值得信赖!

代码如下:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.util.*;

public class Counter {

public static void main(String[] args) {

CounterFrame frame = new CounterFrame();

frame.show();

}

}

class CounterFrame extends JFrame {

public CounterFrame() {

JMenuBar menuBar = new JMenuBar();

JMenu menuFile = new JMenu();

JMenu menuFile1 = new JMenu();

JMenu menuFile2 = new JMenu();

JMenu menuFile3 = new JMenu();

JMenuItem menuFileExit = new JMenuItem();

menuFile.setText("文件");

menuFile1.setText("编辑");

menuFile2.setText("查看");

menuFile3.setText("帮助");

menuFileExit.setText("退出");

menuFileExit.addActionListener

(

new ActionListener() {

public void actionPerformed(ActionEvent e) {

CounterFrame.this.windowClosed();

}

}

);

menuFile.add(menuFileExit);

menuBar.add(menuFile);

menuBar.add(menuFile1);

menuBar.add(menuFile2);

menuBar.add(menuFile3);

setTitle("计算器");

setJMenuBar(menuBar);

setSize(new Dimension(400, 280));

this.getContentPane().add(new Allpanel());

this.addWindowListener

(

new WindowAdapter() {

public void windowClosing(WindowEvent e) {

CounterFrame.this.windowClosed();

}

}

);

}

protected void windowClosed() {

System.exit(0);

}

}

class Tool {

public static Tool instance;

private JTextField field;

private Tool() {

this.field=new JTextField(30);

this.field.setHorizontalAlignment(JTextField.RIGHT);

}

public static Tool getinstance()

{

if(instance==null)

{

instance=new Tool();

}

return instance;

}

public JTextField getfield()

{

return (this.field);

}

}

class Allpanel extends JPanel {

public Allpanel() {

this.setLayout(new BorderLayout(0,7));

Northpanel np=new Northpanel();

Centerpanel cp=new Centerpanel();

this.add(np,BorderLayout.NORTH);

this.add(cp,BorderLayout.CENTER);

}

}

class Centercenter extends JPanel {

static Vector Vec=new Vector();

static Vector vc=new Vector();

static Vector vc1=new Vector();

static Vector vc2=new Vector();

static Vector vc3=new Vector();

static String begin="yes";

static double add;

static double jq;

static double cs;

static double cq;

static double dy;

static String jg;

static String what;

static double tool=0;

static String to="yes";

/**

* Method Centercenter

*

*

*/

public Centercenter() {

// TODO: Add your code here

final JTextField text=Tool.getinstance().getfield();

this.setLayout(new GridLayout(4,5,3,3));

String arg[] ={"7","8","9","/","sqrt","4","5","6","*","%","1","2","3","-","1/x","0","+/-",".","+","="};

for(int i=0;i20;i++)

{

final JButton b=new JButton(arg[i]);

//this.add(new JButton(arg[i]));

this.add(b);

if(i==0||i==1||i==2||i==5||i==6||i==7||i==10||i==11||i==12||i==15)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String mark=b.getText();

String ma=text.getText();

if(vc3.contains("v3"))

{

text.setText("0."+mark);

vc3.clear();

}

else if(vc.contains("a"))

{

if(vc2.contains("v2"))

{

text.setText("0."+mark);

vc.clear();

vc2.clear();

}

else

{

text.setText(mark);

vc.clear();

Vec.clear();

Vec.add(mark);

}

}

else

{

text.setText(ma.trim()+mark);

Vec.add(mark);

}

begin="no";

to="yes";

}

});

}

if(i==17)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String mar=b.getText();

String m=text.getText();

if("yes".equals(begin))

{

vc3.add("v3");

}

if(vc1.contains("v1"))

{

vc2.add("v2");

vc1.clear();

}

if(!Vec.contains(".")!vc.contains("a"))

{

text.setText(m.trim()+mar);

Vec.add(".");

}

}

});

}

if(i==18)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

add=Double.parseDouble(ma);

if(what==null)

{

tool=add;

what="add";

}

else

{

tool=tool+add;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="+";

}

});

}

if(i==13)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

jq=Double.parseDouble(ma);

if(what==null)

{

tool=jq;

what="jq";

}

else

{

tool=tool-jq;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="-";

}

});

}

if(i==3)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

cq=Double.parseDouble(ma);

if(what==null)

{

tool=cq;

what="cq";

}

else

{

tool=tool/cq;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="/";

}

});

}

if(i==4)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

cq=Double.parseDouble(ma);

text.setText(String.valueOf(Math.sqrt(cq)));

}

});

}

if(i==8)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

cs=Double.parseDouble(ma);

if(what==null)

{

tool=cs;

what="cs";

}

else

{

tool=tool*cs;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="*";

}

});

}

if(i==19)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

dy=Double.parseDouble(ma);

if(what=="add")

{

jg=String.valueOf((tool+dy));

}

if(what=="jq")

{

jg=String.valueOf((tool-dy));

}

if(what=="cs")

{

jg=String.valueOf((tool*dy));

}

if(what=="cq")

{

jg=String.valueOf((tool/dy));

}

if(what==null)

{

if(to=="+")

{

tool=add;

jg=String.valueOf(tool+dy);

}

else if(to=="-")

{

tool=jq;

jg=String.valueOf(dy-tool);

}

else if(to=="*")

{

tool=cs;

jg=String.valueOf(dy*tool);

}

else if(to=="/")

{

tool=cq;

jg=String.valueOf(dy/tool);

}

else

{

jg=String.valueOf(dy);

}

}

text.setText(jg);

Vec.clear();

Vec.add(".");

vc.add("a");

vc1.add("v1");

what=null;

tool=0;

}

});

}

}

}

}

class Centernorth extends JPanel {

public Centernorth() {

final JTextField text=Tool.getinstance().getfield();

JButton jb1=new JButton("Backspace");

JButton jb2=new JButton(" CE ");

JButton jb3=new JButton(" C ");

this.add(jb1);

this.add(jb2);

this.add(jb3);

jb1.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e)

{

String back=Tool.getinstance().getfield().getText();

text.setText(backmethod(back));

Centercenter.Vec.remove(Centercenter.Vec.size()-1);

}

});

jb3.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e)

{

text.setText("0.");

Centercenter.Vec.clear();

Centercenter.Vec.add(".");

Centercenter.vc.add("a");

Centercenter.begin="yes";

Centercenter.vc1.clear();

Centercenter.what=null;

Centercenter.tool=0;

}

});

}

public String backmethod(String str)

{

return str.substring(0,str.length()-1);

}

}

class Centerpanel extends JPanel {

public Centerpanel() {

this.setLayout(new BorderLayout(8,7));

Centernorth cn=new Centernorth();

Centercenter cc=new Centercenter();

Centerwest cw=new Centerwest();

this.add(cn,BorderLayout.NORTH);

this.add(cc,BorderLayout.CENTER);

this.add(cw,BorderLayout.WEST);

}

}

class Centerwest extends JPanel {

public Centerwest() {

this.setLayout(new GridLayout(4,1,3,3));

this.add(new JButton("MC"));

this.add(new JButton("MR"));

this.add(new JButton("MS"));

this.add(new JButton("M+"));

}

}

class Northpanel extends JPanel {

private JTextField tf;

public Northpanel() {

tf=Tool.getinstance().getfield();

this.add(tf);

}

}

---------------------------------------------------------------------------

=============《按你要求特意后改过的最简单功能的代码如下》========================

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.util.*;

public class Counter2 {

public static void main(String[] args) {

CounterFrame frame = new CounterFrame();

frame.show();

}

}

class CounterFrame extends JFrame {

public CounterFrame() {

setTitle("计算器");

setSize(new Dimension(400, 280));

this.getContentPane().add(new Allpanel());

this.addWindowListener

(

new WindowAdapter() {

public void windowClosing(WindowEvent e) {

CounterFrame.this.windowClosed();

}

}

);

}

protected void windowClosed() {

System.exit(0);

}

}

class Tool {

public static Tool instance;

private JTextField field;

private Tool() {

this.field=new JTextField(30);

this.field.setHorizontalAlignment(JTextField.RIGHT);

}

public static Tool getinstance()

{

if(instance==null)

{

instance=new Tool();

}

return instance;

}

public JTextField getfield()

{

return (this.field);

}

}

class Allpanel extends JPanel {

public Allpanel() {

this.setLayout(new BorderLayout(0,7));

Northpanel np=new Northpanel();

Centerpanel cp=new Centerpanel();

this.add(np,BorderLayout.NORTH);

this.add(cp,BorderLayout.CENTER);

}

}

class Centercenter extends JPanel {

static Vector Vec=new Vector();

static Vector vc=new Vector();

static Vector vc1=new Vector();

static Vector vc2=new Vector();

static Vector vc3=new Vector();

static String begin="yes";

static double add;

static double jq;

static double cs;

static double cq;

static double dy;

static String jg;

static String what;

static double tool=0;

static String to="yes";

/**

* Method Centercenter

*

*

*/

public Centercenter() {

// TODO: Add your code here

final JTextField text=Tool.getinstance().getfield();

this.setLayout(new GridLayout(4,5,3,3));

String arg[] ={"7","8","9","/","4","5","6","*","1","2","3","-","0","=",".","+"};

for(int i=0;i16;i++)

{

final JButton b=new JButton(arg[i]);

//this.add(new JButton(arg[i]));

this.add(b);

if(i==0||i==1||i==2||i==4||i==5||i==6||i==8||i==9||i==10||i==12)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String mark=b.getText();

String ma=text.getText();

if(vc3.contains("v3"))

{

text.setText("0."+mark);

vc3.clear();

}

else if(vc.contains("a"))

{

if(vc2.contains("v2"))

{

text.setText("0."+mark);

vc.clear();

vc2.clear();

}

else

{

text.setText(mark);

vc.clear();

Vec.clear();

Vec.add(mark);

}

}

else

{

text.setText(ma.trim()+mark);

Vec.add(mark);

}

begin="no";

to="yes";

}

});

}

if(i==14)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String mar=b.getText();

String m=text.getText();

if("yes".equals(begin))

{

vc3.add("v3");

}

if(vc1.contains("v1"))

{

vc2.add("v2");

vc1.clear();

}

if(!Vec.contains(".")!vc.contains("a"))

{

text.setText(m.trim()+mar);

Vec.add(".");

}

}

});

}

if(i==15)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

add=Double.parseDouble(ma);

if(what==null)

{

tool=add;

what="add";

}

else

{

tool=tool+add;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="+";

}

});

}

if(i==11)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

jq=Double.parseDouble(ma);

if(what==null)

{

tool=jq;

what="jq";

}

else

{

tool=tool-jq;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="-";

}

});

}

if(i==3)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

cq=Double.parseDouble(ma);

if(what==null)

{

tool=cq;

what="cq";

}

else

{

tool=tool/cq;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="/";

}

});

}

if(i==7)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

cs=Double.parseDouble(ma);

if(what==null)

{

tool=cs;

what="cs";

}

else

{

tool=tool*cs;

text.setText(String.valueOf((tool)));

}

vc.add("a");

vc1.add("v1");

to="*";

}

});

}

if(i==13)

{

b.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String ma=text.getText();

dy=Double.parseDouble(ma);

if(what=="add")

{

jg=String.valueOf((tool+dy));

}

if(what=="jq")

{

jg=String.valueOf((tool-dy));

}

if(what=="cs")

{

jg=String.valueOf((tool*dy));

}

if(what=="cq")

{

jg=String.valueOf((tool/dy));

}

if(what==null)

{

if(to=="+")

{

tool=add;

jg=String.valueOf(tool+dy);

}

else if(to=="-")

{

tool=jq;

jg=String.valueOf(dy-tool);

}

else if(to=="*")

{

tool=cs;

jg=String.valueOf(dy*tool);

}

else if(to=="/")

{

tool=cq;

jg=String.valueOf(dy/tool);

}

else

{

jg=String.valueOf(dy);

}

}

text.setText(jg);

Vec.clear();

Vec.add(".");

vc.add("a");

vc1.add("v1");

what=null;

tool=0;

}

});

}

}

}

}

class Centernorth extends JPanel {

public Centernorth() {

final JTextField text=Tool.getinstance().getfield();

}

}

class Centerpanel extends JPanel {

public Centerpanel() {

this.setLayout(new BorderLayout(8,7));

Centernorth cn=new Centernorth();

Centercenter cc=new Centercenter();

Centerwest cw=new Centerwest();

this.add(cn,BorderLayout.NORTH);

this.add(cc,BorderLayout.CENTER);

this.add(cw,BorderLayout.WEST);

}

}

class Centerwest extends JPanel {

public Centerwest() {

}

}

class Northpanel extends JPanel {

private JTextField tf;

public Northpanel() {

tf=Tool.getinstance().getfield();

this.add(tf);

}

}

------------------------------------------------------------

才子_辉祝您愉快!

怎么样使用自动点击器

详情如下:

1.首先运行软件,可以看到此时“启动”这一项是灰色的,无法打开,我们需要给它设置权限;

2.设置方法也很简单,点击“设置辅助功能权限”,下拉至最底部,找到“自动点击器”,点击进入;

3.点击自动点击器右侧的按钮,打开,提示窗口选择确定;

4.再回到首页,就能看到,“启动”项已经可用了,点击“启动”,打开自动点击器,屏幕左侧会出现相应的控制图标;

求一个鼠标连点器

十六款鼠标连点器哪个好?

1、小贝鼠标连点器1.0

可以自由设置单击鼠标间隔时间及单击方式(左键、中键、右键),只需要将鼠标移动到需要连点的地方,然后按相应热键就可以启动连点了,再按下相应热键停止。使用非常简单!1.0版本开启热键可自定义、使用Skin...

类别:键盘鼠标 大小:362 KB 日期:2013-08-18 [查看详细]

2、雪狼鼠标连点器v3.8

雪狼鼠标连点器将可以解放你的手指啦!只要按下热键,让鼠标自动点击器帮你点击吧!鼠标点击速度可以调节,鼠标左键右键也可以选择。所有游戏通用,最快速度0.1秒点击1次!使用方法超级简单!

类别:键盘鼠标 大小:530 KB 日期:2013-07-21 [查看详细]

3、指尖飞舞鼠标连点器2013.0222

指尖飞舞鼠标连点器,是一款模拟鼠标连续点击的免费软件。使用方便,操作简单。可设置点击次数,和每点击一次的间隔时间。

类别:键盘鼠标 大小:458 KB 日期:2013-02-24 [查看详细]

4、红尘鼠标连点器2.0

应用程序并行配置不正确,无法启动。出现这种问题,通常是由于系统中没有安装VS2008sp1运行时库造成的。这个运行时库通常会随其它大中型软件安装到电脑系统中。如果您的机器刚刚重装完成,则可能出现这个...

类别:键盘鼠标 大小:48.0 KB 日期:2012-12-15 [查看详细]

5、天心鼠标连点器v1.8

使用方法:点击工具栏上的添加按钮,添加要点击的坐标(注:如果添加时不填写横坐标和纵坐标表示该次点击不移动鼠标位置)和次数.然后在热键框按下您需要设置成的启动热键和设定脚本的执行次数(列表所有鼠标点击执...

类别:键盘鼠标 大小:1.10 MB 日期:2012-12-04 [查看详细]

6、香港小包鼠标连点器1.0

香港小包鼠标连点器广泛应用于办公辅助及其它需要使用鼠标自动点击的特殊行业。一提到工作,大家想到的场面就是一个人目不转睛地盯着屏幕,手在不断地点击着鼠标。但是有了香港小包鼠标点击器软件后,游戏玩家将不再...

类别:键盘鼠标 大小:18.0 KB 日期:2012-11-10 [查看详细]

7、名风多功能键盘鼠标连点器1.0

名风多功能键盘鼠标连点器支持鼠标左键单击和右键单击和键盘按键,可以自定义操作快捷键,程序多达30个设置选项自定义鼠标键盘操作,是工作、学习、游戏中不可多得的帮手,并且软件是完全免费使用的!

类别:键盘鼠标 大小:35.0 KB 日期:2012-11-06 [查看详细]

8、鼠标连点器楼月鼠标连点器2.0

楼月鼠标连点器是一款界面简洁,功能实用的鼠标自动点击器软件。该软件能够模拟鼠标左键及右键的自动单击事件。广泛应用于游戏辅助或其它需要用到的鼠标自动点击的特殊行业,将电脑玩家从繁琐的单击操作中解放出来,...

类别:键盘鼠标 大小:18.0 KB 日期:2012-11-03 [查看详细]

9、名风多功能键盘鼠标连点器v1.0

一款多功能键盘鼠标连点工具名风多功能键盘鼠标连点器支持鼠标左键单击和右键单击和键盘按键,可以自定义操作快捷键,程序多达30个设置选项自定义鼠标键盘操作,是工作、学习、游戏中不可多得的帮手,并且软件是完...

类别:键盘鼠标 大小:34.0 KB 日期:2012-10-24 [查看详细]

10、小智鼠标连点器v1.0

小智鼠标连点器是一款很有用的免费小软件,如果你在平时的游戏或是工作中经常需要大量点击鼠标左键或右键,如果你喜欢玩网络游戏,RPG游戏,那么一定有大量点击鼠标的经验,非常浪费时间,浪费精力,消耗鼠标!这...

类别:键盘鼠标 大小:39.0 KB 日期:2012-10-18 [查看详细]

11、清风鼠标连点器1.0

帮您解决某类需要大量鼠标点击的工作,左右键单,左键双击等,若您的工作或游戏需要到大量的鼠标点击工作,这款软件就非常的适合您!纯绿色辅助,非非法外挂(改变网络游戏软件的程序)工具!

类别:键盘鼠标 大小:311 KB 日期:2012-10-14 [查看详细]

12、简单鼠标连点器V1.0

顾名思义,鼠标连点。简单的说就是模拟鼠标单次或多次点击。如果你在平时的游戏或是工作中经常需要大量点击鼠标左键或右键,如果你喜欢玩网络游戏,RPG游戏,那么一定有大量点击鼠标的经验,非常浪费时间,浪费精...

类别:键盘鼠标 大小:334 KB 日期:2012-09-20 [查看详细]

13、绿色鼠标连点器v3.0

绿色鼠标连点器是一个很有用的小软件,如果你在平时的游戏或是工作中经常需要大量点击鼠标左键或右键,如果你喜欢玩网络游戏,RPG游戏,那么一定有大量点击鼠标的经验,非常浪费时间,浪费精力,消耗鼠标!这个小...

类别:键盘鼠标 大小:625 KB 日期:2012-09-11 [查看详细]

14、龙族鼠标连点器下载,鼠标连点器工具

龙族鼠标连点器一款功能简单实用,界面可爱的鼠标连点器工具可以自由设定鼠标连点的间隔时间(1-1000秒)方便你在游戏软件中的鼠标连点重复动作,便捷操作,省时间

类别:键盘鼠标 大小:103 KB 日期:2012-07-23 [查看详细]

15、鼠标连点器1.0[小巧玲珑的鼠标连点器]免费版

一款小巧玲珑的鼠标连点器,支持后台运行,可以满足你工作和游戏上的大部分需求。

类别:键盘鼠标 大小:637 KB 日期:2012-06-20 [查看详细]

16、牢头鼠标连点器1.1 绿色版

鼠标点击速度可以调节,鼠标左键右键也可以选择。这个版本如果要使用F11获取坐标来点击的话,必须勾选“自定义开关”1.1更新内容:优化了代码

类别:键盘鼠标 大小:291 KB 日期:2011-12-19 [查看详细]


分享名称:连点器代码java 连点器编写
当前地址:http://6mz.cn/article/dddhhij.html

其他资讯