码迷,mamicode.com
首页 > 其他好文 > 详细

密码

时间:2014-05-06 18:10:07      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:class   java   ext   get   int   string   

import java.awt.*;
import javax.swing.*;
class CalButtonPane extends JPanel {
String[] keys = {"/","9","3","6","x","?","1",
"7","2",",","!","5","0","4",".",":","@","8","4",".","abc","中","五","拼","www"};
JButton[] keyb = new JButton[keys.length];
//JTextField t;
//JButton clear;
//double result = 0, value;
int i=0, j=0, l, math;
CalButtonPane(JTextField t){
super(new GridLayout(5, 5, 4, 4));
//this.t = t;
for( int i = 0; i <keys.length; i++ ) { keyb[i] = new JButton(keys[i]);
this.add(keyb[i]);
}
//clear = new JButton("Clear");
}
}
class Calculator extends JFrame {
JPanel p;
JTextField t;
CalButtonPane cp;
public Calculator() {
super("Java计算器");
setDefaultCloseOperation(EXIT_ON_CLOSE );
calInit();
Container cc = getContentPane();
cc.setLayout( new BorderLayout() );
//cc.add(t, "North" );
cc.add(cp, "Center" );
//cc.add(cp.clear, "South" );
this.setLocation(350, 250);
this.pack();
this.setResizable(false);
this.setVisible(true);
}
void calInit(){
t=new JTextField("0.0");
t.setHorizontalAlignment(JTextField.RIGHT);
cp=new CalButtonPane(t);
}
public static void main( String[] args ) {
new Calculator();
}
}

密码,布布扣,bubuko.com

密码

标签:class   java   ext   get   int   string   

原文地址:http://www.cnblogs.com/lpjia/p/3712073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!