Questions tagged [abstracttablemodel]

Java abstract class which provides default implementations for most of the methods in the TableModel interface.

294 questions
2
votes
2 answers

Java Swing - Deleting rows from table with AbstractTableModel()

I have a table off AbstractTableModel. The data in the table is stored in a Vector. Now, when I remove a row, I am removing it successfully from the vector, but this is not getting updated in the view i.e. in the GUI. I read elsewhere that I need…
Chaitanya
  • 2,039
  • 4
  • 25
  • 32
2
votes
1 answer

JTable gets wrong value in a List

I have a JTable id member_id amount 20 1 120 19 1 5400 18 2 580 17 3 620 16 2 250 When a row is right…
Yunus Einsteinium
  • 1,102
  • 4
  • 21
  • 55
2
votes
1 answer

Updating Model and JTable with fireTableRowsInserted(int,int)

I'm inserting rows to an Abstract Table Model, and then trying to update the JTable with fireTableRowsInserted(int,int). It doesn`t work, I have tried the other "fire" methods too. The only way I can have the JTable update is by calling repaint() on…
San Mor
  • 133
  • 2
  • 12
2
votes
1 answer

Custom Table Model not working

I wrote a custom table model. The goal of it is to bind values to a list. This list is used throughout the application. If a change is made in the table, anywhere else in the application that change is also reflected. My problem is, my table JTable…
user489041
  • 27,916
  • 55
  • 135
  • 204
2
votes
1 answer

AbstractTableModel setValueAt method not being called

I am trying to set a value in my jtablemodel using the setValueAt method whenever a header is clicked. I currently have a MouseAdapter correctly displaying which column is being clicked on but the board.setValueAt() method is not being called.…
Chad
  • 104
  • 1
  • 2
  • 6
2
votes
3 answers

"key-value" pairs collection maintaining order and retrieving by key and by pair index?

I'd would like to use a collection of "key - value" pairs: Which is the base for a JTable data model (TableModel implementation), so I need to access elements by their index/position (e.g. to implement Object getValueAt(int rowIndex, int…
mins
  • 6,478
  • 12
  • 56
  • 75
2
votes
2 answers

Not able to use a method declared in a class extending AbstractTableModel in JTable UI programming

I am getting the message "method is never used locally" after I've implemented the removeRow method. I am also unable to use/access this method. class TableModel extends AbstractTableModel { private String[] columnNames = {"ID", "Name"}; …
Deniz
  • 253
  • 2
  • 7
  • 12
2
votes
1 answer

How can I make my JTable/TableModel dynamic?

So I'm in a situation where I want to use a JTable that can grow and shrink as per user input. (sort of like how an ArrayList can do that while a regular array can't). But I can't find any AbstractTableModel classes that can do this. Here is an…
u3l
  • 3,342
  • 4
  • 34
  • 51
2
votes
1 answer

Why do JTables make TableModels non serializable when rendered?

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…
Mark W
  • 2,791
  • 1
  • 21
  • 44
2
votes
1 answer

Add row to JTable with AbstractTableModel

I need help at adding a empty row to my JTable. I use a AbstractTableModel for my JTable! I have here a small executable program for you so it is easier to help me. Main Class - TestClass.java package testproject; import…
Gerret
  • 2,948
  • 4
  • 18
  • 28
2
votes
3 answers

How to make a cell behave like it's editable but have it read only?

I have a JTable in which I want the cells to behave the way it behaves when you have the cells editable, but the cells cannot be editable, in other terms, read only. So if I double click on a cell, I should only be able to select text within the…
samwell
  • 2,757
  • 9
  • 33
  • 48
2
votes
1 answer

How to implement multiple line text renderer in JTable

I faced the same problem as mentioned in the following SO question Wrap multiple lines in JTable. and I found Multile cell rendered to do that job. Now my problem is after implementing the cell renderer my cell is not showing wrapped data. I have…
Ashish
  • 14,295
  • 21
  • 82
  • 127
2
votes
2 answers

AbstractTableModel - don't return getRowCount()

here is code where i add table model to my table: table = new JTable(new TerminiTableModel()); scrollPane = new JScrollPane(table); then i made this class TerminiTableModel() and here is just a simple generated code where i want to get column cound…
Mlad3n
  • 133
  • 1
  • 4
  • 14
2
votes
4 answers

java same ArrayList for multiple table model

I am struggling to avoid data duplication with multiple JTable. Basically I have a TableModel which has an arraylist of data and a string[] header. So far nothing new. Now I have another TableModel which has the same arraylist of data BUT a…
2
votes
2 answers

To Display data from text file to JTable

My Text file contain data as: sample.txt MEMHEAD 1 1 NA SetString srcCode MEMHEAD 1 2 NA SetString memIdnum LGLNAME 1 5 NA SetString onmfirst I have created MyClassModel class extending AbstractTableModel as: public class MyClassModel…
Nidhi
  • 217
  • 1
  • 4
  • 14
1 2
3
19 20