Questions tagged [abstracttablemodel]

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

294 questions
3
votes
3 answers

Dynamically changing number of columns in a JTable

I have a JTable and a TableModel that extends AbstractTableModel. I would like to dynamically set the number of columns in the table. I implemented this by adding an attribute to my TableModel named, column_count, and having getColumnCount return…
cesar
  • 8,944
  • 12
  • 46
  • 59
3
votes
2 answers

Working with several custom table models avoiding repetitive code

I'm working in a project in which we have several domain classes to model business data. Those classes are simple POJO's and I have to display several tables using them. For example, consider this class: public class Customer { private Long…
dic19
  • 17,821
  • 6
  • 40
  • 69
3
votes
1 answer

Java. JTable setValueAt data not update

I try to use JTable but when I invoke setValueAt method data don't update in gui. I try to find the answer more then 5 hours but anything help me. I try to updateUI and fireTableDataChanged() but id doesn't help. I use AbstractTableModel and my…
aleh
  • 297
  • 1
  • 3
  • 8
3
votes
1 answer

Don't updating JTable

I found sample with updating data, but it uses DefaultTableModel. When I created my own TableModel and my own data class, when I add data into JTable it doesn't update. How do I add a listener to my TableModel? Here is my code: package by; import…
veinhorn
  • 2,363
  • 6
  • 21
  • 33
3
votes
2 answers

remove rows from JTable with AbstractTableModel

I would like to remove selected row from JTable with AbstractTableModel using a button. The code below works with DefaultTableModel: ... MyTableModel mtb; ... private String[].... private Object[][]... ... JTable table = new JTable(mtb) JButton…
TheSpaceboy0
  • 95
  • 1
  • 2
  • 8
3
votes
2 answers

Unable to get column index with table.getColumn method using custom table Model

I have created a custom TableModel using AbstractTableModel. I am able to populate my JTable. But my JTable has a button column say "Button1". So I am using CellRenderer method to add buttons to column and CellEditor to add actions, but I am getting…
Amarnath
  • 8,736
  • 10
  • 54
  • 81
3
votes
2 answers

Weird behaviour on fireTableDataChanged in JTable

Up till now I had a definition of the JTable like this: JTable table = new JTable(model) { @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c =…
Bober02
  • 15,034
  • 31
  • 92
  • 178
3
votes
2 answers

JTable with AbstractTableModel does not edit on click

I am constructing a JTable for an Applet that should be able to handle user edits. As such, I have extended the AbstractTableModel and have successfully populated the table with data. My problem is that once the data has been populated, clicking on…
user1431513
  • 33
  • 1
  • 3
2
votes
1 answer

How often JTable call getValueAt()?

How often my JTable call getValueAt() from AbstractTableModel? Is it will be normal, if I will make big calculations in getValueAt() (for example, calculate value of polynomial)? Should I store values of polynomial in array and return from it?
Dmitry Zhlobo
  • 369
  • 2
  • 10
2
votes
5 answers

ArrayIndexOutOfBoundsException: -1 on JTable creation/tablechanged

I have read through all the threads out there that looked as if they could solve my problem and I've also read all the answers on here, but I'm still at my wit's end. I'm not sure why the exception is thrown, although I have a feeling this might be…
s.d
  • 4,017
  • 5
  • 35
  • 65
2
votes
2 answers

java: Access a JProgressBar in an AbstractTableModel

I'm working with the following code that contains a JProgressBar inside of an AbstractTableModel. The JProgressBar progress value is updated in "case 5: " of the getValueAt() function by returning a Float. What I'm trying to figure out is how to…
opike
  • 7,053
  • 14
  • 68
  • 95
2
votes
3 answers

Adding a Row in a Jtable with AbstractTableModel

I'm trying to add a row into the Jtable that extends AbstractTableModel as the following code shows: class AbstractTable extends AbstractTableModel { String[] columNames = {"name", "cc", "age", "phone", "date", "amoun"}; Object[][]…
Cohen
  • 79
  • 1
  • 9
2
votes
2 answers

How to display data in AbstractTableModel using java?

I have created a JFrame and I want to create an AbstractTableModel to display the data from database using dbquery in the grey box. This is the first time I am doing this and I have been struggling for very long, really hope to receive some help!…
Bee Kee
  • 45
  • 6
2
votes
1 answer

TableModel not called in a JScrollPane containing a JTable

I am having an unexpected behavior with the Java GUI. I want to create a JScrollPane containing a JTable then add this JScrollPane to a Frame. Here is the code : public class UrlsScrollPanel extends JScrollPane { private static final long…
Guillaume Robbe
  • 658
  • 1
  • 7
  • 18
2
votes
1 answer

Initialize column names in AbstractTableModel

I want to initialize my model. Here is an extract of my main class where I create my GUI items: public class IceIHM extends JFrame{ List listInit = new ArrayList() { { add("None"); add("None"); add("None"); add("None");…
Remi
  • 23
  • 1
  • 6
1
2
3
19 20