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

How can I set a JLabel's background and border the same as a table header?

I want to recreate a table header looks using JLabel. The look and feel of the JLabel needs to be exactly like the JTableHeader would be, specified by the system. This is what I have tried so far: JLabel header = new…
Igor
  • 1,532
  • 4
  • 23
  • 44
2
votes
1 answer

Creating row headers for JTable at run time

I have just started working with JTable. This is my table example. The add row button adds rows to the table. I want to create row headers for this table. How can I achieve this? Can any one help me please? The code for the sample table…
Nikhil
  • 2,857
  • 9
  • 34
  • 58
2
votes
1 answer

JTable doesn't show columns names

here is my code: public class DownloadMainView extends JFrame{ private ArrayList downloadList = new ArrayList(); private JMenuBar menubar = new JMenuBar(); private JMenu m_task = new JMenu("Tasks"); …
Songokute
  • 687
  • 1
  • 9
  • 17
2
votes
2 answers

Accessing a JTextField in JTableHeader

I have made a TableHeader renderer that will create a JTextfield under the Label of the header in a JTable. The problem i got now, i never get focus/access to this JTextfield in the header. I found out that a TableHeader renderer only draws the…
d0n
  • 21
  • 1
  • 2
2
votes
2 answers

Java JTable cannot set width of column

I try to set width for the columns, but it didn't work at all, I have been searching for answers for hours, and here is my code, can anyone tell me what is the problem. Thanks in advance. String [] columns =…
Ga Zhua
  • 107
  • 3
  • 14
2
votes
2 answers

Scrollable Content with fixed header without using the JTable

I want to fix the header of my content so it does not scroll down with the content. Is it possible to do it with a, and if yes, could you please shed some light as to how I can go about implementing it without using a JTable.
Raymond Nakampe
  • 371
  • 7
  • 22
2
votes
2 answers

Reposition Jtable Column Header

I have to disable right click on JTableHeader so that user cannot right click over column header and drag to reposition the columns. Do we have any trick to do that? Just to mention left mouse button click works good but when user does RMB and drags…
2
votes
1 answer

No titles in JTable

Please have a look at the following code import java.awt.*; import javax.swing.JTable; import javax.swing.*; public class Table extends JFrame { private JTable table; public Table() { String[] columnNames = {"first…
PeakGen
  • 21,894
  • 86
  • 261
  • 463
2
votes
1 answer

How to set a cursor for Header of JTable?

I used setCursor() method to set a cursor for JTable.But that cursor is applying only for rows (datapart) of the table.How can I set cursor for Header of the same table,so that I can resize the column by double clicking its(column's) right edge?
svkvvenky
  • 1,122
  • 1
  • 15
  • 21
1
vote
2 answers

Custom Jtable Header has different layout then the other headers

I have a table with 3 columns, the first column is special and contains a checkbox instead of a title. The problem is that the layout (appareance) of the checkbox header is different from the other headers. Can anyone help? The Code: import…
Adel Boutros
  • 10,205
  • 7
  • 55
  • 89
1
vote
1 answer

JTableHeader table header cell border

I am using this code: Border border = BorderFactory.createLineBorder(Color.green); DefaulTableModel dtm= new DefaultTableModel(); dtm.addColumn("Srno."); dtm.addColumn("Product"); JTable table = new…
Usman Ahmed
  • 79
  • 2
  • 3
  • 11
1
vote
0 answers

How to render JTableHeader when using headless mode?

I'm trying to render a png image from JTable and using headless mode. JTable's main area is rendered. But JTableHeader area can't rendered.And when I call JTableHeader#getPreferedSize(), JVM is crashed by getting theme for rendering. Has anyone…
1
vote
0 answers

Add Menu item or Menu to JTable column header in Java

Is it possible to add some Menu type (drop down) or a menu item to the column header of JTable in Java swing? If possible please tell me the approach that I can use.
Vinay Bedre
  • 366
  • 1
  • 6
  • 16
1
vote
1 answer

how to add gradient background to JTable column header?

Hi how to set gradient background to column header ? I have Jtable: JTable table = new JTable(4, 5); and try to setColor: table.getTableHeader().setBackground(Color.blue); but with no succes color of column header is still same and these is just…
hudi
  • 15,555
  • 47
  • 142
  • 246
1
vote
1 answer

hide tableHeaderView after insert/delete operation in UITableView

I have UITableView with UISearchBar located inside tableHeaderView I want to keep header view invisible until user scrolls up so I do: self.tableView.contentOffset = CGPointMake(0, self.searchBar.frame.size.height); My problem is that after I do…
Marcin
  • 3,694
  • 5
  • 32
  • 52