• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

The Header Of JTable

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excuse Me,
I have a problem as the following.
In AbstractTableModel,the cell's editalbe can be set by the function [ isCellEditable(int,int) ].If I want to edit the header of each column same as editing a cell,how can I do? Please give me some adivices.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Yamashita,
As far as I know, you cannot edit the "JTableHeader". I can't imagine why you would want to.
This is just a suggestion for a possible workaround -- but note that I haven't tried it myself, so I can't really help you much with the implementation of this suggestion.
Perhaps you could not display the "JTableHeader" at all, and set up the first row of your "JTable" so that it looked like the "JTableHeader" -- then you could make that editable, and thus give the impression that the "JTableHeader" is editable.
I know that if you don't place your "JTable" in a "JScrollPane" (just put it in a "JPanel" instead), then the "JTableHeader" is not displayed.
Hope this helps.
Good Luck,
Avi.
 
yamashita lee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,Avi.
Thanks a lot for you help.I think your suggestion is useful to my problem.Now I am trying it.
These days I am making a tool for editing csv-file.Before the csv is made,I don't know number of it's rows and columns,of course inculdes the title.So I'd better edit header of the JTable.
I have ever thought another way this morning.Maybe can add a Mouse event on the header,after click the right-key,a popup-panel with a textfield will be out.I can input header's value into this textfield,then press "ok" button for returning the value to header and accomplish the editing.But by this way,the operation of my tool must become complex,so if your suggestion can be successed, it must be my first choice.
Thank you very much.
Yamashita.lee
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic