java中的问题(这个程序怎么都不能显示)

来源:百度知道 编辑:UC知道 时间:2024/05/27 05:00:54
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

class Number extends JFrame implements ActionListener
{
JButton button1,button2,button3,button4;
JTextField text1,text2,text3;
JLabel feedBack;
public Number(String s)
{
super(s);
setVisible(true);
feedBack=new JLabel("计算",JLabel.CENTER);
button1=new JButton("加");
button2=new JButton("减");
button3=new JButton("乘");
button4=new JButton("除");
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
text1=new JTextField(10 );
text2=new JTextField(10);
text3=new JTextField(10);
Box box1=Box.createHorizontalBox();
box1.add(new JLabel("数字1"));
box1.add(text1);
Box bo

试试这个
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

class Number extends JFrame implements ActionListener
{
JButton button1,button2,button3,button4;
JTextField text1,text2,text3;
JLabel feedBack;
public Number(String s)
{
super(s);
setVisible(true);
feedBack=new JLabel("cal",JLabel.CENTER);
button1=new JButton("+");
button2=new JButton("-");
button3=new JButton("*");
button4=new JButton("/");
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
text1=new JTextField(10 );
text2=new JTextField(10);
text3=new JTextField(10);
Box box1=Box.createHorizontalBox();
box1.add(new JLabel("n1"));
box1.add(text1);
Box box2=Box.createHor