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

Building a concurrent TableColumnAdjuster for JTable

I copied a TableColumnAdjuster class which seems to be pretty popular. http://tips4java.wordpress.com/2008/11/10/table-column-adjuster/ However, the JTables I am developing are dynamic and can have a large amount of data flow in and out of them (as…
tmn
  • 11,121
  • 15
  • 56
  • 112
1
vote
0 answers

Fixed Header in Jtable

Is there any way to freeze the header and make the content scrollable in JTABLE? if yes, could you please shed some light as to how I can go about implementing this. Thanks
Krishna
  • 1,332
  • 5
  • 20
  • 35
1
vote
1 answer

Real Time jTable column resizing

I am working on a project where I add the column names from mysql into jTable. I want that when a name is added, the column should adjust its size according to the length of column name. I will make myself clearer, but first heres the existing…
user3271166
  • 573
  • 1
  • 6
  • 17
1
vote
1 answer

JTable Missing Column Headers

Really simple question. Don't bash me please. :) I created a table model by extending AbstractTableModel as follows: public class InventoryTableModel extends AbstractTableModel { private static final String[] COLUMN_NAMES = { "On Sale", "Name",…
Jan Tacci
  • 3,131
  • 16
  • 63
  • 83
1
vote
3 answers

Displaying sort icons in JTable header without using the build in sort mechanism

Does someone know a good way to display the sorting icons in the header of a JTable, without using the build in sort functionality? The sorting is done by the table model (actually a database) and not by the JTable itself. Thats why the automatic…
user3190008
  • 23
  • 1
  • 5
1
vote
3 answers

Jtable retain column width

I've a Jtable in which i'm setting data using setDataVector function.It's working fine but suppose if i have changed some column width simply by dragging using mouse and after that new data loads in the same table then the width of that column reset…
avinash
  • 163
  • 2
  • 12
1
vote
2 answers

Show Column Header on dragging column

i implement the code in GroupableHeader and try to enable the reordering allowed but i have two problems: 1: When dragging a column the header don´t see over the column 2: How restrict the dragged area of the column to prevent the column exit of…
1
vote
1 answer

Create custom table model with column header in java

I'm developing a software for my friend.I have developed 90% of my project and my problem is I have a table which I fill with data in database.I have used a custom table model to fill jtable. It fills data perfectly but the problem is it doesn't…
1
vote
1 answer

JTable: set column width based on header size

I have a JTable and header contains string of different type: table = new JTable(new DefaultTableModel(info, myHeader){ public boolean isCellEditable(int row, int column) { //disable table editing return false; …
giozh
  • 9,868
  • 30
  • 102
  • 183
1
vote
1 answer

JTable identifier won't show

My JTable identifiers won't show up. I have tried a lot of different things but not even a little change has come.. So now I'm asking here. My code: public void showTable() { String[] heads = {"PersonID", "Name", "Date", "Age"}; …
1
vote
1 answer

Java JTableHeader styling

I want to accomplish a similar header style to this: How could this be accomplished? All i have so far is: JTableHeader header = table.getTableHeader(); header.setBackground(new java.awt.Color(239, 235, 230)); header.setForeground(new…
Alosyius
  • 8,771
  • 26
  • 76
  • 120
1
vote
1 answer

How to set Title in JTable

I am newbie in java and wanted to set table header in jtable i have taken array but not able to set header please guide me. I have tried setting through taking instance of JTable but didnt help. also tried table.setmodel. thanks import…
nick
  • 41
  • 1
  • 10
1
vote
1 answer

JTable headers on left side and cells on right [explained with image]

As second picture says, I want to anchor 'HeaderModel' left and 'CellModel' right. If its possible...
jovanMeshkov
  • 757
  • 5
  • 12
  • 29
1
vote
2 answers

JTable Column header

I'm trying to display more detailed column headers, without using the database column names supplied by DbUtils.resultSetToTableModel(). Here is my code: ResultSet rs = null; PreparedStatement pst = null; String sql = "SELECT * From product"; String…
san88
  • 1,286
  • 5
  • 35
  • 60
1
vote
1 answer

Unable to display header for jTable

These are my codes for my jTable in java swing. private JTable getJTable() { if (jTable == null) { Vector columnNames = new Vector(); //Vector class allows dynamic array of objects Vector data = new Vector(); JPanel panel…
GabrielHeng
  • 63
  • 1
  • 11