Article View: borland.public.jbuilder.java.swing
Article #8609Re: Button Table Cell Renderer and Editor example???
From: David W. Taylor
Date: Wed, 02 Aug 2000 00:00
Date: Wed, 02 Aug 2000 00:00
49 lines
2103 bytes
2103 bytes
Andreas, Thanks for your response. There are two easier ways to do what you describe with a check box. Unfortunately neither solves my JButton problem. The easiest way is simply not to use any custom cell renderer or editor at all. All you need to do is return Boolean.class from the overridden getColumnClass method in your TableModel. When the default code sees this, it kindly makes you a Renderer with a JCheckBox. If you need to edit the value, simply return true from isCellEditable in the same way. Bingo. The other way is to use the Default Editor and Renderers built into Swing by simply using the correct constructor. Your solution does not work well with a large value for the Row height, since the Component is automatically resized and looks really ugly. If we could figure a way to tell the button to use some sort of insets from the cell borders, then everyone would be happy. Thanks again for your help. David "Andreas Schnell" <Andreas.Schnell@innovations.de> wrote in message news:397eecc2_1@dnews... > Hi, > > > 3. See the depressed button, with normal button behavior and listen for > the > > mouse up. The mouse click should appear to be sensed by the button and > not > > the entire cell. > > I added a TableCellEditor to the Table which is a JButton, and I added > MouseListener to the button, to get the event and a TableCellRenderer which > is a JLabel to renderer the button. The Object in the cell is JCheckBox. > > works fine. > > > Andreas Schnell > > >
Technical Details
Message-ID:
<3988c7f1$1_1@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<397d2a83_2@dnews> <397eecc2_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,1230cdfdfba798ad X-Google-Attributes: gid111d45,public From: "David W. Taylor" <davidt@detayls.com> Subject: Re: Button Table Cell Renderer and Editor example??? Date: 2000/08/02 Message-ID: <3988c7f1$1_1@dnews> X-Deja-AN: 653835625 References: <397d2a83_2@dnews> <397eecc2_1@dnews> X-Trace: 2 Aug 2000 18:16:33 -0800, 216.15.88.178 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.swing X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400