DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    1

    Question 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.
    --

  2. #2
    Join Date
    Dec 2004
    Location
    Norway
    Posts
    14
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links