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
-1
votes
1 answer
Final row in a Jtable can not be removed
I have the following code, that allows me to remove a row from the right Jtable with a click. It works fine for all the rows, except when there is only one row remaining. BTW, sorry for most names being in portuguese, its my native language. Here…

Salomão Andrade
- 1
- 2
-1
votes
2 answers
Insert values from ArrayList into a JTable
public void populateJTable() {
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
Object[] rowData = new Object[4];
TrackService ts = new TrackService();
ArrayList

Lewball
- 1
- 1
- 1
-1
votes
1 answer
Unable to add row in default table model
I am trying to populate data in a JTable with a DefaultTableModel from a MySQL database using the addRow function but somehow it's not working. The data is not getting populated in the table model. I am sharing my code please help me with…

Shruti Sawant
- 1
- 3
-1
votes
1 answer
Get index row of String date greater than 30 days JTable
My problem is that I have a JTable with 2 vector data for data & column names respectively,
Vector rowOne = new Vector<>();
rowOne.addElement("Harry");
rowOne.addElement("100414");
rowOne.addElement("21");
rowOne.addElement("239438");…

Cohen
- 79
- 1
- 9
-1
votes
1 answer
Add a checkbox to a JTable which has been generated from a CSV
I have a function which loops through a CSV file, and generates a DefaultTableModel of the data (which is then displayed in a JTable). This function is:
public DefaultTableModel createTableModel(Reader in, Vector

Dhruv Ghulati
- 2,976
- 3
- 35
- 51
-1
votes
1 answer
Unable to set a DefaultTableModel to a JTable contained in a JDialog
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…

David A.
- 83
- 1
- 15
-1
votes
2 answers
Re Use of DefaultTableModel
DefaultTableModel dtm = new DefaultTableModel(new Object[]{"SR#", "Date", "Name", "Description", "Quantity", "Weight", "Rate", "Total", "Balance","Paid","Net Pay"},0);
table = new JTable();
table.setModel(dtm);
…

Umair7
- 11
- 7
-1
votes
2 answers
Taking data from Mysql to JTable in JAVA
I am trying to have information in my Jtable and reading the info from mysql and it looks like am the era comes from this segment as I can see am stuck , I dont know what to do, Now I have a DefaultTableModel which defines the methods JTable will…

user4858328
- 21
- 5
-1
votes
1 answer
Add "setRowColor" Method to DefaultTableModel
I want to extend the DefaultTableModel class with a function that let's me set the color of a specific row. So lets say I have a table with 30 rows and want to color row 12 in red.
I want to invoke a function like:
JTable table = new…

Flatron
- 1,375
- 2
- 12
- 33
-1
votes
1 answer
Java Swing - Unable access jTable from different function
I've created jTable as per below:
public void refTable(String jobNo) {
Report rp = new Report();
final String noJob = jobNo;
Map jMap = rp.getReportInfo(jobNo);
Map sortedMap =…

chinna_82
- 6,353
- 17
- 79
- 134
-1
votes
1 answer
Displaying data in JTable from oracle database
I m retriving an oracle table and displaying it in jtable.. This is d first time i m using jtable so i dont kno anything. i did my research and tried different methods but i cudnt underatsnd properly..
Its not displaying the data in jtable.
…

pooja singh
- 15
- 1
- 2
- 6
-1
votes
1 answer
Can I define size for DefaultTableModel?
I'm using model, that I could refresh content of table? But I addedd it to a JPanel, and now my second JPanel, which contans button, goes very deep. I'm using GridLayout for controling size of column(preferredSize()). At start I have…

usr999
- 157
- 2
- 7
- 20
-1
votes
2 answers
Unable to perform algorithm and update table
Theres no error when run , but my event_ID is 1,2,3,4,5,6 but the console displays
UPDATE crossEvent SET event_Seat = '10' WHERE event_ID =0
and my event_Seat which was 20 did not update to 10 due to the difference in event_ID
public…

user1976307
- 1
- 1
-1
votes
1 answer
Why is my DefaultTableModel empty after addRow Object[]?
I'm trying to populate my DefaultTableModel by first taking a populated List collection and then converting them to an array of Object.
The problem begins when I addRow(Object[]) into DefaultTableModel. It always comes up empty. To be more precise,…

Ludwi
- 437
- 4
- 8
-1
votes
1 answer
ArrayOutOfBoundException when populate result in jTable
I tried to do a search system using java swing :
public void search(ActionEvent e){
String textEntered=getJTextField_searchField().getText();
if(textEntered.equals("")){
JOptionPane.showMessageDialog(null,"Please enter a…

Newbies
- 13
- 5