On Tue, 18 Jun 2024 12:51:34 GMT, Abhishek Kumar <[email protected]> wrote:
>> since this method should be recursing through all of a component's >> subcomponents, shouldn't there not even be an if check here? > >> JComponent extends Container .. so this will traverse everything in the >> Swing UI. > Is there any pattern elsewhere in Swing you can use to short-circuit this ? > > I am unable to recall any pattern as such. > since this method should be recursing through all of a component's > subcomponents, shouldn't there not even be an if check here? If I understand correctly, you mean to say we don't require an if condition here. But the if condition is to identify the components in container which needs to be repainted for mnemonic related changes. So if a component is an instance of container, all the sub-components are fetched and if any of sub-component is either AbstractButton or JLabel instance, it will be repainted based on mnemonic condition otherwise will be ignored (if not a container itself). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1644431689
