Re: JComboBox into JHeader
- From: "Babu Kalakrishnan" <bkk.ngroup@xxxxxxxxx>
- Date: 28 Aug 2006 00:09:27 -0700
adil wrote:
Hello ,
i am trying to put a JComboBox into Header of a JTable, i do it by
implementing the TableCellRenderer, also i implement
getTableCellRendererComponent(Jtable.....) method to return a ComboBox.
i can see the combobox into header of my table , but i can select any items
of it, it's seems that the combobox disabled.
can somenone help me plz ?
Unfortunately, what you're trying to do is non-trivial to accomplish.
Using a custom renderer will not help you because a renderer by
definition is only something that is used to render (i.e paint) the
header cell - the component itself is NOT physically present in the
container hierarchy and hence cannot receive events which are required
for any user interaction.
The same issue also occurs if you want to insert custom components such
as say a JCombobox in the cell of a table. But the problem is easier to
solve in that case because Table cells can be made editable - and hence
defining your Custom component as a CellEditor will cause it to be
inserted at the cell location when the user clicks on the cell to begin
editing. But the Swing design of TableHeaders don't seem to allow a
Header to be editable, and so that approach doesn't work here.
The only option that I can see is to write your own version of a
JTableHeader - but I don't think it is by any means an easy solution to
implement.
BK
P.S. I haven't been active in Swing based development for about 2+
years now, and hence haven't kept track of changes in recent versions
of Swing - wonder if things have improved and there's an easier way out
?
.
- Follow-Ups:
- Re: JComboBox into JHeader
- From: Andrew Thompson
- Re: JComboBox into JHeader
- References:
- JComboBox into JHeader
- From: adil
- JComboBox into JHeader
- Prev by Date: JComboBox into JHeader
- Next by Date: Re: JComboBox into JHeader
- Previous by thread: JComboBox into JHeader
- Next by thread: Re: JComboBox into JHeader
- Index(es):
Relevant Pages
|