Questions tagged [jtableheader]

JTableHeader is the Swing component which manages the header of the JTable.

JTableHeader is the Swing component which manages the header of the JTable. It displays the column headers and unlike other rows stays visible on top as the table scrolls vertically in JScrollPane.

JTableHeader also handles resizing, rearrangement and sorting of columns in response to mouse inputs.

201 questions
5
votes
3 answers

How do I get a JTable header to display entire column names instead of shortening them?

I've a JTable that I fill with a class that extends AbstractTableModel. The problem is that the columns are too short to display the column name. I've turned off Jtable AutoResizeMode property, but shortening still occurs. How do I solve this?
gotch4
  • 13,093
  • 29
  • 107
  • 170
5
votes
1 answer

Nimbus TableHeader was not highlighted as 'pressed'

The JTableHaeder has no 'pressed' highlighting by default. (Nimbus) NimbusDefaults says it has a default [Pressed] background painter. What should I do, to see this when i click on the TableHeader? UPDATE 1 The NimbusStyle.getExtendedState returns…
oliholz
  • 7,447
  • 2
  • 43
  • 82
5
votes
1 answer

unable to set column width after jtable becomes visible

I've read Oracle's API hundreds of times, read countless articles, both here and elsewhere, and i still cannot resize columns after the jtable becomes visible. As you can deduce, i'm also trying to set the visibilty of the columns using jcheckboxes.…
johnny
  • 258
  • 2
  • 12
5
votes
2 answers

JComboBox fails to expand in JTable TableHeader

I have read through the majority of the JTable/JComboBox responses to other questions of this ilk, but haven't yet found a solution to my problem. I have created a table that has JComboBox TableHeader elements. None of the JComboBox elements will…
Todd
  • 1,895
  • 4
  • 15
  • 18
5
votes
3 answers

Java JTable Column headers not showing

My code (Logic-wise) is all good, the only problem is that the column headers do not show up in the 2 tables (table and tableS, one for teacher and one for student details). How do I make them show? import javax.swing.*; import…
Matthew Cassar
  • 223
  • 2
  • 5
  • 13
4
votes
1 answer

How to center content of JTable Headers at Nimbus Look and Feel

How can i center the content of JTable Header which has a nimbus look and feel? I tried to use DefaultTableCellHeaderRenderer, but it look like this; is there any way to make them all look like PARENT_ID column's and centered?
MOD
  • 1,070
  • 3
  • 19
  • 41
4
votes
2 answers

Java: Override table cell renderer, but with default background and properties

If you want to add a custom renderer, normally, you'd either extend some JComponent (like JLabel) and implement TableCellRenderer, or you'd extend DefaultTableCellRenderer. However, in either case, what I find is that the cell style is completely…
Timothy Miller
  • 1,527
  • 4
  • 28
  • 48
4
votes
4 answers

JTable Headers and Spacer Rows

I'm new to Swing and have been struggling with the JTable component today. Because I'm trying to make a somewhat-fancy table I haven't been able to find the particular answers I'm looking for anywhere yet. I would like to have a "group" of headers…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
4
votes
3 answers

JTable header text wrapping for multiline header (custom TableCellRenderer)

How can I obtain a multiline JTable header where the header column correctly enlarges to fit some text and then wraps to a new line? Something like shown below: Currently searching for the above requirements returns a lot of solutions of which none…
sarah.ferguson
  • 3,167
  • 2
  • 23
  • 31
4
votes
1 answer

Displaying additional icon on the left side of a JTable column header (Nimbus)

I want the column headers of my JTable to get an additional icon on their left side when their values are the base of the table's rowFilter. The sorting icon shows on the right side, so "glueing" the two icons into one doesn't count (although I also…
ssr
  • 93
  • 6
4
votes
1 answer

Nimbus - override color for TableHeader

I would like to override the background color of headers in JTables when using the Nimbus L&F. I'm effectively "theming" the Nimbus L&F, i.e. making small adjustments to it. Whatever I try it doesn't seem to have effect. Here's an SSCCS : public…
peterh
  • 18,404
  • 12
  • 87
  • 115
4
votes
1 answer

Java JTable header word wrap

I am trying to get the header on a table to have word wrap. I have managed to do this but the first data row is expanding. The code for the table is: public class GenerateTable extends JTable { private JCheckBox boxSelect = new JCheckBox(); …
user4031188
4
votes
1 answer

JTable Row Header Look And Feel

I am trying to create row headers for my JTable. I've done my research here and here, but there is almost nothing out there. What I found did not keep the system look'n feel. This is what I've found so far: The first column (the one with no name)…
AyoyeSnif
  • 130
  • 2
  • 6
4
votes
2 answers

Creating a JTable with alternating row colors

I am pretty new to java swing and i just started working on JTable. I want to create a JTable Which look like the above image? Can anybody help me beacause i am not so familiar with JTable?
Nikhil
  • 2,857
  • 9
  • 34
  • 58
4
votes
1 answer

Drag-n-Drop JTableHeader

I'm using JTable + JScrollPane + DefaultTableModel. I need to implement Drag-n-Drop on JTableHeader. I want to drag a column header to my component and do some work depending on the column dragged. I've tried setTransferHandler() on my JTableHeader…
Afel
  • 71
  • 5
1
2
3
13 14