-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
kestrel
-
sparc
-
solaris_2.6
-
Verified
I am writing a library of lightweight components for testing purposes
and have one app using them to test with so far.
The widget hierarchy is
Frame
containing a LWResizable (extends Container)
containing LWLabels (extends Component)
Each widget has a different background color which should allow me
to see where each is more clearly.
According to documentation I should have the paint() method of
the widgets do something like
paint() {
g.clearRect(0, 0, dim.width, dim.height);
g.setColor(getForeground());
... drawing for the contents of the widget...
}
However with lightweights, this does not draw the background color
of the lightweight. Instead the background color of the heavyweight
(frame) at the top level is drawn.
Interesting effects also occur as you modify which widget is heavy
or light weight.
This behavior exists in 1.1.6 and 1.2beta4.
Instructions for using the demo app:
The LWResizable widget draws for squares at its corners and tracks mouse
motion such that it resizes its contents to match mouse movements. You click
on a corner and drag, and that resizes the container.
Information is printed on stdout as you use the app. Note especially
that in the paint functions, that the bgColor of the widget is as
expected, but that's not what is drawn.
The app is in test/layout. A shell script is in test/layout for
setting up environment. The widget classes are in lw. And finally
a makefile in test/layout lets you do 'make clean' and 'make' to
ensure everything is built.
To see the bug you edit lw/LWButton.java, and in the paint method there
are three lines of interest:
super.paint(g);
g.clearRect(0, 0, dim.width, dim.height);
//g.fillRect(0, 0, dim.width, dim.height);
With the g.fillRect call commented out, the LWButton is painted with a
green color, and with the super.paint/g.clearRect commented out
the button is painted with a red color.
Note: The toplevel Frame has green background, the LWResizable has
white background, and LWButton has red background (all set via
setBackground calls in their respective constructors).
According to the documentation, calling clearRect in LWButton.paint should
cause the LWButton to be red.
and have one app using them to test with so far.
The widget hierarchy is
Frame
containing a LWResizable (extends Container)
containing LWLabels (extends Component)
Each widget has a different background color which should allow me
to see where each is more clearly.
According to documentation I should have the paint() method of
the widgets do something like
paint() {
g.clearRect(0, 0, dim.width, dim.height);
g.setColor(getForeground());
... drawing for the contents of the widget...
}
However with lightweights, this does not draw the background color
of the lightweight. Instead the background color of the heavyweight
(frame) at the top level is drawn.
Interesting effects also occur as you modify which widget is heavy
or light weight.
This behavior exists in 1.1.6 and 1.2beta4.
Instructions for using the demo app:
The LWResizable widget draws for squares at its corners and tracks mouse
motion such that it resizes its contents to match mouse movements. You click
on a corner and drag, and that resizes the container.
Information is printed on stdout as you use the app. Note especially
that in the paint functions, that the bgColor of the widget is as
expected, but that's not what is drawn.
The app is in test/layout. A shell script is in test/layout for
setting up environment. The widget classes are in lw. And finally
a makefile in test/layout lets you do 'make clean' and 'make' to
ensure everything is built.
To see the bug you edit lw/LWButton.java, and in the paint method there
are three lines of interest:
super.paint(g);
g.clearRect(0, 0, dim.width, dim.height);
//g.fillRect(0, 0, dim.width, dim.height);
With the g.fillRect call commented out, the LWButton is painted with a
green color, and with the super.paint/g.clearRect commented out
the button is painted with a red color.
Note: The toplevel Frame has green background, the LWResizable has
white background, and LWButton has red background (all set via
setBackground calls in their respective constructors).
According to the documentation, calling clearRect in LWButton.paint should
cause the LWButton to be red.
- relates to
-
JDK-4285515 Make Graphics.clearRect work as advertised for plain Graphics (lightweight)
-
- Closed
-