🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #992

Re: JTableHeader why not editable?

#992
From: Daniel
Date: Sun, 15 Aug 2004 04:54
45 lines
2860 bytes
hi,

the fact that you are returning the jtextfield as the renderer will not make
the header editable: the framework will just use your control's paint method
to actually render the current header cell and that's it.

for example to have the cell editable, the framework actually gets the edit
field, put it in the appropriate place, make it visible and set the focus to
it. This is the editor, different from the renderer.

This complicated thing is not implemented for the header. If you really want
this you will have to implement it yourself and it will take you some time,
it's quite a challenging stuff...

Daniel

"ftirapelle" <ftirapelle@yahoo.it> wrote in message
news:e16fe653.0405251209.6ca0a1c@posting.google.com...
> Why is the JTableHeader not editable. I want to create an editable
> JTableHeader but I cannot understand why if I use the
> setHeaderRenderer method the header is not editable.
> I have seen
(http://www.esus.com/javaindex/j2se/jdk1.2/javaxswing/editableatomiccontrols
/jtable/jtableeditableheader.html)
> an example of editable JTableHeader. But why isn't enough the follow
> code
>
> ....
> TableColumnModel colModel = jTable1.getColumnModel();
> for (int col = 0; col < jTable1.getColumnCount(); col++)
> {
> colModel.getColumn(col).setHeaderRenderer(new HeaderFilterRenderer());
> }
> .....
> class HeaderFilterRenderer implements TableCellRenderer
> {
>
> public Component getTableCellRendererComponent(JTable table, Object
> value,
> boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex)
> {
> return new JTextField ();
> }
>
> }
Technical Details
Message-ID: <5fWdnSBZR_TmcYPcRVn-uw@giganews.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
References: <e16fe653.0405251209.6ca0a1c@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,25eaa480b655c4b7
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 14 Aug 2004 23:54:19 -0500
From: "Daniel" <dgabrov1@yahoo.com>
Newsgroups: borland.public.jbuilder.java.swing
References: <e16fe653.0405251209.6ca0a1c@posting.google.com>
Subject: Re: JTableHeader why not editable?
Date: Sun, 15 Aug 2004 00:54:13 -0400
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <5fWdnSBZR_TmcYPcRVn-uw@giganews.com>
Lines: 47
X-Trace: sv3-2BIVFQEsQKKWB0PQkaPlxNCy2A/PpnmsDhS5hh6gNN+cb/wTqD0aMHqeZQD21DOa7uQGT4z01FeiBUM!khXe0ComFfKvMcTa20QgYJnuEzs7limTbpOULInT0iiQEXtOq+XJimDYI46mhg==
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.13