为什么这个Java界面显示不出来
publicclassCountextendsJFrameimplementsActionListener,TreeSelectionListener{privateJT...
public class Count extends JFrame implements ActionListener,TreeSelectionListener
{
private JTree tree;
private JTable table;
private Label start,end;
private TextField startText,endText;
private JButton look,export,print,exit;
private JButton search,search1;
private DefaultTableModel tablemodel;
public Count()
{
super("企业人事信息管理系统【统计报表】");
this.setBounds(20, 20, 950, 500);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//this.addWindowListener((WindowListener) this);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JSplitPane split_h=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
split_h.setDividerLocation(160);
this.getContentPane().add(split_h);
JSplitPane split_v=new JSplitPane(JSplitPane.VERTICAL_SPLIT);
split_v.setDividerLocation(150);
this.getContentPane().add(split_v);
DefaultTreeModel defaultTreeModel = new DefaultTreeModel(root);
tree = new JTree(defaultTreeModel);
tree.setSize(160, 400);
tree.addTreeSelectionListener(this);
split_h.add(this.tree);
split_h.add(split_v);
String[] cols={"rc","c"};
this.tablemodel=new DefaultTableModel(cols,0);
this.table=new JTable(tablemodel);
split_v.add(new JScrollPane(table));
JPanel panel=new JPanel(new FlowLayout());
split_v.add(panel);
this.setVisible(true);
}
public static void main(String args[])
{
new Count();
}
}
程序中间的树是有的,不是因为树的问题 展开
{
private JTree tree;
private JTable table;
private Label start,end;
private TextField startText,endText;
private JButton look,export,print,exit;
private JButton search,search1;
private DefaultTableModel tablemodel;
public Count()
{
super("企业人事信息管理系统【统计报表】");
this.setBounds(20, 20, 950, 500);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//this.addWindowListener((WindowListener) this);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JSplitPane split_h=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
split_h.setDividerLocation(160);
this.getContentPane().add(split_h);
JSplitPane split_v=new JSplitPane(JSplitPane.VERTICAL_SPLIT);
split_v.setDividerLocation(150);
this.getContentPane().add(split_v);
DefaultTreeModel defaultTreeModel = new DefaultTreeModel(root);
tree = new JTree(defaultTreeModel);
tree.setSize(160, 400);
tree.addTreeSelectionListener(this);
split_h.add(this.tree);
split_h.add(split_v);
String[] cols={"rc","c"};
this.tablemodel=new DefaultTableModel(cols,0);
this.table=new JTable(tablemodel);
split_v.add(new JScrollPane(table));
JPanel panel=new JPanel(new FlowLayout());
split_v.add(panel);
this.setVisible(true);
}
public static void main(String args[])
{
new Count();
}
}
程序中间的树是有的,不是因为树的问题 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询