public class ERPFrame extends JFrame {
private JPanel contentPane;
private JTable table;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private JTextField textField_3;
Controller controller;
DefaultTableModel dfm;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ERPFrame frame = new ERPFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public ERPFrame() {
controller = new Controller();
dfm = new DefaultTableModel();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 1123, 730);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
table = new JTable(dfm);
JScrollPane scrollPane = new JScrollPane(table);
table.setBounds(343, 30, 734, 638);
contentPane.add(table, scrollPane);
} //end of constructor
}
我试图JScrollPane
为我的 获得一个JTable
,但没有成功。有人知道我做错了什么吗?我已经尝试了一切,并搜索了大约 3 个小时的问题。添加滚动窗格怎么会这么难?