jtable

How to adjust components and JTable in a JFrame dynamically?

When i try to hide the rows in a jTable, the jTable ScrollPanel need to adjust its size to remaining rows and, other components in the Frame also adjust to the change. i.e., there shouldn't be any space between the components and the jTable after hiding the table-rows.. ex: in microsoft excel, when we delete a row, the remaining rows w...

Anybody having hands on experience with JTable?

Hi I am stuck with some issues with jtable, if somebody has worked on it plz tell me... My problem is i have to populate combobox based on some criteria which currently i am not able to handle. ...

Using auto sort on a JTable and return the correct data

Hi guys, I've got a JTable which model is custom that extends AbstractTableModel. In this the way I get the data is from a list class. public Object getValueAt(int row, int col) { if ( col == 0 ) { return searchThings.getThing(row).getTitle(); } else if ( col == 1 ) { return searchThings.getThing(row).getDate(); } else { retu...

How to get the line number or cell number by double-clicking the mouse in the table

How to get the line number or cell number by double-clicking the mouse in the table. ...

Erasing whole JTable

do you know the best way to erase whole JT ? ...

JTable design to synchronize with back-end data-structure

I have a JTable which is loaded from a data-structure using table model.The data-structure is of the format NavigableMap<Float,NavigableMap<Float,Boolean>>.An example data is: Table Format: Range f1,v1 f2,v2 f3,v3 f4,v4 12.1-30.2 30,true 32,false 45,true 50,false 30.2-45.6 30,true 32.4,true 45,true 50.1,true The above data...

Render more than one objects in the same JTable cell

I need to display a cell data (20.2,true) in Jtable in which 20.2 is float and true is a boolean value in the format (20.2,[JCheckBox]).Is it possible to render 2 different objects in such a manner? ...

Hiding a particular cell grid in Jtable

I am trying to display numbers in the steps of 5,10,15,20 in a Jtable. In case of 5 the column names will be 0,5,10,15... In case of 10 the column names will be 0,10,20,30... In case of 15 the column names will be 0,15,30,45... In case of 20 the column names will be 0,20,40,60... Right now I am able to display 5 and what I need is ...

jtable and custom combos

Hi, I want to implement a properties table in jtable (swing). I want to have e.g. ** 2 column table Row1: Property-text| Txtbox. Row2: Property-text| ComboBox of values A,B,C. Row3: Property-text| Txtbox. Row4: Property-text| ComboBox of values E,F,G. ** I can not understand how to get this started. I am using Net...

JTable: Buttons in Custom Panel in Cell

Hello everyone, I want to be able to have a JPanel in a cell with a JButton that does some work when clicked. I looked for howtos about Cell Editors, but all examples talk about replacing the cell with another component (e.g. replace an int with a JTextField etc.) My situation is a little different: I have the following ADT class My...

Unable to edit seemingly arbitrary JTable columns

As the title states, I have a JTable and I am unable to edit "arbitrary" columns. I have 4 columns and only the first column is editable. The first column has files and a special editor, the next two columns have Strings, and the last column has Integers. I'm using a custom model, and I am returning true from the isCellEditable method. ...

Item always selected in JTable

I have created a JTable where the included items are provided with radio buttons in order to enable users to select any of these once at a time. In order to show always the first item selected when the JTable is initialised (or when the item previously selected has been deleted) what method should I use? ...

JTable data update flickering, client-server model

Hello All, I know many times already talked about this problem but for me non of them helped. I have a client-server application which communicate via sockets. The method is the following: Client make a request to the server Server receive the request, process Send back the requested data via XML The JTable update / populate with ne...

paintComponent and getTableCellRendererComponent not getting called

I am setting the renderer of a JTable using setDefaultTableRenderer. JTable table = new JTable(); table.setDefaultRenderer(Object.class,MyRenderer); MyRenderer extends DefaultTableCellRenderer and overrides paintComponent and getTableCellRendererComponent. I have 4 rows and 8 columns and for strange reason my renderer methods are not...

Swing/JTable Not Updating After Bound Data Fires Change

I have a JTable which is bound to my EventTracker bean, essentially a wrapper around a list which I will use as append/clear only (i.e., a simple log). Problem is, when I add entries to the list and try to fire an event I don't see any changes. I'm using the NetBeans IDE. The EventTracker bean is added to the view and instantiated as ev...

Notification when a checkbox in a JTable is checked

I've searched for this for quite a while and haven't found a clear example anywhere. I'm a Java newbee using NetBeans. I have a boolean value in the first column of a JTable (called "Enabled") and I have some plugin code that I need to call to see if it has the settings it needs in order to be enabled, and if not, display a message box...

TableModel vs ColumnModel: who owns the column value?

What's the difference between JTable.getModel().getColumnName() and JTable.getColumnModel().getColumn(index).getHeaderValue()? The two don't seem to share any data. My guess is that TableModel.getColumnName() indicates the textual representation of a column while TableColumn.getHeaderValue() and TableColumn.getHeaderRenderer() determine ...

how to fill JTextFields with the columns of a JTable search?

I have a master/detail form with a JTable on top, and all the JTextFields corresponding below in the JPanel. I'm trying to make a search in the JTable, so that when the correct row gets picked, all the JTextFields can be filled with the column values. I don't know how can I call the rows programmatically to do so. How would it be done...

printing selection of JTable

I want to print only selected rows in a JTable. My approach is to make a new TableModel, copy the selected rows there, add the tableModel to a new JTable and then print this new Table. My Problem: It doesnt work as expected, I just see a black line with the height of the rows, if i select lesser rows the line is smaller) but no content. ...

Java Entity Beans are not deleting rows from database; only from JTable

I am using Entity bean in NetBeans, to develop some master/detail forms. When I run the forms, I click the Delete JButton, and the row dissapears from the JTable. But when I click on "Reload", the supposedly deleted row shows up again. I don't know why is this happening; why does the Entity doesn't erase all the way to the database ta...