Refresh Jtable
I have a JTable created from Vector. How can the JTable be refreshed to display new data that is added to the Vector? ...
I have a JTable created from Vector. How can the JTable be refreshed to display new data that is added to the Vector? ...
In Outlook I can remove a table column if I drag the column header out of the table. How can I do the same in Java with a Swing JTable? A default drag & drop operation is not possible because this feature is independent of the target position. It depends only from the drag source. ...
What's the preferred way of this (based on header & contents width I believe)? TIA. ...
Whats the relationship between a JTable, TableModel and TableData. If i just modify the TableData, does that also change the data display on the JTable component or i have to call some method to sync the two. I have looked at this, but it does not explicitly tell or show me the relationship in terms of updates ...
I'm having issues with the following code, where I use a JComboBox to change a String value in a table cell. The JComboBox works fine, but if I click in the box and then click away without selecting anything the JComboBox's dropdown remains visible, even if I delete the row. Clicking on another Swing component like a JButton often caus...
I have many custom editors for a JTable and it's an understatement to say that the usability, particularly in regard to editing with the keyboard, is lacking. The main reason for this is that my editors are always created with a similar (though often more complex) situation to this: @Override public Component getTableCellEditorComponen...
Is there a simple way to sort rows in a JTable with Java 1.5 (setAutoCreateRowSorter and TableRowSorter appear to be Java 1.6 features)? ...
Hi, I got a Java Swing GUI and got a problem with a JTable in a JScrollPane. For some reason, when the rows of the table model are increased during the program execution, the JScrollPane isn't updated - that is, if the rows are increased so that the height of the table is over the height of the scroll view, the scroll panes aren't updat...
A time counter shows the age in seconds of a row in the table. Ideally, it would be updated once per second. I know I can just increment the appropriate data in the table model, fire the events (one per row), etc. It seems like overkill. Is there a better, lighter way? ...
I have an ArrayList of Track objects. Each Track object has the following fields (all Strings): url, title, creator, album, genre, composer I want to display these tracks in a JTable, with each row being an instance of a Track object, and each column containing one of the properties of a Track object. How can I display this data usin...
Hi, Im doin a project using JTable, i want to make my table cells editable. I used, public boolean isCellEditable(int row, int column) { return true; } My problem is, the cells are ediable but once after entering data into one cell and move on to the next, the previous data gets erased... kindly any one help me... ...
Hi, I'm doing a mini project using JTable. I used the Vector type for the row values. For example, public Vector textData = new Vector();. The problem is when I edit the cells in the JTable, it is editable but not keeping the changed value. That is, when I enter data in 1 cell and move on to next cell, the previous data is not updated....
How do you setup a JTable to be able to drag a row to a different index in the table. For example if I have 5 rows and I want to drag the 4th row to the 2nd position? ...
Is there an easy way to manipulate the controls on a JTable to give different functionality when there is a keyboard button pressed (ie. CTRL button) and a row is selected? I've been asked to create a table where the CTRL + Click (mouse click) on a row will only deselect a selected row, never select a row. If the user CTRL + Clicks an un...
Here's the thing: a sortable JTable backed by JTableModel with an array of objects that populate rows (one object = one row). Need to delete rows. Without sorting, deleting an object is simple: get selected row index, delete array object under the same index. With sorting, though, row indexes mess up in a sense that they no longer match...
//can set column widths using percentages private void setPreferredTableColumnWidths(JTable table, double[] percentages) { Dimension tableDim = table.getSize(); double total = 0; for(int i = 0; i < table.getColumnModel().getColumnCount(); i++) total += percentages[i]; table.setAutoResizeMode(JTable.AUTO_RESIZE_O...
If the columns of my JTable are unalphabetized, I can use getSelectedRows() and get values of their rows without any trouble. But, if the user clicks on the column name and the rows are alphabetized in that column, getSelectedRows() returns not the currently selected rows, but the rows that were originally there before alphabetization. ...
Hi all When I select a row in a JTable, my JTable doesn't get updated anymore. When I don't select a row, the code beneath works as expected. A row is added to the JTable. @Override public void update (Observable arg0, Object arg1) { if (arg0 instanceof Logger) { LogItem last = systemController.logController.getLog().getLastLog...
I've tried this: public void removeSelectedFromTable(JTable from) { int[] rows = from.getSelectedRows(); TableModel tm= from.getModel(); while(rows.length>0) { ((DefaultTableModel)tm).removeRow(from.convertRowIndexToModel(rows[0])); rows = from.getSelectedRows(); } from.clearSelection(); } But, it sometimes leaves one stil...
I'm using GlazedLists to autogenerate an EventTableModel from an EventList, for use with a JTable in a JScrollbarPane. I'm using the EventList as a FIFO, a bunch of elements are added to the end, then a bunch of elements are sometimes removed from the beginning. When elements are removed, the selection works exactly as I expect: even th...