abstracttablemodel

JTable#repaint() not functioning as expected [closed]

回眸只為那壹抹淺笑 提交于 2020-01-07 05:10:49
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . This application pulls data from a text file and inserts it into JTable . An Observer is attached to check every 300 ms if there is a change to the file

Unable to set a DefaultTableModel to a JTable contained in a JDialog

徘徊边缘 提交于 2019-12-25 19:37:24
问题 I have created a JDialog that contains a JTable, when I try to assign a DefaultTableModel to it, it gives me an exception and the JDialog does not even appear. java.lang.ArrayIndexOutOfBoundsException: 11 . Code to assign the table model: jTable1.setModel(new BomModel(GetBomForSetupMaterial.getPartPositionList())); My AbstractTableModel class: public class BomModel extends AbstractTableModel { private static List<JPartPosition> partPositionList = new ArrayList<JPartPosition>(); private String

Extends AbstractTableModel and populate jTable dynamically

百般思念 提交于 2019-12-25 09:40:13
问题 Basically, I'm working on a Client Server Architecture so Objects can be modified externally by some Clients. I have a bank : public class Bank{ private List<BankingOperation> operationList = new ArrayList<BankingOperation>(); public void addOperation(BankingOperation op) { this.operationList.add(op); //... } And my Server : public class ServerBank extends JFrame { private Bank bank; private JTable table; private OperationTableModel model; public ServerBank() { this.bank = new Bank(); this

Extends AbstractTableModel and populate jTable dynamically

假如想象 提交于 2019-12-25 09:40:08
问题 Basically, I'm working on a Client Server Architecture so Objects can be modified externally by some Clients. I have a bank : public class Bank{ private List<BankingOperation> operationList = new ArrayList<BankingOperation>(); public void addOperation(BankingOperation op) { this.operationList.add(op); //... } And my Server : public class ServerBank extends JFrame { private Bank bank; private JTable table; private OperationTableModel model; public ServerBank() { this.bank = new Bank(); this

Refreshing JTable when data has changed

廉价感情. 提交于 2019-12-25 08:57:29
问题 I have a problem with refreshing a JTable . I start with an empty ArrayList and after setting my choice of a combo box I load content to the ArrayList but JTable does not react to it - it remains empty. Is it a problem with a TableModel ? This is my code... public class ProjectTableModel extends AbstractTableModel{ private static final long serialVersionUID = 1L; private static ArrayList<String> caseList = new ArrayList<String>(); @Override public int getColumnCount() { return 1; } @Override

Update JTable after delete or insert

风格不统一 提交于 2019-12-24 18:25:15
问题 I have a JTable that is populated by an Access DB using a ResultSet & AbstractTableModel . I have a method that deletes the record from the DB correctly but am having trouble refreshing the current view of the table model. I've looked at similar posts and have tried using fireTableRowsDeleted and fireTableDataChanged but have had no luck. I also noticed that other posts mention the use of the DefaultTableModel as it has add/remove row methods but the code I have working is from my Java

Update JTable after delete or insert

随声附和 提交于 2019-12-24 18:24:01
问题 I have a JTable that is populated by an Access DB using a ResultSet & AbstractTableModel . I have a method that deletes the record from the DB correctly but am having trouble refreshing the current view of the table model. I've looked at similar posts and have tried using fireTableRowsDeleted and fireTableDataChanged but have had no luck. I also noticed that other posts mention the use of the DefaultTableModel as it has add/remove row methods but the code I have working is from my Java

Get row values of ticked checkbox in jtable

你离开我真会死。 提交于 2019-12-24 15:33:38
问题 class TableModel extends AbstractTableModel { Object rowData[][] = DataAccess.getSentences(); String columnNames[] = {"Category", "Sentences", "Boolean"}; public int getColumnCount() { return columnNames.length; } public String getColumnName(int column) { return columnNames[column]; } public int getRowCount() { return rowData.length; } public Object getValueAt(int row, int column) { return rowData[row][column]; } public Class getColumnClass(int column) { return (getValueAt(0, column).getClass

Reading data from CSV file and displaying it in a JTable

这一生的挚爱 提交于 2019-12-23 11:59:26
问题 I am trying to read data from a CSV file and display it on a JTable but i have a few problems. I am a noob so please bear with me. I have looked at and incorporated example code from several sources but to no avail. The table shows but it is blank. I know i am reading the data because i can print it. I suspect there is something wrong with my ModelTable setup. Any help would be greatly appreciated. package t1data; import java.util.*; import java.awt.event.*; import javax.swing.*; import java

Why do JTables make TableModels non serializable when rendered?

人盡茶涼 提交于 2019-12-22 14:42:04
问题 So recently I was working on an a tool for us here to configure certain applications. It didn't need to be anything really awesome, just a basic tool with some SQL script generation, and creating a couple of XML files. During this I created a series of JTable objects with my own implementation of the AbstractTableModel. After I had built everything, and got to the point where I was testing saving and loading using the AbstractTableModel (just written to disk using the ObjectStreamWriter)