(转)为什么水平滚动条显示不了
private JTabbedPane createNavigationPanel() { // 创建导航标签面板的方法 JTabbedPane tabbedPane = new JTabbedPane(); JPanel databasePanel=new JPanel();//人员档案总览 tabbedPane.addTab("人员档案查询",databasePanel); JLabel label=new JLabel("选择查询条件:"); String[] comboboxtitle1={"姓名","性别","出生日期","籍贯","家庭住址"}; String[] comboboxtitle2={"等于","包含"}; JComboBox conditionBox1=new JComboBox(); conditionBox1.setModel(new DefaultComboBoxModel(comboboxtitle1)); JComboBox conditionBox2=new JComboBox(); conditionBox2.setModel(new DefaultComboBoxModel(comboboxtitle2)); JTextField textfield=new JTextField(10); JButton buttonSelect=new JButton("查询"); JButton buttonShowAll=new JButton("显示全部数据"); databasePanel.add(label,BorderLayout.NORTH); databasePanel.add(conditionBox1,BorderLayout.NORTH); databasePanel.add(conditionBox2,BorderLayout.NORTH); databasePanel.add(textfield,BorderLayout.NORTH); databasePanel.add(buttonSelect,BorderLayout.NORTH); databasePanel.add(buttonShowAll,BorderLayout.NORTH); String[] tableHead={"人员代码","姓名","性别","出生日期","身份证号","籍贯","家庭住址","联系电话","备注"}; DefaultTableModel defaulttablemodel=new DefaultTableModel(); defaulttablemodel.setColumnIdentifiers(tableHead); DefaultTableColumnModel defaulttablecolumnmodel=new DefaultTableColumnModel(); JTable databaseTable=new JTable(defaulttablemodel); databaseTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); databaseTable.setEnabled(false);//设置JTable无法修改 JScrollPane sDatabaseTable=new JScrollPane(databaseTable); databasePanel.add(sDatabaseTable,BorderLayout.CENTER); JPanel changePanel=new JPanel();//人员档案增加、删除、修改 tabbedPane.addTab("人员档案管理",changePanel); return tabbedPane; }