Questions tagged [tablecellrenderer]

TableCellRenderer is a Java Swing interface that defines the method required by any object that would like to be a renderer for cells in a JTable.

TableCellRenderer is a Java Swing interface that defines the method required by any object that would like to be a renderer for cells in a JTable.

472 questions
3
votes
1 answer

Set row height depend on JTextArea height

I have a problem and really don't know how to solve it. I used some solutions from this forum but they don't work. This is the piece of code: package own_components.custom_components; import java.awt.Color; import java.awt.Component; import…
rainbow
  • 1,161
  • 3
  • 14
  • 29
3
votes
2 answers

Component.getWidth() returns 0 in different context

I have a custom TableCellRenderer for which I want to display a different tooltip depending on where in the cell the mouse is positioned. The issue I'm running into is that getWidth() is always returning 0 when called from getToolTipText. Here's an…
DannyMo
  • 11,344
  • 4
  • 31
  • 37
3
votes
3 answers

How do I add an empty row to JTable?

is there any way to an add empty row to jtable, where the first column is boolean, so it won't display the auto-generated checkbox? I need it to separate groups of rows. I tried using the code below, but it is NOT working: model.addRow(new…
Michal
  • 53
  • 1
  • 6
3
votes
4 answers

Apply a TableCellRenderer on a single cell

I am trying to be able to color separate cells in a JTable, but I got only so far to apply a TableCellRenderer on a whole column, which then obviously malfunctions. I have a custom JTable: public class JColorTable extends JTable{ (...) public…
Martin Melka
  • 7,177
  • 16
  • 79
  • 138
3
votes
1 answer

Java - Is it possible to put an image and a String in the same JTable cell?

I know how to put a String into a JTable cell, and I know how to put an image into a JTable cell. But is it possible to put an image and a String into the SAME JTable cell? The reason for this is that I have a 'status' column in my JTable, which at…
ban-geoengineering
  • 18,324
  • 27
  • 171
  • 253
3
votes
2 answers

JTable setCellRenderer to format a text field to date?

I have a SQLite database with a date stored as VARCHAR (yyyy-mm-dd), for example '2013-01-25'. My query retrieves the records from the table and displays it as stored. I need to display the VARCHAR data in my JTable as 'Friday January 25, 2013'. I…
Paul
  • 117
  • 1
  • 1
  • 9
3
votes
1 answer

Table Cell renderer using Nimbus and Scala

I asked this question about a problem I was seing with a cell renderer using the Nimbus look and feel and the issue has turned out to be possibly to do with Scala. Basically I have a cell renderer which extends Panel (as opposed to…
oxbow_lakes
  • 133,303
  • 56
  • 317
  • 449
3
votes
3 answers

How to write a custom DefaultTableCellRenderer to colorize specific cells and "preserve" the color of the others, Java

I'm using netbeans with its gui builder in order to create a desktop application. To colorize special cells in my jTables I have implemented a custom DefaultTableCellRenderer based on example code. So far it works. My problem is the else case of the…
3
votes
1 answer

Specify column-specific TableCellRenderers for a JTable

I have a JTable with multiple columns that display doubles, some of which are ratios, and others of which are dollar values. I'd like to specify a TableCellRenderer to be used for the ratios, and another for the dollar values. The java tutorials…
Peter Berg
  • 6,006
  • 8
  • 37
  • 51
2
votes
1 answer

Setting color in a row of a Jtable

I need help. I have two tables. In the instruction table., each row must be highlighted according to what instruction is being execute in the pipeline stages. Say for example., at time t10, I5 is in IS stage, so I5 in instruction table must be…
Celine
  • 475
  • 1
  • 7
  • 7
2
votes
5 answers

How to Compare the Current Date and a given Date in a Jtable?

Good Day. I've got another problem related to Jtable. I want to change the row color of a table if the date inside column (expiry) exceeds or is equal to the current date. I tried this code but i get an error: java.lang.NumberFormatException: For…
zairahCS
  • 325
  • 5
  • 11
  • 17
2
votes
1 answer

Table Cell Renderer for enum

I have a table with two columns: attribute and value! Attribute is an enum. Now I set a cell renderer for the enum class (should be displayed in lowercase). The problem is: the table never call the renderer! Enum (just an example): public enum…
Marcel Jaeschke
  • 707
  • 7
  • 24
2
votes
1 answer

Add Image in JTable without using renderer

I need to add image in Jtable cell without using TableCellRenderer.If i Use the following code means it display the name (string) in that particular cell instead of image.how to do this?. ImageIcon Icon= new ImageIcon("Blank.gif"); …
javalearner
  • 103
  • 5
  • 11
2
votes
1 answer

JPanel as TableCellEditor disappearing

I've made a custom TableCellRenderer that displays a JPanel. When the JPanel contains interactive elements I want those to work too, so I made a custom TableCellEditor. It works, but there is some weird behavior when clicking through the JPanels.…
siebz0r
  • 18,867
  • 14
  • 64
  • 107
2
votes
2 answers

Why am I getting a "cannot find symbol" error in Java?

@Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { // *** here *** Component c = super.getTableCellRendererComponent(table,…
Maxi Dee
  • 61
  • 2
  • 6