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
1 answer
DefaultTableModel - Deleting row updates Vector, adding does not
So here's the thing. I have a JTable in my frame displaying some data that can be edited. New rows can be added, old rows can be removed.
Now, if I start with a table populated with some data, it works fine. I'm able to delete rows, and that also…

Karan Goel
- 1,117
- 1
- 12
- 24
0
votes
1 answer
How to add multiple items to the DefaultComboBoxModel
I have the following code but I don't know how to add all of the items to my combobox.
DefaultTableModel rs = MyDB.DataTable("SELECT `Activity` FROM `transactions` WHERE `Group` = '" + Gname.getText()+ "' OR `Group` = 'ALL'");
DefaultComboBoxModel…

kelvzy
- 913
- 2
- 12
- 19
0
votes
1 answer
JTable in Netbeans
I want to add db(MySql) data to a single specific column in jTable when there is three columns. From this below coding the data automatically add to the 1st column, but I want to add it to the 2nd column in Jtable. Please help me ..i'm new to…

ramindusn
- 53
- 5
0
votes
1 answer
Display output in the next two columns of DefaultTableModel
sorry I am newbie to Java, I am trying to get values from Transaction table in my database which contains set_ID , Buying_Rate and Selling_Rate. I only want to show Buying_rate and Selling_rate from the Transaction table. I want to display…

mohamed nur
- 331
- 1
- 15
0
votes
1 answer
Saving JTable edits to two dimensional Array
I have a JTable whose cells are editable. However if i edit a cell and refresh the table. The changes are not saved. This is how i have defined the table:
String [] columnNames = {"Application number",
"Name",
…

Hoggie1790
- 319
- 2
- 7
- 19
0
votes
3 answers
Java JTable not showing all rows from MySQL
I have a problem of JTable, that is when more then 1 rows are returned from MySQL table the JTable shows up only 1 record - (the last one), but when I try simple System.out.print it shows all records.
Heres my code:
System.out.println("MySQL…

Jaskaran S.P
- 1,055
- 2
- 14
- 15
0
votes
1 answer
Change TableModel structure
so the scenario is that I've got a JTable with a number of JComboBox's as cells. On the selection of an element of a JComboBox, there needs to be a change in the structure of the Table Model. I've also got an 'output table' below which listens to…

TheRealJimShady
- 3,815
- 4
- 21
- 40
0
votes
1 answer
java.lang.NullPointerException on DefaultTableModel getModel()
I have made a JTable with DefaultTableModel, I add data inside and everything, but when I try to retrieve it I get NullPointerException here:
DefaultTableModel dm = (DefaultTableModel)finishedSaleTable.getModel();
private DefaultTableModel…

Nikola
- 2,093
- 3
- 22
- 43
0
votes
1 answer
Existing posts keep on re-add upon deletion of selected row in jTable
I try to refresh the data of jTable upon deletion of selected row. Here are my codes to set up table :
private JTable getJTableManageReplies() {
jTableManageReplies.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
…

Newbies
- 13
- 5
0
votes
1 answer
Combining two different jTables and adding button into jTable
I try to do for forum using java swing. Here are my codes for table :
public void SetUpJTable() {
DefaultTableModel tableModel = (DefaultTableModel) jTable.getModel();
String[] data = new String[4];
db.setUp("IT Innovation…

It newbie
- 9
- 4
0
votes
1 answer
Removing multiple items from a Java JTable
So I have a default table model that is populated by an Object I created. One of the Objects is Name, with three other string properties of the object. I have a button that performs an action, now when this button performs this action I need to…

yams
- 942
- 6
- 27
- 60
0
votes
1 answer
DefaultTableModel is saving to a file but how can I load the file to use it again?
I'm trying to save the contents of a JTable to a file and then open the file when needed to bring up the original JTable. I am using the DefaultTableModel to add rows and columns to the JTable so I decided to save my model to a file. Here is my…

Giga Tocka
- 191
- 3
- 3
- 11
0
votes
1 answer
Why can't I use DefaultTableModel? Am I missing something Obvious? (Java)
Here is my code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Test{
static CardLayout cardLayout;
static JPanel card = new JPanel();
public static void main(String[] args) {
…

Giga Tocka
- 191
- 3
- 3
- 11
0
votes
3 answers
JTable data only shown after scrolling
I wrote a method, that creates my DefaultTableModel and there I'm going to add my records.
When I set the model to my JTable, the data rows are blank. After scrolling the data gets displayed correct.
How can I avoid this and display the data from…

Christian 'fuzi' Orgler
- 1,682
- 8
- 27
- 51
0
votes
1 answer
when i click the << button ; it gives ArrayIndexOutOfBounds exception
I want that on selecting content from jtable2 and clicking >> it pases onto jtable3 and on clicking << the selected row in Jtable3 gets deleted but when i click the << button ; it gives aaray out of index error; i want that in jtabel3 on clicking <<…

user1711389
- 19
- 1