Duplicate :
|
|
Relates :
|
|
Relates :
|
See related bug: 4170060 In 4170060 and 4258648 it was found that clearRect does not work in lightweight components. It is advertised in the documentation (that is, the specification) to cause the given rectangle to be painted with the background color. But this does not work and has not since before 1.2.2. For 4170060 and 4258648, AWT engineering fixed this issue for Graphics2D and PrintGraphics objects, but not regular Graphics. This RFE is as stated in the Synopsis; to make Graphics.clearRect cause the given rectangle to be painted with the background color. This may (probably) mean(s) moving the Graphics2D.set/getBackground methods to Graphics. The attachment to 4170060 demonstrates the problem. To see it one must modify the lw/LWButton.java source appropriately to whether you want to see the problem. When LWButton's paint uses clearRect, then its background gets painted to the background color of the Frame. But if it uses setColor/fillRect then the LWButton's background is correctly painted. To see it, one runs the app in test/layout .. you must set your classpath to "../..:.". As to what to fix & where ... The documentation in question is Graphics.clearRect. While this method works fine for a Canvas (heavy weight) it does not work with a lightweight. However, given that the documentation is for Graphics, it would not be proper to fix this by having lightweights be given a Graphics2D masquerading as a Graphics. The fix must be in Graphics itself. It looks like Component.getGraphics shouldn't get the containers Graphics, but that there should be a Graphics in LightweightPeer.
|