Questions tagged [abstracttablemodel]

Java abstract class which provides default implementations for most of the methods in the TableModel interface.

294 questions
1
vote
2 answers

unable to do consecutive search

public boolean searchSummaryData(String textToFind) { int fromRow, fromCol; fromRow = summaryTable.getSelectedRow(); fromCol = summaryTable.getSelectedColumn(); if (fromRow < 0) { fromRow = 0; //set to start point, first…
MooHa
  • 819
  • 3
  • 11
  • 23
1
vote
1 answer

JTable - delete row issue

I have a table that should read from file and display and can delete row from table and file. But not work! My code: public class Readuser_A extends AbstractTableModel { String[] columns = { "Fname", "Lname", "Gender", "Date", "ID" }; …
user1945649
  • 35
  • 1
  • 7
1
vote
1 answer

Use DefaultTableModel and AbstractTableModel together

I have a table that read records from file and display them and have a delete button that when user select a row and clicked, that line delete from table and text file too. (Updated) public class Readuser_A extends AbstractTableModel { String[]…
Sajad
  • 2,273
  • 11
  • 49
  • 92
1
vote
2 answers

JTable in JScrollPane not displaying properly in Mac OS X

The following code does not work on Mac OS X 10.6.8 but does on everything else I test, Mac OS X Lion and Windows 7. The obvious explanation would be differences in Apple's java. The table data does not show properly, if at all, on Mac. Here is…
tdramble
  • 101
  • 1
  • 12
1
vote
2 answers

Java - TableModelListeners and DataModelEvents

When should I create my own TableModelListeners and DataModelEvents? I know the difference and use of a DefaultTableModel, AbstractTableModel and TableModel. I have seen in many online Java examples where TableModelListeners and DataModelEvents are…
user547453
  • 1,035
  • 6
  • 22
  • 38
1
vote
1 answer

Create different JTable while keeping generics

I have a working program using a Model composed by a list of Item. public class Model { private List;} public abstract class Item{} public class A extends Item{} public class B extends Item{} public class C extends Item{} But now i need to…
Julien Breuil
  • 165
  • 1
  • 2
  • 15
1
vote
1 answer

How to organise a Server architecture with a GUI

I'm developing a Banking Client-Server architecture. I want to know what is the most convenient way to organize the Server side. Does the Bank need to be the Server and the GUI in the same file ? Because currently I have the server GUI which…
xenom
  • 377
  • 1
  • 5
  • 15
1
vote
3 answers

JTable Boolean.class

import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableModel; class ColorTableModel extends AbstractTableModel…
Jong
  • 131
  • 1
  • 2
  • 12
1
vote
1 answer

JTable Sort Rows based on attribute not in table

I wrote this simple sorting function : public void applyFilter(String filter, int col) { if(filter.length() == 0) sorter.setRowFilter(null); RowFilter rf = null; try { rf =…
Patrick.SE
  • 4,444
  • 5
  • 34
  • 44
1
vote
2 answers

How to check all check boxes at a click of a button

I am new to Swing, UI and MVC I have created a code based on MVC. Now my problem is that that in the controller part i have an actioneventlistener which listens to different button clicks. Out of all those buttons i have "select all" and "de-select…
mu_sa
  • 2,685
  • 10
  • 39
  • 58
1
vote
2 answers

How TableModel know that value was changed?

In an example below a window displays a table, containing window itself width. When window is resized, the value of it's width is reflecting the current truth. How this can be? How Swing informed a table, that it should rerequest model? Or maybe…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
1
vote
3 answers

Is it possible to overload the getValueAt method on the abstractTableModel?

I am making a JTable that uses an arrayList for data population. I have two sets of data in the arrayList. one for one type of table and another for another type of table. What I am hoping to do is overload the getValueAt method on the…
Robert
  • 4,306
  • 11
  • 45
  • 95
1
vote
1 answer

Which one is better : AbstractTableModel.fireTableDataChanged() or AbstractTableModel.fireTableRowInserted()

Is it a good idea to add one row and call fireTableRowInserted() or adding all rows and then call fireTableDataChanged()?
DKumar
  • 352
  • 1
  • 3
  • 13
1
vote
2 answers

Adding an object to and retrieving an from a table

Let's assume that I have a class like this: public Class FooBar { String foo; String bar; String unvisibleField; String id; } Then I have created a table using DefaultTableModel and adding elements to it like this (I am not showing all…
Alptugay
  • 1,676
  • 4
  • 22
  • 29
1
vote
1 answer

Why do I need to call getRowSorter().modelStructureChanged() before fireTableRowsInserted()

I have a table which extends AbstractTableModel. When data for it arrives, i delete rows and recreate them again with new data. What i do not understand is why do I have to call the following: getRowSorter().modelStructureChanged(); before calling…
Misha
  • 5,260
  • 6
  • 35
  • 63