The Artima Developer Community
Sponsored Link

Java Answers Forum
change the backgroundcolor of a table column

1 reply on 1 page. Most recent reply: Jun 7, 2003 6:52 PM by Charles Bell

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 1 reply on 1 page
Hans

Posts: 1
Nickname: hansv
Registered: Jun, 2003

change the backgroundcolor of a table column Posted: Jun 7, 2003 2:59 PM
Reply to this message Reply
Advertisement
I want to change the backgroundcolor of a table column by clicking on the columnheader, and by clicking it again the backgroundcolor should change back to the original color.

Since this table is part of a form, on submitting the form I would like to know what color the column has.

Can somebody help me?


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: change the backgroundcolor of a table column Posted: Jun 7, 2003 6:52 PM
Reply to this message Reply
Use the JTable mthod:

public TableCellRenderer getCellRenderer(int row,
int column)
to get the TableCellRenderer for the column.

Then use the

public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int row, int column)
method to get the component
then use setBackground(Color c) to change the color of the component

Flat View: This topic has 1 reply on 1 page
Topic: Help: How reload a built file ?? Previous Topic   Next Topic Topic: Java WebStart

Sponsored Links



Google
  Web Artima.com   

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