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
0
votes
3 answers

JTable and DefaultTableModel dosen't refresh table data

I have a problem with updating/refreshing data in table. I am using DefaultTableModel. Here is code so please share your knowledge and advises. Best regards. *EDIT 1: * Original code has a function that was updating table data but that proves wrong…
ZhiZha
  • 143
  • 2
  • 4
  • 13
0
votes
3 answers

Updating a JTable with database query

The program I am working on contains two classes, GUI & DatabaseHelper. The table model used is DefaultTableModel. The GUI contains consists of a simple JTable. It is initialised with data from the DatabaseHelper on startup. This works. However,…
Php Pete
  • 762
  • 3
  • 14
  • 29
0
votes
1 answer

Refresh a jTable

I can't seem to get my table to refresh. I created a refresh button that calls jTable1.repaint(); private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) // Reader Refresh jTable1.repaint(); } I also tried just…
jerhynsoen
  • 205
  • 1
  • 7
  • 20
0
votes
2 answers

Get value of field in DefaultTableModel in JAVA

The user has chosen value of a field in a row,How i can get value of id field in row that chosen? For example,user select value of name field in row 2,I want understand the value of id field in row 2.How should write in TableModelListener? public…
HFDev
  • 131
  • 2
  • 4
  • 11
0
votes
2 answers

How to get newly updated data in a cell in a DefaultTableModel

I create a table from DefaultTableModel, and then I use table.getModel().setValueAt(value,row,col) to add the 1st value in a cell. However, when I click the mouse on that cell and change the data inside to the 2nd value. and then I get that value…
Huy Than
  • 1,538
  • 2
  • 16
  • 31
0
votes
1 answer

DefaultTableModel giving a Null error on filled Array

I am trying to use the JavaMail API and using it in text when just fine. Printing out all my emails subjects in the cmd. So I wanted to implement it into a GUI. For some reason though, I get a null error, even though I debugged the program and find…
OmniOwl
  • 5,477
  • 17
  • 67
  • 116
0
votes
1 answer

Adding a row to a JTable by use of a JButton's actionListener

The following is my code for attempting to add create a JButton which will add a row to the connected JTable. My variables are shown below, tables and tbm are created but were initialized in another part of the program that is not currently shown.…
user1418454
  • 107
  • 1
  • 9
0
votes
1 answer

JTable throwing IndexOutOfBoundsException during paint

Hi I'm building an application using a JTable to display data from a database and I keep getting an IndexOutOfBoundException from tableModel.getValueAt(row,col) during painting. I debugged the code and it seems like the data isn't being saved to the…
0
votes
1 answer

DefaultTableModel Empty?

I'm reading in a file and want to output it to a jTable for viewing and editing. When I try to add rows the the DefaultTableModel the model is always empty for some reason. Any help/direction would be greatly appreciated. Thanks! public class…
Tai
  • 63
  • 2
  • 7
-1
votes
1 answer

DefaultTableModel update BUG, How can I resolve it?

I hope you can help me!!! I have a JComboBox, when I click the button "search" a JTable appears. When I change the selection of the JComboBox and click "search" again, the table changes its model and shows me the new datas, but if I click in there,…
blink727_
  • 1
  • 3
-1
votes
1 answer

java DefaultTableModel header click event

I need help to add an event when clicking with the mouse on the columns identifiers, I'm using DefaultTableModel public class TableData extends JTable{ private final DefaultTableModel model; private final ObjectIterable objI; public…
abdiel
  • 1
  • 1
-1
votes
1 answer

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 >= 0 defaultTableModel Java

I would like to save and display data from database in JTable, and tried to use defaultTableModel for that. However, I'm getting: ArrayIndexOutOfBoundsException at com.mycompany.bazadanych.main.main(main.java:40) (line with ** **). Is there a…
-1
votes
1 answer

How to fix getrowcount() in netbeans?

My table in java is connected to mysql. It retrieves data in the table. but when i specified getrowcount() it shows 0 rows in system.out.print. pls help, our project deadline is on 3rd june. DefaultTableModel model = (DefaultTableModel)…
-1
votes
2 answers

JTable populated from an ArrayList

What I am trying to do is to populate a JTable from an ArrayList. The array list is a type Record which I have defined below: public class Record { int Parameter_ID; int NDC_Claims; int NDC_SUM_Claims; public Record(int parameter,…
sahandian
  • 3
  • 1
-1
votes
2 answers

Can not display contents of Arraylist n JTable

I can't figure this out (have been trying to fix this for the past 2-3 hours). I would like to display the contents of an arraylist, but they do not appear in the table and also there are NO errors, they simply do not appear. Here is my…
Sky Mage
  • 31
  • 5