用Java编计算器.请高手帮我把剩下的代码补上!
我只做了个界面...
还有显示数字的文本框不会写..
import javax.swing.*;
import java.awt.*;
public class Sunwy extends JFrame{
public Sunwy(){
super( "袖珍计算器 ");
}
public static void main(String[] args){
Sunwy s1 = new Sunwy();
Container s1Container = s1.getContentPane();
s1Container.setLayout(null);
JLabel jL1 = new JLabel( "版本号:V1.0 ");
jL1.setBounds(280,140,100,10);
s1Container.add(jL1);
JButton jB1 = new JButton( "1 ");
jB1.setBounds(10,10,41,30);
s1Container.add(jB1);
JButton jB2 = new JButton( "2 ");
jB2.setBounds(50,10,41,30);
s1Container.add(jB2);
JButton jB3 = new JButton( "3 ");
jB3.setBounds(90,10,41,30);
s1Container.add(jB3);
JButton jB4 = new JButton( "4 ");
jB4.setBounds(10,50,41,30);
s1Container.add(jB4);
s1.setSize(400,200);
JButton jB5 = new JButton( "5 ");
jB5.setBounds(50,50,41,30);
s1Container.add(jB5);
JButton jB6 = new JButton( "6 ");
jB6.setBounds(90,50,41,30);
s1Container.add(jB6);
JButton jB7 = new JButton( "7 ");
jB7.setBounds(10,90,41,30);
s1Container.add(jB7);
JButton jB8 = new JButton( "8 ");
jB8.setBounds(50,90,41,30);
s1Container.add(jB8);
JButton jB9 = new JButton( "9 ");
jB9.setBounds(90,90,41,30);
s1Container.add(jB9);
JButton jB10 = new JButton( "+ ");
jB10.setBounds(135,10,45,30);
s1Container.add(jB10);
JButton jB11 = new JButton( "- ");
jB11.setBounds(185,10,45,30);
s1Container.add(jB11);
JButton jB12 = new JButton( "× ");
jB12.setBounds(135,50,45,30);
s1Container.add(jB12);
JButton jB13 = new JButton( "÷ ");
jB13.setBounds(135,90,45,30);
s1Container.add(jB13);
JButton jB14 = new JButton( "C ");
jB14.setBounds(185,50,45,70);
s1Container.add(jB14);
s1.setVisible(true);
}
}
------解决方案--------------------无语
------解决方案--------------------哇 好nb啊~~~
还版本号1.0
------解决方案--------------------楼上的别作无聊的回答.