jtable

JTable - drag and drop

OK, this problem is out of my league. I'm trying to implement a GUI widget in swing that allows files to be dropped onto a JTable, and allows the rows of the JTable to be dragged for re-sorting. Think VLC's playlists or the one in iTunes. I got dropping files from the OS (Explorer, Finder, etc.) working just fine, but I'm having an impo...

Setting the mouse cursor for a particular JTable cell.

I have a JTable with a set of uneditable cells and I want all the cells in a particular column to have a different mouse cursor displayed whilst the mouse is hovering over them. I am already using a custom renderer and setting the cursor on the renderer component doesn't seem to work (as it does for tooltips). It does seem to work for e...

How can I update my JTable data automatically when the database is updated?

How can I update my JTable data automatically when my database is updated? Thanks. ...

Is there any alternative to JTable, that is free and better?

Looking for a free and better alternative to JTable. Found quite a few good ones, but they aren't free. To begin with, I want to be able to select cells diagonally (apart from horizontally and vertically). ...

Is it possible to include JButton in a JTable?

I have a JTable that stores the results of a database query, so far so good. What I want is for the last column in each table to have a clickible JButton that will open the edit screen for the object represented in that row, and that means the button will need to know the details of the first column in the table from its own row (the ID ...

Problem with inserting rows into JTable

Hello people. I have problems on inserting rows into a JTable and I don't know what the problem is. I do exactly like this: ((DefaultTableModel)myJTable.getModel()).insertRow(0,webSiteDownloader.getWebSites().toArray()); The webSiteDownloader is one object that have an ArrayList. I can get that array calling the method getWebSites. ...

JTable or some other Java table class with advanced cell selection?

Right now I'm using a JTable for what I'm doing. After looking through the Java API and various web resources, I don't think a JTable is going to cut it anymore. What I'm looking for is a table for which I can specify very strict selection procedures. I want to be able to not only select rows and columns, but also select cells in a diago...

Changing JTable cell color

This is driving me absolutely insane. I know that, to change the formatting of table cells with JTable, I have to use my own renderer. But I cannot seem to implement this properly. This is my current setup: public class MyClass { public static void main(String args[]) { JTable myTable = new JTable(10, 10); myTable.se...

setting a prototype value (for auto-width calculation) of a JTable column

either this doesn't exist, or I'm not thinking/searching correctly because it's late... I want to set a JTable column width in Swing based on a prototype value for the largest string I expect (or know) to exist in a particular column. I don't know the # of pixels since I don't necessarily know the font at compile time. Is there a way t...

set com.borland.dx.dataset.Column editable

hi, I use in an old java application some borland components (com.borland.dx.dataset.Column, com.borland.dbswing.JdbTable, ...). I don`t want that anybody is able to change the values of one column. So I used column0.setEditable(false); But now I have the problem, if I add a new row to the Table, I can't edit it :-). So how is it possi...

JTable Scrolling to a specified row index

I have a JTable that is within a JScrollPane. Rows are added to the table at runtime based on events that happen in my application. I want to have the scoll pane scroll to the bottom of the table when a new row is added to the table. For JLists There is the ensureIndexIsVisible() that forces a particular index in the list to be visible....

getting selected row through AbstractTableModel

Is it possible to get the selected row index from my table model? My object already knows about the table model. Instead of passing a reference to the table it self can i get the selected index using the model? ...

Multiple Strings colored in different way into the same cell of a JTable

Suppose you have a JTable and for each cell you want to display three strings with different color, say value1 (red), value2 (blue), value3 (green). I overrode the getTableCellRendererComponent of DefaultTableCellRenderer but setForeground(Color) method gives an unique color for all the string showed in the cell. @Override public Compo...

getting TableCellEditor colors to match match look and feel

So I have custom CellEditors and CellRenderers and although I am doing component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); component.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); component.setOpaque(true); in my getTableCellRendererCompoent, the col...

Pass events in custom JTable

Hi I have a class called ColorChooser (in the net.java.dev.colorchooser.ColorChooser package) This is a custom component used to select colors. What I want is to display a JTable with ColorChoosers in the second column. So I created my own TableCellRenderer and it works: @SuppressWarnings("serial") class ColorChooserTableRenderer exten...

Printing headers and footers in color?

I am trying to create colored headers and footers when printing a JTable. Specifically, I am looking at getPrintable() in javax.swing.JTable, but MessageFormat does not give me the option to specify the color of the header or footer. How can I do it? clarification I am interested in setting the header/footers while printing. For exam...

How to enable GUI behaviors for sorting a JTable when SQL does the sorting?

How do I enable JTable icons and behaviors for sorting table rows by a column, without letting it use a comparison predicate to do the sorting? That is to say, how do I tell the table headers to show the arrow for ascending/descending sort order in the column being used, and get it to call appropriate methods when sort order/column chan...

Updating cell renderer after a DefaultCellEditor derived instance does its job

Hello, I use a JTable which has its own cell renderer and cell editor. Say, this table contains 2 columns and x rows: The first column contains a boolean value, its own cell rendering and cell editor (a radiobutton) The second column contains a string value, its own cell renderer: it makes it bold when the first column of the current...

How can I hide (make invisible) row in JTable?

Is there any way to do it? ...

Java JTable setting Column Width

I have a JTable in which i set the column sized like following, table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.getColumnModel().getColumn(0).setPreferredWidth(27); table.getColumnModel().getColumn(1).setPreferredWidth(120); table.getColumnModel().getColumn(2).setPreferredWidth(100); table.getColumnModel().get...