Article View: borland.public.jbuilder.java.swing
Article #10112Re: JTable: isCellEditable
From: Ernesto Bascón Pantoja
Date: Mon, 08 Nov 1999 00:00
Date: Mon, 08 Nov 1999 00:00
36 lines
1906 bytes
1906 bytes
Hi: Well, your overridden getTableCellRendererComponent(...) method receives a column as parameter. Its value is the index of the "viewed" column, not the index of its model, so, to obtain the right value, you must use: int modelColumn = myTable.convertColumnIndextoModel(columnParameter); and work with it to render the cells. Saludos Ernesto Michael Kintzer wrote: > I have a JTable constructed with a subclass of DefaultTableModel. In my > implementation of MyDefaultTableModel, I override isCellEditable to > return true or false conditionally based on the value in a particular > column. If the cell is not editable, I use a renderer to render the > cell's background gray. > > My problem is that if the column's are moved around, in some cases, even > though isCellEditable is (correctly) returning false, and the renderer > is correctly showing the gray background for what should be a > non-editable cell, the JTable prepares an editor anyway. The reverse is > also true, after I move the columns around. i.e. isCellEditable returns > true (correctly), and the renderer paints a white background (again > correctly), but the JTable fails to create an editor. Is this a bug in > JTable? > > Thanks for any insights, > > Michael Kintzer
Technical Details
Message-ID:
<38274D3C.411BF839@estudiantes.ucbcba.edu.bo>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38271072.A2C78F4E@atm.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,c849c62cef13890 X-Google-Attributes: gid111d45,public From: Ernesto Bascón Pantoja <bascone@estudiantes.ucbcba.edu.bo> Subject: Re: JTable: isCellEditable Date: 1999/11/08 Message-ID: <38274D3C.411BF839@estudiantes.ucbcba.edu.bo> X-Deja-AN: 546092372 Content-Transfer-Encoding: 7bit References: <38271072.A2C78F4E@atm.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: UCB Mime-Version: 1.0 Reply-To: bascone@estudiantes.ucbcba.edu.bo Newsgroups: borland.public.jbuilder.java.swing