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
2
votes
2 answers

Java - Jtable Color

import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import java.awt.*; public class Fenetre extends JFrame implements TableCellRenderer { private static TableCellRenderer tcr; …
2
votes
1 answer

JButton in single table cell java, not entire column

I have been researching JTables fairly thoroughly, and have found some brilliant resources that explain how to set the CellRenderer and CellEditor for columns, but have found that trying to set the Renderer and Editor of a single cell is a little…
Stevo
  • 397
  • 6
  • 26
2
votes
2 answers

How to create a Look&Feel aware TableCellRenderer?

All the examples I can find of custom TableCellRenderers all seem extend DefaultTableCellRenderer. Nothing wrong with that, I guess, except that you do not get to extend the TableCellRenderer functionality of whatever is the current Look&Feel. This…
peterh
  • 18,404
  • 12
  • 87
  • 115
2
votes
1 answer

How to add a table, with one row made of JComboboxes, on top an existing JTable

I am trying to add a one row JTable on top of an existing JTable which is usually created dynamically and which changes its data model quite often. As you can see the yellow area represents just a row counter and It has been created using this…
QGA
  • 3,114
  • 7
  • 39
  • 62
2
votes
1 answer

JTable color cells permanently when I click button

I want to create a JTable and color its cells permanently by the click of a button (pretty like excel in coloring cells).So far, every cell I select, it gets in an ArrayList. First of all, I want for every cell in the list to be colored…
Vassilis De
  • 363
  • 1
  • 3
  • 21
2
votes
2 answers

Reduce the size of a custom render component within JTable cell

I have a JTable in which the final column displays a custom cell renderer (a JButton). Is it possible to reduce the width of the JButton within it's column so that it is only large enough to display it's text? I would rather not reduce the size of…
Hungry
  • 1,645
  • 1
  • 16
  • 26
2
votes
1 answer

JXTable: use a TableCellEditor and TableCellRenderer for a specific cell instead of the whole column

I have a JXTable compound of 6 columns and two of them are JCheckBox. I would like to have the following behavior: If the first checkbox is checked, the second checkbox is enabled and can be checked or not. If the first checkbox is unchecked, the…
ivan0590
  • 1,229
  • 11
  • 18
2
votes
1 answer

TableCellRenderer does not change value when TableCellEditor sets a new value

I am a software developer apprentice and have to write a graphical project specific configuration editor for my company. I load the data from the configuration excel file of the project with Apache POI and wrap the data into ConfigValue Objects. For…
2
votes
1 answer

Why does auto adjust of rowheight not work in Jtable

i've implemented updateRowHeights, method to auto adjust the height of rows in Jtable, but it doesn't work although my code works fine so far. Did I got forgot anything? (see: Auto adjust the height of rows in a JTable) here is my code: import…
Ramses
  • 652
  • 2
  • 8
  • 30
2
votes
1 answer

JTable- How to change Font for a specific column header

I want to change the font for the header of the selected column on JTable. I tried to do that on my ColumnHeaderRenderer as follow : public class ColumnHeaderRenderer extends JLabel implements TableCellRenderer { public ColumnHeaderRenderer(JTable…
blackbishop
  • 30,945
  • 11
  • 55
  • 76
2
votes
1 answer

Add cellpadding to a Java JTable

I'm trying to implement a Swing JTable. I followed the tuorial on http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#simple I want the table cell's not to be editable (this works) and I want the table cells to have more padding to…
ToFi
  • 1,167
  • 17
  • 29
2
votes
1 answer

mouse event when mouse is getting out of JTable?

I use JTable, and have a MouseMotionAdapter listens to the mouse, and coloring the line of the mouse at any given moment. addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) …
user1028741
  • 2,745
  • 6
  • 34
  • 68
2
votes
1 answer

JTable header background color

I'm trying to put background color on the JTable header but it seems that it doesnt change the header's color this is my code for my JTable.. what am I doing wrong? Color headerColor = new Color(25, 78, 132); itemTable = new JTable(){ …
Criz
  • 77
  • 4
  • 12
2
votes
2 answers

JTable all column aligned right

Is there a way to align all the column in jtable at the same time? using this: DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment( JLabel.RIGHT…
Mohammed Falha
  • 967
  • 8
  • 22
2
votes
1 answer

Java JTable sort with TableCellRenderer

I'm somewhat new to Java and I'm having problems with JTable with sort and TableCellRenderer. I have a table with 15 columns populated with values where on some columns I use the TableCellRenderer to change the color of foreground to green or red…
JLongo
  • 23
  • 5