eirikbakke commented on code in PR #5760: URL: https://github.com/apache/netbeans/pull/5760#discussion_r1161853414
########## platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/ui/FlatTreeClosedIcon.java: ########## @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.swing.laf.flatlaf.ui; + +import javax.swing.ImageIcon; +import org.openide.util.ImageUtilities; + +/** + * "closed" icon for {@link javax.swing.JTree} used by {@link javax.swing.tree.DefaultTreeCellRenderer}. + * + * @author Karl Tauber + */ +public class FlatTreeClosedIcon extends ImageIcon { + + public FlatTreeClosedIcon() { + super( ImageUtilities.loadImage( "org/netbeans/swing/plaf/resources/hidpi-folder-closed.png" ) ); // NOI18N Review Comment: Did you check if this results in the icon being painted with proper HiDPI/retina resolution on MacOS, and on Linux? I checked on Windows 11 and it works there, on both 150% HiDPI scaling and 200% HiDPI scaling. Alternatively the NBFlatAdapterIcon approach from https://gist.github.com/eirikbakke/5587bd548a668cb0588c3fdc7d9e9f48 should work in all cases. In general, the safest way to get HiDPI scaling is to override Icon.paintIcon and avoid BufferedImage/ImageIcon altogether. But due to BufferedImage/ImageIcon being used in a lot of places, there are various tricks in both AWT and in ImageUtilities that makes HiDPI scaling work even for BufferedImage in many cases. But I think it can have issues e.g. when different screens have different DPI scalings (e.g. where ColorMode.createCompatibleWritableRaster in ImageUtilities.ToolTipImage.createNew might produce a raster for 150% HiDPI scaling but another screen might then end up upscaling that graphics to 200% HiDPI scaling, producing poor quality). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
