dcsimg
How can i set background of each row to a different color in a Gridbaglayout?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   chelikani_madhukumar
Posted On:   Sunday, January 19, 2003 09:47 AM

I want to set the background color of Each row in a gridbaglayout to a different color? I would appreiciate if anybody suggest me the solution?

Re: How can i set background of each row to a different color in a Gridbaglayout?

Posted By:   Bahman_Barzideh  
Posted On:   Monday, January 20, 2003 06:18 AM

GridBagLayout is not a Component. It's purpose is to
align/position Components. You cannot set colors for it. You need to
set the the color for the components in a given row. How you do this
depends on your app. The most straight forward would of course be
to set the background color of each component as you are adding
them to the container. If this does not work for you, you may want
to develop a piece of code that examines each component in the
container, determines its row [GridBagLayout.getConstraints (Component comp) can be
used to determine the constraints, including the gridy for
a component] and set the background as needed.


Hope this is of some help.
About | Sitemap | Contact