RFR: 8282526: Default icon is not painted properly

Alexander Zuev kizune at openjdk.java.net
Mon Mar 14 01:50:48 UTC 2022


On Sun, 13 Mar 2022 23:28:01 GMT, Jeremy <duke at openjdk.java.net> wrote:

> This might be a rookie question:
> 
> When it comes to modifying and restoring a Graphics, I've seen two common patterns: A. Call `newG = g.create()` and later `newG.dispose()` B. Call `g.setX(newValue)` and then call `g.setX(oldValue)` later
> 
> Is there guidance on when to use which? Or is one always preferred?

Usually i follow the rule of minimal action. When i need to set a lot of hints that needs to be later unrolled such as changing graphics coordinates and such - i'm creating a new Graphics. When i only need to manipulate a single hint and it can easily be unrolled - i am using the same object. In this case i'm changing just a single hint.

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

PR: https://git.openjdk.java.net/jdk/pull/7805



More information about the client-libs-dev mailing list