谁能帮我挑挑这个java程序

来源:百度知道 编辑:UC知道 时间:2024/05/25 09:35:21
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;

public class SimpleFrame extends JFrame{
public SimpleFrame(int width,int height){
setSize(width,height);
setTitle("ͨѶ¼");
Dimension screenSize=kit.getScreenSize();
int x=(screenSize.width-width)/2;
int y=(screenSize.height-height)/2;
setLocation(x,y);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
try{
jbInit();
}
catch(Exception e){
e.printStackTrace();
}
private void jbInit() throws Exception{
Container contentPane=getContentPane();
contentPane.setLayout(new FlowLayout());
JButton1 jb=new JButton1();
JButton1.setActionCommand("Ôö¼Ó");
JButton1.addActionListener(this);
contentPane.add(JButton1,new XYConstraints(350,260,20,10));
JButton2=

1。。。
try{
jbInit();
}
catch(Exception e){
e.printStackTrace();
}
没有写在方法里面
2。。。还有个 就是上面的朋友提到的
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 改成这样
3。。。
jbutton定义错误
jlable 定义错误

Dimension screenSize=kit.getScreenSize();
如果没有漏看,这里就是错的。
Toolkit.getDefaultToolkit().getScreenSize()

觉得没有什么错的啊
怎么了,那里不对吗?