CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Location
    A.P,India.
    Posts
    8

    How to set the background of a cell of a JTable

    Hai friends,
    I want to set the background color of some cells( not selected cells) of the JTable. How to do this?

    from
    Ramu

    I a

  2. #2
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: How to set the background of a cell of a JTable

    If the color of all the cells the problem is very simple, just set its background color and possibly 'setOpaque(true)'.

    If u want diff color for each cell, u will need to keep the color of cell alongwith the cell value. And creating a simple CellRenderer will show the background color of that cell to specified color. This cell renderer can be just a JLabel having code to set the text (value of cell) and the background color (color of cell). Do setOpaque(true) so that JLabel will paint background.

    - UnicMan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured