Re: How can i set background of each row to a different color in a Gridbaglayout?
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.