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
1
vote
1 answer

Disable JTableHeader update after row sorting

I customized a Jtable headers with a TableCellRenderer so filter icon would appear, and as the user clicks on the filter icon, a pop-up filter like excel's appears (picture 1). However, if the user clicks on the text of the header, a row sorter is…
TomC
  • 55
  • 3
1
vote
1 answer

Customizing JTable

Good Day. If the JLabel and JTextField font size can be changed as desired, is it possible to change also the font style (size, face, color) of the column names and elements of a JTable? Adding more, I'm using the Look and feel of Windows. Thanks,
Cyril Horad
  • 1,555
  • 3
  • 23
  • 35
1
vote
1 answer

How do I display the header row in a JTable that uses AutoBinding against model

For some reason my header row is not visible. I am using SwingBindings.createJTableBinding to bind a pojo to the table. My table is showing all the rows however the header row is not visible. If I inspect the JTableHeader in the table is there and…
JeffV
  • 52,985
  • 32
  • 103
  • 124
1
vote
1 answer

Change column header in JTable if i know column position

Can I change column header in Jtable tab from "Name" to "Surname" if I know column position? I want to change column name in second or first tab, not last one. With this code I can change only column header in last tab. I have 4 tabs. JTableHeader…
user437630
  • 147
  • 2
  • 4
  • 10
1
vote
2 answers

Change column header in a JTable

This is my table right now : This is the code that I can change the column title: table.getColumnModel().getColumn(0).setHeaderValue("Lecturersssss"); But the column title would not change until I hover the mouse on the Lecturer column header.…
Nathan Drake
  • 311
  • 3
  • 16
1
vote
2 answers

Wrong column being sorted when JTable Header clicked

I have the following code for a RowSorterListener. The purpose of this is to sort a column without affecting any other columns. import javax.swing.event.RowSorterListener; import javax.swing.event.RowSorterEvent; import javax.swing.JTable; import…
Dan
  • 7,286
  • 6
  • 49
  • 114
1
vote
0 answers

How to set width column AbstractTableModel

Need help how to set width column in AbstractTableModel?? i am set autoRsizeMode=Off in my table properties and i am trying like this tablePriceList.getColumn(0).setWidth(400);this code working fine when i am using DefaultTableModel but it does'nt…
1
vote
2 answers

Set JTable header horizontal alignment based on value renderer column alignment

I've looked through a number of questions/answers on setting JTable header alignment, but they don't seem to cover this case. I want my JTable headers to have the same alignment as the data below them; it looks odd to me to have them all centered,…
arcy
  • 12,845
  • 12
  • 58
  • 103
1
vote
1 answer

How do I add a Tool Tip generated from the Table Header to my JTable cells?

I have a JTable and I am trying to add a header tool tip that will display the string that is in the table header for each of the header cells. I can set the value of the header cell: colModel.getColumn(currentColumn).setHeaderValue(time +…
georges
  • 175
  • 4
  • 17
1
vote
1 answer

Change color of header at runtime

I am using below code to change the color of a table, it works fine for rows, but not for columns. DefaultTableCellRenderer defaultTableCellRenderer = new DefaultTableCellRenderer() { private static final long serialVersionUID =…
Pramod Yadav
  • 245
  • 2
  • 20
1
vote
1 answer

How to set custom order on JTable

I have a JTable with a custom JTableModel, now I want to create a custom comparator, so the user can order the all column with my custom method. I have this code: ColumnListener public class ColumnListener extends MouseAdapter { protected JTable…
bircastri
  • 2,169
  • 13
  • 50
  • 119
1
vote
1 answer

Re-Using JTableHeader

The code below displays 2 JTables. As they both will have exactly the same headers I wanted, for the sake of efficiency, to reuse the header from the first table. However running the code results in the header appearing in the second table but not…
1
vote
2 answers

JTable in Swing has no header

For some reason my JTable won't display the headers that are in my table model. Also I need the the table in a scroll pane and that seems to delete the whole table. This is in Java Swing. package table; import javax.swing.ImageIcon; import…
Skeeter62889
  • 95
  • 1
  • 2
  • 6
1
vote
2 answers

How to select a column of a JTable in JDialog by selecting a header

What I've been trying to do with a JDialog are... To select a column of JTable by clicking the header To check which column is selected by the user To get the value of the cells inside the column According to this post and this page , it would be…
Hiroki
  • 3,893
  • 13
  • 51
  • 90
1
vote
1 answer

Table header is not shown

My error is that the table headers of my two tables are not shown. Right now I am setting the header with new JTable(data, columnNames). Here is an example which shows, my problem: import java.awt.BorderLayout; import java.awt.Dimension; import…
Carol.Kar
  • 4,581
  • 36
  • 131
  • 264