Questions tagged [defaulttablemodel]

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.

370 questions
3
votes
1 answer

Inserting a new row after adding a new column to jTable gives array out of bound exception

I have created a JTable using following code. Then i add two new columns. Then after making the row count zero, when i try to add a new row to the table i get array out of bound exception. Please help. //creating table structure jTable2 = new…
Rajind Ruparathna
  • 2,215
  • 24
  • 55
3
votes
2 answers

Preventing TableCellEditor to show Class' descriptor

I'm getting a strange bug. I have my song's list on the right side of a JFrame. When I click once on any item it does what i want: set color to Gray. But on double click it shows the Class' descriptor of my Custom table cell. When I click once…
Ján Srniček
  • 505
  • 1
  • 10
  • 34
3
votes
1 answer

Java add/remove row to JTable?

I am trying to figure out how to add and remove rows from a JTabel. I want to remove rows based on the first column which is a unique ID. I am currently creating my table like this: String[] colName = new String[] { "ID#",…
Alosyius
  • 8,771
  • 26
  • 76
  • 120
3
votes
1 answer

Insert data from jTable into Database

I am trying to save some JTable Data into Database: My code is like this: public void save(){ String invSL = new Mixed_Calculation().invoice_Sl(); jTextField6.setText(invSL); int rows = jTable1.getRowCount(); for(int row = 0; row
Pranjal Choladhara
  • 845
  • 2
  • 14
  • 35
3
votes
1 answer

Selected Cell in a JTable Does Not Refresh

I am writing a class to track threads and display the status/progress in a JTable. What I had in mind was a JTable where all the necessary status/buttons/etc. were laid out in one column, one thread per row. I used a cell editor to get clickable…
3
votes
1 answer

jTable not showing anything after grabbing data from database

I have been trying to get data from my Derby database and populate a jTable created by the Netbeans GUI builder. I have an account class where the following code is kept: public static DefaultTableModel buildTableModel() throws SQLException { …
John Vasiliou
  • 977
  • 7
  • 27
  • 48
3
votes
1 answer

Java, string instead of double after editing cell in TableModel

I import a CSV file into a DefaultTableModel, one column is formatted as double, so far so good. But if I edit a cell from this column (double) in the JTable, after that this cell is no longer a double. Now it is a string. How can I change the type…
saduino
  • 65
  • 1
  • 5
3
votes
1 answer

Java JTable vector with objects filling

I've been trying to fill a JTable for about three days. All I need to do is fill a vector of vectors with "Artikel" objects, fill a header vector and bind these two vectors to a JTable. I could manage this with using a custom AbstractTableModel but…
Korki Korkig
  • 2,736
  • 9
  • 34
  • 51
3
votes
2 answers

DefaultTableModel make cell not editable JTable

I have an JAVA project and want to make my JTable with a DefaultTableModel non-editable. I know a work-around to do this, called: JTable table = new JTable(...){ public boolean isCellEditable(int row, int column){ return false; } }; …
Dave
  • 77
  • 1
  • 2
  • 10
3
votes
2 answers

JTable: sorting by Integer

I have a JTable, and i want to sort rows sometimes by integer (size column), sometimes by String (file path). So i searched it on google and i've arrived here. i've known that i've to override a method of DefaultTableModel, called getColumnClass. So…
FrancescoN
  • 2,146
  • 12
  • 34
  • 45
3
votes
2 answers

refresh java program at running time

I have java program doing that : fetching data from database and append them into JTable. when I add data into database, I cant refresh JTable to view the new data and I should to close program and run it again. how can I refresh/reload the program…
user1625324
  • 93
  • 1
  • 1
  • 7
3
votes
1 answer

JTable doesn't show new model after adding new row

I can't repaint my jTable. I must re-run all application to show addRow. This is the code: MainPage.java http://pastebin.com/6FZL1pKC public class Mainpage2 extends javax.swing.JFrame { public static DefaultTableModel tripModel; /** * Creates new…
Gorgo
  • 456
  • 1
  • 7
  • 19
3
votes
2 answers

How to update jtable in runtime?

I am new to JTable. I want to update the jtable data at runtime in button press event. Here is my code. import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; import…
Babu R
  • 1,025
  • 8
  • 20
  • 40
2
votes
4 answers

How to insert a column at a specific position in JTable

I have a JTable with a predefined model how to ask the model to insert a specific column in a specific position ? so i want something like : DefaultTableModel.insertRow(int,Object[]) for columns
MhdSyrwan
  • 1,613
  • 3
  • 19
  • 26
2
votes
1 answer

TreeModelListener not responding to changes in TreeModel which it subscribes to

I'm having some bother understanding why I cannot get a TreeModelChanged listener to respond to changes in the model which it subscribes to. I have managed to reproduce the problem in a small example. The SysOut message does not print to the console…
8bitjunkie
  • 12,793
  • 9
  • 57
  • 70
1
2
3
24 25