jtable

iPhone-like JTable

Hello, i want to display a jtable with the feature, that if there is not enough space left on the screen the columns first start to shrink (and display less info) and then start to disappear. The info contained in the removed column for the selected row has to be displayed in a details view. Is there a component in any swing component...

problem with Checkboxes in Jtable column

Hi all, I have a Jtable with 6 columns where i have Check boxes in the 6th Column.I am outing the text in to JTable by using the setValueAt() and getValueAt() methods.For the same Jtable I have Find,Replace and Replace All Controls to find,replace and replace all the text i the jtable.The Particular cel will be focussed for Find text.Pa...

Mutually Exclusive CellEditors in JTable

I currently have a problem whereby editing the contents of one cell in a JTable alters the content of another; two of the columns are mutually exclusive. They are both checkboxes. At the moment, if I alter one cell, it isn't until the other is redrawn that it updates. Therefore, both cells in the row can be displayed as being selected a...

Jtable & queue !!

Hello! I am new at using Jtable and I need some help. I want to write the following CODE to display data from queue in the table a problem : the data does not appear in the table i dont kow what is a problem !! i need help , please Source Code : // class student public class student { int id,age; String fn,ln; public s...

Is there a convenient way to use a spinner as an editor in a Swing JTable?

I deal with numeric data that is often edited up or down by 0.01*Value_of_variable, so a spinner looks like a good choice compared to a usual text cell. I've looked at DefaultCellEditor but it will only take text fields, combo boxes or check boxes. Is there a convenient way to use a spinner? ...

JTable onchange event

Is there any way to detect a cell selection change in a JTable? I've found documentation for detecting a row change using ListSelectionListener but it doesn't seam to work when changing selection on the same row. I'm using JTable to render a simple schedule. Maybe I should use a different component? ...

java swing, Sliding the wheel of mouse, longer(to increase) the JTable, just like excel ?

like the title, how can i get it ? I mean when sliding the wheel of mouse, the rows of the model of a JTable increase. Just the microft Excel. Yes, the model of the JTable change automatically when I slide the wheel. Of course, the size of the JTable won't change, it alwasys equals the the size of the JScrollPane. ...

Java JTable object with multiple fields

I have an object that has X number of fields. Each row in my JTable corresponds to one item. Each column in the row represents a field for that item. I also need to maintain a reference to the item (the item has a unique ID field as well) so I can determine the item in the selected cell. Would the preferred approach to this be putting t...

How to make a JTable non-editable

How to make a JTable non-editable? I don't want my users to be able to edit the values in cells by double-clicking them. Any help would be greatly appreciated. Thanks. ...

Java Coloring a Table row

I want to color a Table row depending on whether there is a non-null in its 3rd column. Heres the code that I wrote : (ignore the braces) public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { JComponent c =(JComponent) super.prepareRenderer(renderer, row, column); c.setBorder(BorderFactory....

Can I add a button to a JTable column header?

I have a JTable where the first column in each row is a checkbox. The user can select and deselect individual columns. I've got this working. Now I'd like to add to the column header a checkbox which can be used to "select all" and "deselect all". I'm puzzled in how I should go about doing this. I can't work out how to put a component o...

actionPerformed comboBox in a JTable

I have a table (JTable) that has a comboBox in one of it columns. Say the combobox is consist of id. So, whenever user choose from comboBox (in a selected row), the next column in the table will display the name of the id (in the same selected row). I tried this code: cboItem.addActionListener(new java.awt.event.ActionListener() ...

How to add a JComboBox to a JTable cell?

I am trying to add JComponents to JTable Cells. Do I Implement CellRenderer or CellEditor? ...

Whats the proper event for changes in any cell of JTable?

I have a simple JTable, there are two columns that matter: quantity and value (Integers). Each time user enters a new row or updates one, each rows value must be multiplied by quantity, results sumed together and the result sum displayed in a JLabel outside the JTable. Looks pretty simple. Except that I have no idea what event should I l...

TableModel column differentiating between number types

I have a JTable used to store numbers. I really only use the table for viewing/sorting. Is there a downfall (other than maybe needed to allocate more space) to giving the columns a class of Double even if some of the columns may have all ints or longs. I can parse the numbers to see if a column contains all of a single type, but that see...

Adding Buttons inside cell of JTable along with data?

Hi, Is it possible to add buttons inside the JTable cell along with data? What I am trying to do is to create a table with columns which display data(number) from the database, and two buttons to increase/decrease the number inside the same cell. |ID | Quantity| |06| 2 [+][-] | it would be something like above with [+][-] being but...

Correctly getting data from a (sorted) JTable

I have developed a basic custom JTableModel as follows public class CustomTableModel extends DefaultTableModel { List<MyClass> data; public CustomTableModel(List<MyClass> data) { this.data = data; } public Class<?> getColumnClass(int columnIndex) { return MyClass.class; } public MyClass getValueAt(int rowIndex, int...

How to Mirror Edits across a Table Cell and Text Field

The desired behavior is akin to the mirrored text editing field provided in Excel when a given cell is selected, allowing more space to view the contents of the cell. I have a JTable with 5 columns and n rows. Column 2 holds expressions that can be arbitrarily long, thus I'd like to provide a separate JTextField to work with for editing ...

Invert the Selection in JTable

On clicking a button, I want the selected rows to be inverted (non-selected rows should be selected and selected rows should be non-selected). Is there a build-in method in JTable to do it? ...

Disable a single column dragging in JTable

How should I disable just a single column from dragging in JTable? I want to allow other columns from dragging but just the first column (indexed at 0). Thanks. ...