diff --git a/CHANGELOG.md b/CHANGELOG.md index bcb62dc91..7092ec91e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. - Preview of PlaceObject and frames on hex dump view - AS3 Direct editation - Top level classes do not use ":" in their namespace names - AS3 Direct editation - Using "/" separator for method names +- Folder preview resizing (scrollbar too long) ## [16.3.1] - 2022-11-14 ### Fixed diff --git a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java index f8179d6bb..b350e69d4 100644 --- a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java @@ -51,6 +51,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.UIManager; import org.pushingpixels.substance.api.ColorSchemeAssociationKind; import org.pushingpixels.substance.api.ComponentState; import org.pushingpixels.substance.api.DecorationAreaType; @@ -178,11 +179,12 @@ public class FolderPreviewPanel extends JPanel { @Override public Dimension getPreferredSize() { - int width = getParent().getSize().width - 20; + int width = getParent().getSize().width - 1; int cols = width / CELL_WIDTH; int rows = (int) Math.ceil(items.size() / (float) cols); int height = rows * CELL_HEIGHT; - return new Dimension(width, height); + int prefWidth = cols * CELL_WIDTH; + return new Dimension(prefWidth, height); } @Override @@ -191,11 +193,7 @@ public class FolderPreviewPanel extends JPanel { repaintQueued = false; Rectangle r = getVisibleRect(); int width = getWidth(); - int cols = width / CELL_WIDTH; - int rows = (int) Math.ceil(items.size() / (float) cols); - int height = rows * CELL_HEIGHT; - int start_y = r.y / CELL_HEIGHT; JLabel l = new JLabel(); Font f = l.getFont().deriveFont(AffineTransform.getScaleInstance(0.8, 0.8)); @@ -264,12 +262,6 @@ public class FolderPreviewPanel extends JPanel { } } } - - if (lastWidth != width || lastHeight != height) { - lastWidth = width; - lastHeight = height; - setSize(new Dimension(width, height)); - } } private synchronized void renderImageTask(final int index, final TreeItem treeItem) {