An implementation of the TableModel interface. Used (by default) by JTable to manage the data found in the table. Custom/alternative implementations of the TableModel interface may be provided.
Questions tagged [defaulttablemodel]
370 questions
0
votes
2 answers
Swing - invisible column throwing exception when accessing
Background
I have a JTable called table, and I have a column that is not part of the DefaultTableModel so its invisible:
final JTable table = new JTable(new DefaultTableModel(new Object[]{"Title", "Artist",
"Album", "Time"}, 0)
I add the respective…

Cobbles
- 1,748
- 17
- 33
0
votes
2 answers
Multiple object in a single JTable cell
Is it possible to have multiple objects inside one JTable cell looking like this where I have two JLabels in each cell on the first row?
The problem I am having in this example is that I can't add any listeners to any JLabels(Icons). My guess is…

Grains
- 950
- 3
- 16
- 35
0
votes
1 answer
Updating JTable issue
I have created a JTable table
String[] ColumnNames = { "Name" , "Father Name", "D.O.B" };
Object[][] data;
DefaultTableModel model = new DefaultTableModel(data, columnNames);
JTable table = new JTable(model);
JScrollPane pane = new…

Haris Mehmood
- 854
- 4
- 15
- 26
0
votes
1 answer
TableModel RemoveRow() removing wrong row if JTable is sorted
When I remove the selected rows from the JTable its working fine but if I sort the row in some order then its tblModel.removeRow() is removing the row in wrong order.
Please help.Thanks.
//Storing the selectedrows into rows[]
int[] rows =…

BulletProof47
- 54
- 1
- 10
0
votes
3 answers
JTable and DefautlTableModel not refreshing
MyTableModel extends DefaultTableModel, everything looks and works correctly.
I have one editable column, and the setValueAt() is being called, and the database updated.
However the table itself is not being refreshed ?
I override, getColumName(),…

NimChimpsky
- 46,453
- 60
- 198
- 311
0
votes
1 answer
adding rows in a table from another form in netbeans
I've got these two forms: 'Fashion and footwear' and 'Shopping Cart' in NetBeans. The first form contains 4 buttons. The other contains two tables CurrentPurchases and PreviousPurchases. When any button is clicked from the first form, the item name…

LuluLala
- 25
- 2
- 9
0
votes
1 answer
How to convert JTable Vector to JTable ArrayList?
How can I convert JTable Vector to JTable ArrayList? I changed all vector to arraylist, but I see some issue in calling DefaultTableModel. I have problem in converting the ArrayList to 2D array. Please help.
Here is my code:
String headers[] =…

Arun Reddy
- 1
- 1
0
votes
1 answer
Set JTable selectable but not editable
i'd like to set my JTable selectable but not editable.
What is the best way to do this in my code?
DefaultTableModel table = toernooi.getToernooien();
tbl_toernooi.setModel(table);
tbl_toernooi.setRowSelectionAllowed(true);

Jelle Siderius
- 176
- 12
0
votes
1 answer
Why JTable doesn't show any data stored in DefaultTableModel?
this is my Controller (read data from model and assign these data to JTable object and MedalTableModel obejest in Class view).:
public class TableController {
private TableModel table_model;
private TableView table_view;
public…

chygo
- 366
- 2
- 6
- 16
0
votes
1 answer
Why won't JTable with DefaultTableModel Refreshed?
basically what i am trying to do is, i have a JList which contain a list of available drive, if one of that drive selected by user then i will show all html files which located in selected drive in a JTable, so i put an event listener for my JList…

NomNomNom
- 811
- 3
- 12
- 37
0
votes
1 answer
Clearing row of data from jTable
So im trying to clear a row of data in a jTable, but when i get to the last row and clear it, it clears... but gives me an error " Row index out of range" need help please :D
//Get table model.
DefaultTableModel model =…

S. Haddad
- 15
- 1
- 9
0
votes
2 answers
DafaultTableModel reading in from a file to setValueAt(value, row, col) Java
I am using a DefaultTableModel to display a simple user stats page. I have successfully saved the data to a file but am having trouble reading it back in (seeloadData()method down the bottom). So, what I need it to do is, when I start my program, it…

Ange King
- 147
- 1
- 2
- 12
0
votes
2 answers
setValueAt(Object aValue, int row, int col)
I am trying to change a value in the Object[][] data in a defaultTableModel but I am getting a nullpointerexception at if (data[i][j] == userFolderName)I have tried changing the variable to "Kathy" just in case it wasn't reading the userName…

Ange King
- 147
- 1
- 2
- 12
0
votes
2 answers
addRow to DefaultTableModel in a separate class Eclipse
I have created a DefaultTableModel that is showing a very basic user league table in a JTabbedPane.
I want to add a row using some data I collect from a different class. This code will not run but here is a sample:
import javax.swing.JPanel;
import…

Ange King
- 147
- 1
- 2
- 12
0
votes
2 answers
Transferring information from Database to a JTable
I'm trying to come up with a way to transfer data from a Database to a JTable,
At first i was thinking to do it using a ResultSet into a Vector into a DefaultTableModel, because DefaultTableModel takes only a Vector,
But later as i read it seems…

Dani Gilboa
- 599
- 4
- 13
- 30