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
1 answer

Which of this delete JTable row methods is better?

I have two kind of methods to remove JTable selected row. I create this methods in my GUI Class: First: public void dellAction() { if (table.getSelectedRow() > -1) { int rowToDelete = table.getSelectedRow(); int rowToModel =…
Sajad
  • 2,273
  • 11
  • 49
  • 92
0
votes
2 answers

Where should definition my optional DefaultTableModel methods?

I use this 3 class for show data from database into JTable. public class TableContent { private final Vector headers; private final Vector> content; public TableContent(final Vector headers, final…
Sajad
  • 2,273
  • 11
  • 49
  • 92
0
votes
3 answers

Adding column with header and data to the MyTableModel

I created a class MyTableModel which extends DefaultTableModel. And what I want is, to have already initialized three columns with data. Inside a constructor of MyTableModel I set header/data values by calling this.addColumn("FIRST COL",…
0
votes
1 answer

Add column to JTable that has some rows before adding

I have a JTable that contains 4 columns and for example 10 rows. I want to add a new column and put the maximum value for each row in that. Here is the function that I use to compute the maximum and put them into the new column: private void…
Morteza
  • 13
  • 7
0
votes
1 answer

Display error when adding same item into JTable

I using detaful table model DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); and I row count int Row = model.getRowCount(); Here is which I add row and wish to diplay error when adding same items. if (Row > 0) { …
Q123Q
  • 9
  • 1
  • 9
0
votes
2 answers

Get DefaultTableModel from JTable

I want get DefaultTableModel from JTable and then add Column to that. I search in JTable but Only find getModel() method.Then can't add Column to that. In end say I use Binding method for set Date in JTable then haven't DefaultTableModel and I want…
Jeus
  • 486
  • 3
  • 10
  • 26
0
votes
0 answers

JTable Scoping and adding a row

So I have a lot of experience with procedural languages and I'm trying to map it to Java. I have code that creates a default table model using a csv file and loads the file into a JTable inside a tab. It works great. But now I want to add lines to…
Jim
  • 1
0
votes
0 answers

Request editing cell

How to request to edit cell? I added popup menu in DefaultTableModel. And if I click to JMenuItem changename, I would starting editing cell in 2nd row. This row is editable.
barwnikk
  • 950
  • 8
  • 14
0
votes
1 answer

my gives an empty resultSet. My JTable is empty. It shouldn't be

The problem seems to be with the ‘generic’ syntax in the setInt and setString methods. - of course, could be other problems as well but let me tell you what I found. Below is my table in mySql that I’m trying to query using java. Id |…
David Jahn
  • 11
  • 3
0
votes
1 answer

Java Swing set color of rows and columns based on index with defaulttablemodel

I want to be able to do two things: set colors of rows based on index, so first row is red, second blue, third green be able to set color of columns also based on something, be it index or their names etc, whatever is possible. I do not need to…
Ted
  • 629
  • 2
  • 8
  • 19
0
votes
1 answer

how to Update jtable with AES_DECRYPT

I would like to update the JTable without AES_ENCRYPT the data is can be updated and viewed, but since the data is encrypted each time i try to call this method the data is still encrypted. how can I use solve this issue ? private void…
mohamed nur
  • 331
  • 1
  • 15
0
votes
1 answer

Calculating values in JTable

Right now I have a JTable and whenever a button is pressed, it displays the item name and the item price from the MySql database that I had created. What I am having trouble with is to keep a running total for the price of the items on that are…
JudgementFlame
  • 107
  • 1
  • 2
  • 9
0
votes
2 answers

Store contents from JTable into a text file

I have written a swings form with 5 text boxes and a button. When i click the button save, the data entered is being displayed in the table. Now i want to store the data shown in the table into a text file. Can anyone please help me with this code.…
Neelam
  • 3
  • 1
  • 5
0
votes
1 answer

JTable Model data not showing Updated data

my Swing application has few textfileds and Jtable. When I update the values in textFileds those values not showing on Jtable immediately after updating data. I tried using tbmodel.fireTableDataChanged(); But that didnt work. try { …
amal
  • 3,470
  • 10
  • 29
  • 43
0
votes
1 answer

Building Java TableModel from list of results

Hi I have problems with populating a TableModel, I cannot understand what the problem is here is my method private TableModel buildTableModel(List result) { // build the columns Vector columnNames = new…
nuvio
  • 2,555
  • 4
  • 32
  • 58