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
36
votes
3 answers

How can I put a control in the JTableHeader of a JTable?

Given a JTable with a column of type Boolean.class, the default renderer is a JCheckBox. It's easy enough to select individual cells based on a user selection, but it may be convenient to select all or none of the check boxes, too. These recent…
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
31
votes
13 answers

JTable Right Align Header

Basically, I have a JTable containing columns with right-aligned cells but left-aligned headers which looks really bad. I would like to right-align the headers of these columns without altering the "Look and Feel" of the headers. Thanks
Drew Galbraith
  • 2,216
  • 4
  • 19
  • 22
19
votes
5 answers

How can I change the font of a JTable's header?

I want to set the JTable header's font. Do you know how?
Stefanos Kargas
  • 10,547
  • 22
  • 76
  • 101
17
votes
6 answers

How to change JTable header height?

Title explains the question. How can I easily do that?
Anubis
  • 6,995
  • 14
  • 56
  • 87
14
votes
2 answers

How to use Renderer for TableHeader

Even I read and test answers by @kleopatra How do I correctly use customer renderers to paint specific cells in a JTable? particular one table header color java swing about super.getTableCellRendererComponent(...) must be last code line before…
mKorbel
  • 109,525
  • 20
  • 134
  • 319
14
votes
3 answers

JTable Multiple Header Rows

I am using a JTable in my application and wish to have 2 rows for headings, similar to this: Is this even possible or will I have to do something else? If so, what? Using Supertitle-titleA, SuperTitle-titleB will take up too much space and make…
Jonno_FTW
  • 8,601
  • 7
  • 58
  • 90
13
votes
3 answers

How to merge cell in DefaultTableModel/JTable?

I searched a lot and got some answers for this Q. but many of them referred to links which give 404 error. I want to make table like this: Is there any method in java for this?
Nikhil Chilwant
  • 629
  • 3
  • 11
  • 31
11
votes
7 answers

How can I change JTable's header background color?

I've tried: table.getTableHeader().setBackground(Color.BLACK); Doesn't work. EDIT: This code doesn't work in my project only. Works in other projects. I may have changed a property that stops the color from changing. Or maybe NetBeans has some…
Stefanos Kargas
  • 10,547
  • 22
  • 76
  • 101
8
votes
2 answers

Merged Header Above a JTable Header in Java

I would like to put some extra merged cells for grouping reasons on the top of my table header. I found something similar to this, answered in thislink from this forum, but also what I need exactly seem to be here that is not answered (.NET)…
Vagelism
  • 601
  • 1
  • 16
  • 27
8
votes
2 answers

Setting column headers in JTable

I have the following JTable which uses a table model: http://s17.postimage.org/7zfh3l4lr/Screen_Shot_2012_03_10_at_15_11_31.png Instead of using, A,B,C,D etc. how can I define my own table names. This is my code Here is the code for my table model,…
Soler Mani
  • 301
  • 3
  • 5
  • 15
8
votes
5 answers

Set Column Width of JTable by Percentage

I need to assign a fixed width to a few columns of a JTable and then an equal width to all the other columns. Suppose a JTable has 5 columns. The first column should have a width of 100 and the second one a width of 150. If the remaining width of…
Tom Tucker
  • 11,676
  • 22
  • 89
  • 130
6
votes
2 answers

Add ActionListener to Column Header of JTable

Is it possible to add an ActionListener to a column header for JTable. Here is my table Now, I want to add an ActionListener to the column headers (e.g. WQE, SDM) I would like to be able to show the column description in another window.
Parag
  • 7,746
  • 9
  • 24
  • 29
6
votes
2 answers

Highlighting a column header of a JTable

i'm currently building a little JTable, and want to highlight the column header (and row headers - the row-header part is actually working) when a cell is selected to make it easier to find the associated names with this cell. Here is a picture: I…
wlfbck
  • 554
  • 8
  • 22
6
votes
1 answer

Can `JTableHeader` span over multiple columns?

I've spent quite some time searching for this and I've only found the GroupableHeader code. I need one header over 2 columns in a 2 column JTable. How can this be done without the use of the infamous GroupableHeader, while keeping the default look…
Igor
  • 1,532
  • 4
  • 23
  • 44
6
votes
2 answers

Editable JTableHeader

Possible Duplicate: Accessing a JTextField in JTableHeader How to make JTableHeader as editable. F.e. i make ColumnHeader as JTextField. What must i do to make JTextField editable. See the example: import java.awt.*; import javax.swing.*; import…
user1775928
  • 61
  • 1
  • 2
1
2 3
13 14