The Artima Developer Community
Sponsored Link

Java Answers Forum
How to modify cell properties of a JDBTable ?

3 replies on 1 page. Most recent reply: Sep 11, 2003 8:24 AM by mausam

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Alexandre

Posts: 4
Nickname: aalleexx
Registered: Sep, 2003

How to modify cell properties of a JDBTable ? Posted: Sep 5, 2003 12:04 PM
Reply to this message Reply
Advertisement
I want to change the color of a specified cell in my jdbTable. It seems that the renderer of jTable doesn't work.

An idea ?

Thanks


David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: How to modify cell properties of a JDBTable ? Posted: Sep 6, 2003 4:29 AM
Reply to this message Reply
Where did you get this class? What's its fully qualified name?

e.g. Vector is java.util.Vector

zenykx

Posts: 69
Nickname: zenykx
Registered: May, 2003

Re: How to modify cell properties of a JDBTable ? Posted: Sep 10, 2003 1:35 PM
Reply to this message Reply
It must work.
You have:
getTableCellRendererComponent(JTable, Object, boolean isSelected, boolean hasFocus, int row, int column)

So you have the position of the cell, you got even if the cell is currently selected or focused and inside the Component returned from this method you can use setBackground(Color).

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: How to modify cell properties of a JDBTable ? Posted: Sep 11, 2003 8:24 AM
Reply to this message Reply
It must work

override the methods liek
public TableCellRenderer getCellRenderer(int row, int column)
{
 return new DefaultTableCellRenderer ()
  {      
     public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus, int row, int column)
     {  
         super.getTableCellRendererComponent(table, value, isSelected,hasFocus, row, column);
          Color color = Color.red;
          setForeground(color);
          return this;
     }
 };
}

Flat View: This topic has 3 replies on 1 page
Topic: Clearing input after readChar() Previous Topic   Next Topic Topic: array

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use