🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Button Table Cell Renderer and Editor example???

#8722
From: David W. Taylor
Date: Mon, 24 Jul 2000 00:00
35 lines
1632 bytes
Hi!

I have just spent a couple of days wrestling with the task of creating a
clean JButton cell Renderer and Editor pair of classes.

My requirements were simple:

1. Make a JButton appear in a JTable Cell

2. Sense the user clicking on the button or tabbing to it and pressing the
Space bar.

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.

4. Allow the JButton to have a maximum size so that the button does not grow
to the size of the containing cell

5. Respond to the click/keystroke in the creating View code and not in the
Table Model

I have managed to achieve 1, 2, 4 and part of 5.  3 is not working for me.
I see the name of the class in the cell until the mouse up call.  I managed
4 by creating a Cell Renderer that extends JPanel and then adds the JButton
to the panel with a suitable layout for the JPanel.

Does anyone have a clear example of how this theoretically simple task is
done, particularly step 3?

Thanks.

David
--
David W. Taylor, Detayls
Technical Details
Message-ID: <397d2a83_2@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,1230cdfdfba798ad,start
X-Google-Attributes: gid111d45,public
From: "David W. Taylor" <davidt@detayls.com>
Subject: Button Table Cell Renderer and Editor example???
Date: 2000/07/24
Message-ID: <397d2a83_2@dnews>
X-Deja-AN: 650431297
X-Trace: 24 Jul 2000 22:49:55 -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