java中用swing做一个windows计算器
@
前言:
来看这篇教程估计都是java课程设计吧,现在已经没有公司很少使用swing组件了,java主要还是开发Web方面,可以了解以下swing组件仅此而已。我们这是一个组做的课程设计,一共写了三个:window画板,解码器,计算器,我只写了计算器,所以我将计算器的代码单独发布
主函数
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
class menu_li001 {
public static void main(String[] args) {
menu_li002 li = new menu_li002();
li.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
li.setVisible(true);
li.pack();
li.setSize(600,100);
}
}
class menu_li002 extends JFrame{
static int i;
public menu_li002(){
TextField f1 = new TextField(24);
new Box(BoxLayout.X_AXIS);
JPanel card=new JPanel();
CardLayout Clayout=new CardLayout();
JPanel mi = new JPanel();
JRadioButton choose02 = new JRadioButton("计算器");
JLabel calculter =new JLabel(new ImageIcon("src/calculter.jpg"));
Box h = Box.createHorizontalBox();
Box h1 = Box.createHorizontalBox();
Box vbox = Box.createVerticalBox();
ButtonGroup bg1 = new ButtonGroup();
ButtonGroup bg2 = new ButtonGroup();
ButtonGroup bg3 = new ButtonGroup();
bg2.add(choose02);
h.add(choose02);
h1.add(f1);
vbox.add(h);
vbox.add(h1);
setContentPane(vbox);
mi.add(h);
mi.add(h1);
card.add(mi);
add(card);
choose02.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
f1.setText("你选中:" + choose02.getText());
add(BorderLayout.SOUTH,calculter);
//contentPane.add(calculter);
CacultorL window=new CacultorL();
window.setSize(500,300);
window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
window.pack();
window.setJMenuBar(CacultorL.menuBar);
window.setVisible(true);
bg1.clearSelection();
bg3.clearSelection();
}
});
}
}
打开界面如下图:
普通计数器
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
public class CacultorL extends JFrame implements ActionListener{
JPanel cards;
CardLayout Clayout=new CardLayout();
JPanel cardNorth;
private final String keys[]={"%","√","x^2","1/x","CE","C","<-","/","7","8","9","*","4","5","6","-","1","2","3","+","+/-","0",".","="};
private final String Rom[]={"MC","MR","M+","M-","MS","M"};
private JButton Keys[]=new JButton[keys.length];
private JButton rom[]=new JButton[Rom.length];
static JMenuBar menuBar=new JMenuBar();
JPanel CenterPanel=new JPanel();
JPanel NorthPanel=new JPanel();
JPanel SouthPanel=new JPanel();
JTextField textField=new JTextField(17);
JTextField textFieldUp=new JTextField(17);
private double left;
private double right;
private static double result;
private String Result;
private String temp="";
private static int option;
private static String temp1="";
private static int option1=0;
private static double right1;
public static void main(String[] args) throws IOException {
CacultorL window=new CacultorL();
window.setSize(500,300);
window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
window.pack();
window.setVisible(true);
DataOutputStream dataOutputStream=new DataOutputStream(new FileOutputStream("src/a.dat"));
dataOutputStream.writeDouble(result);
}
public CacultorL() {
// File Datap=new File("DataIn.txt");
// FileWriter in=new FileWriter(Datap);
JMenu fileItem=new JMenu(" 功能菜单");
JMenuItem card1=new JMenuItem(" 科学");
// JMenuItem card2=new JMenuItem(" 标准");
menuBar.add(fileItem);
fileItem.add(card1);
// fileItem.add(card2);
cards=new JPanel();
cards.setLayout(Clayout);
cardNorth=new JPanel();
cardNorth.setLayout(Clayout);
SouthPanel.setLayout(new GridLayout(2,1));
CenterPanel.setLayout(new GridLayout(6,4));
NorthPanel.setLayout(new GridLayout(1,6));
CenterPanel.setPreferredSize(new Dimension(250,150));
NorthPanel.setPreferredSize(new Dimension(350,70));
addRom(Rom);
for(int i=0;i<keys.length;i++) {
addKeys(keys[i],i);
}
SouthPanel.add(textFieldUp);
SouthPanel.add(textField);
add(SouthPanel,BorderLayout.NORTH);
Kcacultor a=new Kcacultor();
// add(a.center1,BorderLayout.SOUTH);
add(NorthPanel,BorderLayout.CENTER);
cards.add(CenterPanel);
cards.add(a.center1);
cardNorth.add(SouthPanel);
cardNorth.add(a.NorthPanel);
//Kcacultor.center1.setBackground(Color.BLACK);
add(BorderLayout.SOUTH,cards);
add(BorderLayout.NORTH,cardNorth);
textField.setHorizontalAlignment(JTextField.RIGHT);
textField.setEditable(false);
textFieldUp.setHorizontalAlignment(JTextField.RIGHT);
textFieldUp.setEditable(false);
card1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Clayout.next(cards);
Clayout.next(cardNorth);
textField.setText("");
textFieldUp.setText("");
temp="";
temp1="";
left=0;
right=0;
}
});
}
public void addKeys(String keys,int i){
Keys[i]= new JButton(keys);
CenterPanel.add(Keys[i]);
Keys[i].addActionListener(this);
}
public void addRom(String Rom[]){
for(int i=0;i<Rom.length;i++){
rom[i]= new JButton(Rom[i]);
NorthPanel.add(rom[i]);
}
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==Keys[8]){
temp+="7";
temp1+="7";
textField.setText(temp);
}else if(e.getSource()==Keys[9]){
temp1+="8";
temp+="8";
textField.setText(temp);
}else if(e.getSource()==Keys[10]){
temp1+="9";
temp+="9";
textField.setText(temp);
}else if(e.getSource()==Keys[12]){
temp1+="4";
temp+="4";
textField.setText(temp);
}else if(e.getSource()==Keys[13]){
temp1+="5";
temp+="5";
textField.setText(temp);
}else if(e.getSource()==Keys[14]){
temp1+="6";
temp+="6";
textField.setText(temp);
}else if(e.getSource()==Keys[16]){
temp1+="1";
temp+="1";
textField.setText(temp);
}
else if(e.getSource()==Keys[17]){
temp1+="2";
temp+="2";
textField.setText(temp);
}
else if(e.getSource()==Keys[18]){
temp1+="3";
temp+="3";
textField.setText(temp);
}else if(e.getSource()==Keys[21]){
temp1+="0";
temp+="0";
textField.setText(temp);
}
if(e.getSource()==Keys[0]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
temp1+="%";
textFieldUp.setText(temp1);
option=2;
option1=0;
}else if(e.getSource()==Keys[23]){
option1++;
if(option==1){
String Right=textField.getText();
right=Double.parseDouble(Right);
result=left+right;
Result=""+result;
if(option1>1){
result=left+right1;
}
Result=""+result;
left=result;
}else if (option==2){
right=Double.parseDouble(textField.getText());
result=left%right;
Result=""+result;
}else if(option==3){
if(option1==1) {
right = Double.parseDouble(textField.getText());
result = left / right;
right1=right;
}
if(option1>1){
result=left/right1;
}
Result=""+result;
left=result;
}else if(option==4){
right=Double.parseDouble(textField.getText());
result=left*right;
Result=""+result;
if(option1>1){
result=left*right1;
}
Result=""+result;
left=result;
}else if(option==5){
if(option1==1) {
right = Double.parseDouble(textField.getText());
result = left - right;
right1=right;
}
if(option1>1){
result=left-right1;
}
Result=""+result;
left=result;
}
try {
DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream("src/a.dat"));
dataOutputStream.writeDouble(result);
//byte[] buffer = new byte[1024];
//dataOutputStream.write(buffer,0,8);
dataOutputStream.close();
} catch (Exception e1) {
e1.printStackTrace();
}
textField.setText(Result);
}else if (e.getSource()==Keys[1]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.sqrt(left);
Result=""+result;
temp1="√("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if(e.getSource()==Keys[2]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=left*left;
temp1="sqr("+temp1+")";
Result=""+result;
textField.setText(Result);
textFieldUp.setText(temp1);
left=result;
}else if(e.getSource()==Keys[3]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=1/left;
Result=""+result;
textFieldUp.setText(Result);
}else if(e.getSource()==Keys[4]){
textField.setText("");
temp="";
temp1="";
left=0;
right=0;
}else if(e.getSource()==Keys[19]){
left=Double.parseDouble(textField.getText());
temp1+="+";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=1;
option1=0;
}else if(e.getSource()==Keys[5]){
textField.setText("");
textFieldUp.setText("");
temp="";
temp1="";
}else if(e.getSource()==Keys[7]){
left=Double.parseDouble(textField.getText());
temp1+="/";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=3;
option1=0;
}else if(e.getSource()==Keys[11]){
left=Double.parseDouble(textField.getText());
temp1+="*";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=4;
option1=0;
}else if(e.getSource()==Keys[15]){
left=Double.parseDouble(textField.getText());
temp1+="-";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=5;
option1=0;
}else if(e.getSource()==Keys[22]){
temp1+=".";
temp+=".";
textField.setText(temp);
}else if(e.getSource()==Keys[6]){
temp1=textField.getText();
temp1=temp1.substring(0,temp1.length()-1);
temp=temp1;
textField.setText(temp1);
}else if(e.getSource()==Keys[20]){
right=Double.parseDouble(textField.getText());
right=-right;
Result=""+right;
textField.setText(Result);
temp1=temp1.substring(0,temp1.length()-2);
temp1+=textField.getText();
}
}
}
界面如下:
科学计算器
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Kcacultor extends JFrame implements ActionListener{
JPanel card=new JPanel();
CardLayout ClayoutNext=new CardLayout();
JPanel CenterPanelk1=new JPanel();
JPanel CenterPanelK2=new JPanel();
JPanel SouthPanel=new JPanel();
JPanel center1=new JPanel();
private double left;
private double right;
private String temp="";
private String temp1="";
private String Result;
private double result;
private int option1=0;
private int option;
private final String keys1[]={"x^2","x^y","sin","cos","tan","√","10^x","log","Exp","Mod"};
private final String keys2[]={"x^3","y√x","arcsin","arccos","arctan","1/x","e^x","In","dms","deg"};
private final String keys3[]={"↑","CE","C","<-","/","Π","7","8","9","*","n!","4","5","6","-","+/-","1","2","3","+","(",")","0",".","="};
private JButton Keys1[]=new JButton[keys1.length];
private JButton Keys2[]=new JButton[keys2.length];
private JButton Keyscenter[]=new JButton[keys3.length];
private static double right1;
JPanel NorthPanel=new JPanel();
JTextField textField=new JTextField(17);
JTextField textFieldUp=new JTextField(17);
// CacultorL b=new CacultorL();
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==Keyscenter[0]){
ClayoutNext.next(card);
}else if(e.getSource()==Keyscenter[6]){
temp+="7";
temp1+="7";
textField.setText(temp);
}else if(e.getSource()==Keyscenter[7]){
temp+="8";
temp1+="8";
textField.setText(temp);
}else if(e.getSource()==Keyscenter[8]){
temp+="9";
temp1+="9";
textField.setText(temp);
}
else if(e.getSource()==Keyscenter[11]){
temp+="4";
temp1+="4";
textField.setText(temp);
}
else if(e.getSource()==Keyscenter[12]){
temp+="5";
temp1+="5";
textField.setText(temp);
}
else if(e.getSource()==Keyscenter[13]){
temp+="6";
temp1+="6";
textField.setText(temp);
}
else if(e.getSource()==Keyscenter[16]){
temp+="1";
temp1+="1";
textField.setText(temp);
}
else if(e.getSource()==Keyscenter[17]){
temp+="2";
temp1+="2";
textField.setText(temp);
}
else if(e.getSource()==Keyscenter[18]){
temp+="3";
temp1+="3";
textField.setText(temp);
}else if(e.getSource()==Keyscenter[24]){
option1++;
if(option==1){
String Right=textField.getText();
right=Double.parseDouble(Right);
result=left+right;
Result=""+result;
if(option1>1){
result=left+right1;
}
Result=""+result;
left=result;
}else if (option==2){
right=Double.parseDouble(textField.getText());
result=left%right;
Result=""+result;
}else if(option==3){
if(option1==1) {
right = Double.parseDouble(textField.getText());
result = left / right;
right1=right;
}
if(option1>1){
result=left/right1;
}
Result=""+result;
left=result;
}else if(option==4){
right=Double.parseDouble(textField.getText());
result=left*right;
Result=""+result;
if(option1>1){
result=left*right1;
}
Result=""+result;
left=result;
}else if(option==5){
if(option1==1) {
right = Double.parseDouble(textField.getText());
result = left - right;
right1=right;
}
if(option1>1){
result=left-right1;
}
Result=""+result;
left=result;
}else if(option==6){
right=Double.parseDouble(textField.getText());
for(int i=0;i<right;i++){
result=left*left;
}
Result=""+result;
left=result;
}else if(option==7){
right=Double.parseDouble(textField.getText());
for (int i=1;i<=right;i++){
left*=10;
}
Result=""+left;
}else if (option==8){
right=Double.parseDouble(textField.getText());
for(int i=0;i<right;i++){
result=Math.sqrt(left);
}
Result=""+result;
}
textField.setText(Result);
}else if (e.getSource()==Keyscenter[4]){
left=Double.parseDouble(textField.getText());
temp1+="/";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=3;
option1=0;
}else if (e.getSource()==Keyscenter[14]){
left=Double.parseDouble(textField.getText());
temp1+="-";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=5;
option1=0;
}else if (e.getSource()==Keyscenter[19]){
left=Double.parseDouble(textField.getText());
temp1+="+";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=1;
option1=0;
}else if (e.getSource()==Keyscenter[9]){
left=Double.parseDouble(textField.getText());
temp1+="*";
textFieldUp.setText(temp1);
textField.setText("");
temp="";
option=4;
option1=0;
}else if(e.getSource()==Keyscenter[1]){
textField.setText("");
temp="";
temp1="";
right=0;
}else if(e.getSource()==Keyscenter[2]){
textField.setText("");
textFieldUp.setText("");
temp="";
temp1="";
}else if(e.getSource()==Keyscenter[3]){
temp1=textField.getText();
temp1=temp1.substring(0,temp1.length()-1);
temp=temp1;
textField.setText(temp1);
}else if(e.getSource()==Keyscenter[5]){
temp+="3.1415926535897";
temp1+="3.1415926535897";
textField.setText(temp);
}else if(e.getSource()==Keyscenter[10]){
try {
left = Double.parseDouble(textField.getText());
result = 1;
for (int i = 1; i <= left; i++) {
result *= i;
}
Result = "" + result;
temp1 = "fact(" + temp1 + ")";
textField.setText(Result);
textFieldUp.setText(temp1);
}catch (Exception p){
textField.setText("溢出");
}
}else if(e.getSource()==Keyscenter[15]){
right=Double.parseDouble(textField.getText());
right=-right;
Result=""+right;
textField.setText(Result);
temp1=temp1.substring(0,temp1.length()-2);
temp1+=textField.getText();
}else if(e.getSource()==Keyscenter[23]){
temp1+=".";
temp+=".";
textField.setText(temp);
}
else if (e.getSource()==Keys1[0]){
left=Double.parseDouble(textField.getText());
//textField.setText("");
temp="";
result=left*left;
temp1="sqr("+temp1+")";
Result=""+result;
left=result;
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys1[5]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.sqrt(left);
Result=""+result;
temp1="√("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys1[1]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
temp1+="^";
textFieldUp.setText(temp1);
option=6;
}else if (e.getSource()==Keys1[2]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.sin(left);
Result=""+result;
temp1="sin("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys1[3]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.cos(left);
Result=""+result;
temp1="cos("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys1[4]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.tan(left);
Result=""+result;
temp1="tan("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys1[6]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=1;
temp1="10^"+temp1;
for(int i=0;i<left;i++){
result*=10;
}
Result=""+result;
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys1[7]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.log(left);
Result=""+result;
temp1="log("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if(e.getSource()==Keys1[8]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
temp1=temp1+"e";
textFieldUp.setText(temp1);
option=7;
}else if(e.getSource()==Keys1[9]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
temp1+="%";
textFieldUp.setText(temp1);
option=2;
option1=0;
}else if (e.getSource()==Keys2[0]){
left=Double.parseDouble(textField.getText());
//textField.setText("");
temp="";
result=left*left*left;
temp1="cube("+temp1+")";
Result=""+result;
left=result;
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys2[1]){
left=Double.parseDouble(textField.getText());
temp="";
temp1=temp1+"yroot";
textFieldUp.setText(temp1);
textField.setText("");
option=8;
}else if (e.getSource()==Keys2[2]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.asin(left);
Result=""+result;
temp1="arcsin("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys2[3]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.acos(left);
Result=""+result;
temp1="arccos("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys2[4]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.atan(left);
Result=""+result;
temp1="arctan("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys2[5]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=1/left;
Result=""+result;
textField.setText(Result);
}else if (e.getSource()==Keys2[6]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.exp(left);
Result=""+result;
temp1="e^"+temp1;
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys2[7]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
result=Math.log(left);
Result=""+result;
temp1="In("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys2[8]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
Result=""+left;
temp1="dms("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}else if (e.getSource()==Keys2[9]){
left=Double.parseDouble(textField.getText());
textField.setText("");
temp="";
Result=""+left;
temp1="degrees("+temp1+")";
textField.setText(Result);
textFieldUp.setText(temp1);
}
}
public Kcacultor(){
card=new JPanel();
card.setLayout(ClayoutNext);
NorthPanel.setLayout(new GridLayout(2,1));
CenterPanelk1.setLayout(new GridLayout(2,5));
CenterPanelK2.setLayout(new GridLayout(2,5));
SouthPanel.setLayout(new GridLayout(5,5));
NorthPanel.add(textFieldUp);
NorthPanel.add(textField);
for(int i=0;i<keys1.length;i++) {
addKeys1(keys1[i],i);
}
for(int i=0;i<keys2.length;i++) {
addKeys2(keys2[i],i);
}
for(int i=0;i<keys3.length;i++) {
addKeys3(keys3[i],i);
}
card.add(CenterPanelk1);
card.add(CenterPanelK2);
SouthPanel.setPreferredSize(new Dimension(250,150));
card.setPreferredSize(new Dimension(250,70));
//CenterPanelk1.setBackground(Color.BLACK);
center1.add(card,BorderLayout.CENTER);
center1.add(SouthPanel,BorderLayout.SOUTH);
center1.setLayout(new GridLayout(2,1));
add(center1,BorderLayout.SOUTH);
//add(card,BorderLayout.CENTER);
textField.setHorizontalAlignment(JTextField.RIGHT);
textField.setEditable(false);
textFieldUp.setHorizontalAlignment(JTextField.RIGHT);
textFieldUp.setEditable(false);
}
public void addKeys1(String keys1,int i){
Keys1[i]= new JButton(keys1);
CenterPanelk1.add(Keys1[i]);
Keys1[i].addActionListener(this);
}
public void addKeys2(String keys2,int i){
Keys2[i]= new JButton(keys2);
CenterPanelK2.add(Keys2[i]);
Keys2[i].addActionListener(this);
}
public void addKeys3(String keys3,int i){
Keyscenter[i]= new JButton(keys3);
SouthPanel.add(Keyscenter[i]);
Keyscenter[i].addActionListener(this);
}
}
通过左上角的功能菜单切换
界面如下:
注意:
如果需要单独的计算器,需要在两个计算器中添加两个输出框,我将显示框放在了主函数中。
java中用swing做一个windows计算器的更多相关文章
- 【Java】Swing实现一个简单的计算器
import javax.swing.*; import java.awt.*; /** * 计算器 * @author paul * 2019.11.25 21:43 * */ public cla ...
- java 使用线程做一个简单的ATM存取款实例.(转)
线程 Thread 类,和 Runable 接口 比较两者的特点和应用领域. 可以,直接继承线程Thread类.该方法编写简单,可以直接操作线程,适用于单重继承情况,因而不能在继承其他类 实现Runn ...
- 用swing做一个简单的正则验证工具
直接上代码吧,因为我对swing也不熟悉,照着API一点点拼出来的. import java.awt.event.ActionEvent; import java.awt.event.ActionLi ...
- 在Java中用正则表达式判断一个字符串是否是数字的方法
package chengyujia; import java.util.regex.Pattern; public class NumberUtil { /** * 判断一个字符串是否是数字. * ...
- Application_Start事件中用Timer做一个循环任务
protected void Application_Start(object sender, EventArgs e) { System.Timers.Timer timer = new Syste ...
- IOS做一个简单计算器
//声明非原创 步骤: 1.打开Xcode,单机Creat a new Xcode project 2.左边选择ios下Application,右边选择single view Application ...
- 做一个WINDOWS下破解WIFI。不须要Linux抓包!
搬家了,没网了. 没有WIFI了! 想破解,只是没有Linux环境,不能抓包!破解! 于是自己动手开工. 在windows 下直接破解.貌似国内 还没看到.假设有了,那么请各位童鞋 提醒一下.赶急 要 ...
- Java Service Wrapper 使用(windows)
1 简介 最近项目中需要做一个Windows系统服务,记录一下使用过程. Java Service Wrapper 可以将Java程序包装成系统服务,这样就可以随着系统的运行而自动运行.J ...
- Swing 是一个为Java设计的GUI工具包
Swing 是一个为Java设计的GUI工具包. Swing是JAVA基础类的一部分. Swing包括了图形用户界面(GUI)器件如:文本框,按钮,分隔窗格和表. Swing提供许多比AWT更好的屏幕 ...
随机推荐
- MySQL松散索引扫描与紧凑索引扫描
什么是松散索引? 答:实际上就是当MySQL 完全利用索引扫描来实现GROUP BY 的时候,并不需要扫描所有满足条件的索引键即可完成操作得出结果. 要利用到松散索引扫描实现GROUP BY,需要至少 ...
- JDK安装遇见的问题及解决方案
问题描述: Jdk安装完成后从新启动电脑,打开eclipse报找 不到JRE或JDK,在cmd中输入 java -version 也不显示JDK信息. 后把JDK配置的环境变量path的JAVA_H ...
- 集成学习之Boosting —— AdaBoost原理
集成学习大致可分为两大类:Bagging和Boosting.Bagging一般使用强学习器,其个体学习器之间不存在强依赖关系,容易并行.Boosting则使用弱分类器,其个体学习器之间存在强依赖关系, ...
- mysql可视化工具下载地址2017.6.27
https://www.baidu.com/s?tn=90117497_hao_pg&usm=1&wd=navicat+for+mysql&ie=utf-8&rsv_r ...
- centos网络配置方法(手动设置,自动获取)
不知道为什么最近一段时间网络特别的慢,还老是断,断的时候,局域网都连不上,当我手动设置一下ip后就可以了,搞得我很无语.下面是2种设置网络连接的方法,在说怎么设置前,一定要做好备份工作,特别是对于新手 ...
- Javascript 设计模式 单例
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/30490955 一直很喜欢Js,,,今天写一个Js的单例模式实现以及用法. 1.单 ...
- 用secureCRT连接虚拟机中的Ubuntu系统,出现“远程主机拒绝连接”错误
因为我的Ubuntu中未安装ssh服务,终端下运行命令: sudo apt-get install openssh-server 之后重启一下sshd服务: sudo service sshd res ...
- 【转】用信鸽来解释 HTTPS
一.引文出处 注:分享交流技术.本文摘自开源中国翻译,翻译者:JonnHuang,句号句号 译文原网址:https://www.oschina.net/translate/https-explaine ...
- Python 可视化工具 Matplotlib
英文出处:Chris Moffitt. Matplotlib是Python中最常用的可视化工具之一,可以非常方便地创建海量类型的2D图表和一些基本的3D图表.本文主要介绍了在学习Matplotlib时 ...
- https://blog.csdn.net/u011489043/article/details/68488459
转自https://blog.csdn.net/u011489043/article/details/68488459 String 字符串常量 StringBuffer 字符串变量(线程安全) ...