JAVA Frame的问题
来源:百度知道 编辑:UC知道 时间:2024/09/13 06:16:00
小弟我刚学JAVA不久...写了几行代码...比较乱...
Frame上面本来是要显示一个JTabbedPane还有里面的table button的...
但是不知道怎么的不显示...麻烦各位帮我看看...比较菜...
public class MainWindow implements ActionListener {
protected JFrame mainframe;
protected JTabbedPane tab;
protected JTable fileTable1, fileTable2, userTable;
protected Container con, con1, con2, usercon, maincon;
protected JButton add, delete, refresh;
public MainWindow() {
mainframe = new JFrame("FSS主窗口");
tab = new JTabbedPane();
userTable = new JTable();
con = new Container();
con1 = new Container();
con2 = new Container();
usercon = new Container();
maincon = new Container();
add = new JButton("添加共享");
delete = new JButton("删除共享");
refresh = new JButton("刷 新");
mainframe.setSize(300, 400);
double lx = Tool
Frame上面本来是要显示一个JTabbedPane还有里面的table button的...
但是不知道怎么的不显示...麻烦各位帮我看看...比较菜...
public class MainWindow implements ActionListener {
protected JFrame mainframe;
protected JTabbedPane tab;
protected JTable fileTable1, fileTable2, userTable;
protected Container con, con1, con2, usercon, maincon;
protected JButton add, delete, refresh;
public MainWindow() {
mainframe = new JFrame("FSS主窗口");
tab = new JTabbedPane();
userTable = new JTable();
con = new Container();
con1 = new Container();
con2 = new Container();
usercon = new Container();
maincon = new Container();
add = new JButton("添加共享");
delete = new JButton("删除共享");
refresh = new JButton("刷 新");
mainframe.setSize(300, 400);
double lx = Tool
把你所有的JContainer都改成JPanel就可以显示出来了。不过里面大小不大对,需要你来改,我不大建议你用这样直接定坐标的方法。
另外,与其写mainframe.addWindowListener(new Exit()); 你可以写mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
class Exit也可以不要了。