-
Problem with JButtons in JTable
Hi,
I using a JTable that has a column with JButtons. I was able to render the buttons and even fire the button's action by using a custom table cell editor.
The problem is :
I first click a button, say in row 1 and then click a button in another row, say row 2. When I click the second button, the button in row 1 is displayed in a pressed state. That is, the previously clicked button is rendered in a pressed state, untill the table is refreshed completely (say by adjusting the column size).
I tried to confirm if the renderer on row1 is invoked or not. And the renderer on row1 IS invoked but still it is rendered as a toggle button in pressed state (But the buttons i add and render are just JButton and not JToggle button).
The button is correctly rendered only when the table is fully repainted.
Hope I am clear with my statements.
Any solution on this problem would be appreciated.
Thanks in advance,
Vijay.
--
-
A renderer only 'lends' its drawing capabilities to the component
(table/list) that is using it. What you see is really just a
cardboard representation of the rendered component. E.g. when
you use a JTexArea as base for your renderer you will see the
scrollbars, but you cannot use them. The only components I
have been able to use as (well behaved)renderers are lables,
panels and comboboxes.
I am not sure why a label column is able to keep
its elements' individual coloring and a button apparently doesn't.
Java Wreck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks