0
我無法找到將數據插入我的JTable中的JPanel的方法。 任何人都可以幫我弄明白嗎?我做錯了什麼?將數據插入JTable中的JPanel - JAVA
這裏是我的代碼:
JTabbedPane tabProcessamentoSalarial = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.addTab("Remunera\u00E7\u00F5es", null, tabProcessamentoSalarial, null);
JPanel pnlAcumulados = new JPanel();
tabProcessamentoSalarial.addTab("Acumulados", null, pnlAcumulados, null);
pnlAcumulados.setLayout(null);
table_1 = new JTable();
table_1.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
table_1.setBounds(46, 36, 508, 160);
pnlAcumulados.add(table_1);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(46, 36, 508, 160);
pnlAcumulados.add(scrollPane);
tblAcumulados = new JTable();
tblAcumulados.setBounds(46, 36, 508, 160);
tblAcumulados.setModel(new DefaultTableModel() {
String[] columnNamesRui = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
Object[][] dataRui = {
{"Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false)},
{"John", "Doe", "Rowing", new Integer(3), new Boolean(true)},
{"Sue", "Black", "Knitting", new Integer(2), new Boolean(false)},
{"Jane", "White", "Speed reading", new Integer(20), new Boolean(true)},
{"Joe", "Brown", "Pool", new Integer(10), new Boolean(false)}
};
}
);