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

how do you left-align text in JTableHeader?

I've tried the following, foo.getTableHeader().setLayout(new FlowLayout(FlowLayout.LEFT)); where foo is the JTable instance, but the text remains centered. Why?
mre
  • 43,520
  • 33
  • 120
  • 170
1
vote
1 answer

Adding JButton to the JTable

In swing, is there any possible to add a button on the header of the table. Need the swing implementing the above post. Thanks in advance.
deva
  • 141
  • 1
  • 1
  • 9
1
vote
1 answer

How to insert data into swing table whose columns are dynamically defined (data from a mysql database)?

I have a table and on a opening of a frame the table receives its columns and their respective headers from a table in mysql database. How can i insert all the values from the sql database table into the swing table?? Here is my…
vgpune
  • 13
  • 3
1
vote
2 answers

Java JTable head not showing

Have a table I want to show in a panel when I click on a button. I am able to get the table to show, but I am not able to the header to show. Have also tried using the JscrollPane, but here nothing shows ups at all. Main part of code: public class…
1
vote
1 answer

How to set JTableHeader Look and Feel AND Color

this is my first post so any suggestions for how to make my post better would be awesome! With the help of research from this website, I am able to generate a table that I can change the font of, change the alignment of, and maintain the current…
1
vote
1 answer

using JTable as JScrollPane's columnHeader while maintaining width of each column

just looking for a quick answer: is it possible to use a JTable as a JScrollPane's columnHeader? I have a configed JTable with different column width and column title, and plan to use the header as the columnHeader of a scrollpane. How can I achieve…
boreas
  • 1,041
  • 1
  • 15
  • 30
1
vote
2 answers

No Headers In JTable

The Jtable doesn't show column headers. I'm using vectors to populate the JTable, but still it doesn't seem to work. Here's the code: public class InsertFileToJtable extends AbstractTableModel{ Vector data; Vector columns; private String[] colNames…
Ingila Ejaz
  • 399
  • 7
  • 25
1
vote
0 answers

Java: Clean way to add a checkbox to the column header?

Possible Duplicate: How can I put a control in the JTableHeader of a JTable? I am trying to create a table that contains columns which has a checkbox that can be toggled. I followed the code example from here but it becomes progressively…
Foo
  • 293
  • 1
  • 3
  • 14
1
vote
2 answers

Java JTable: How to render left column cells for simple row header purposes

My aim is to create a JTable, and render the far left column cells only, with the aim of creating row headers for the table. All row table examples I have come across online seem convoluted or do not fit my purposes, so I am wondering is there a…
Php Pete
  • 762
  • 3
  • 14
  • 29
1
vote
1 answer

Dispatching event for specific component only in java

I would like to customize JTableHeader so it would offer serval actions (for example 2 buttons which one of them would sort column and second show properties of this column etc). Unfortunately it is not possible to set CellEditor for JTableHeader so…
user1079475
  • 379
  • 1
  • 5
  • 17
1
vote
1 answer

Spacing JTable header

I know spacing JTable cells are pretty straight forward as shown below; int gapWidth = 10; int gapHeight = 5; table.setIntercellSpacing(new Dimension(gapWidth, gapHeight)); Spacing like this doesn't seems to affect the tables header. Is there a way…
Bitmap
  • 12,402
  • 16
  • 64
  • 91
0
votes
2 answers

Adding actionlistener of column in a jtable

Hi everyone.. I need some help again. :) How to do this? When I click the column t1, another form must pop-up explaining what happens to column t1, say, at time 1, Instruction 1 is in fetch stage. Then, when I click naman t2 column, Instruction 2…
Celine
  • 475
  • 1
  • 7
  • 7
0
votes
1 answer

ActionListener on JButton in JTable header freezes application

I have a JTable which uses a JButton for one of the headers on a column. Without an ActionListener the button seems to function normally, I can see it visually click. However when I add in an ActionListener which should pop up a JOptionPane the…
Lithium
  • 5,102
  • 2
  • 22
  • 34
0
votes
0 answers

How to keep selections and make sorting to work on AbstractTableModel in java when the cells are updating frequently?

I'm using AbstractTableModel, enabled sorting and multiple row selection. the cells are being updated for every 4 secs, when I enable this populating services, sorting is not working and the selected rows gets unselected. This is the TableModel I'm…
0
votes
1 answer

Change JTabel header renderer with JCheckBox

enter image description here Hi All, I'm trying to add a checkbox in Jtable header to select and deselect all, that is working fine except that the header renderer is different that the rest of the cells. can you please help me to place the checkbox…