On Mon, 25 Mar 2024 16:05:16 GMT, Damon Nguyen <[email protected]> wrote:

>> test/jdk/java/awt/print/bug8023392.java line 116:
>> 
>>> 114:                 @Override
>>> 115:                 protected void paintComponent(Graphics g) {
>>> 116:                     SwingUtilities2.drawChars(this, g, s.toCharArray(),
>> 
>> cant we use `Graphics.drawChars` instead in all places 
>> `SwingUtilities2.drawChars` is used?
>
> `Graphics.drawChars` isn't a static method, which will require additional 
> changes to this test. Is it preferred to use `Graphics` over the 
> `SwingUtilities2` version?

This test is specifically about testing the spacing of text in Swing printing.
I think this SwingUtilities call isn't just "the way he happens to be printing 
text",
This call is the very thing under test ! And note that it takes a Component 
parameter
which affects how that call renders the text. It is used to figure out the FRC 
to use.
So changing this to use Graphics would be a problem.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18458#discussion_r1538247940

Reply via email to