From 77301583745f5170d4920345fb8967a894814e5f Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 16 Aug 2016 01:00:08 +0200 Subject: [PATCH] Fix confirm window getting too big for screen --- src/me/corriekay/pokegoutil/windows/PokemonTab.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/me/corriekay/pokegoutil/windows/PokemonTab.java b/src/me/corriekay/pokegoutil/windows/PokemonTab.java index 0ea0d1aa..5ba1ba2f 100644 --- a/src/me/corriekay/pokegoutil/windows/PokemonTab.java +++ b/src/me/corriekay/pokegoutil/windows/PokemonTab.java @@ -569,9 +569,13 @@ private JPanel _buildPanelForOperation(String operation, ArrayList poke JScrollPane scroll = new JScrollPane(innerPanel); scroll.setAlignmentX(CENTER_ALIGNMENT); - scroll.setMaximumSize(new Dimension(Integer.MAX_VALUE, 150)); - panel.setMaximumSize(panel.getSize()); + // Auto-height? Resizable? Haha. Funny joke. + // I hate swing. But we need to get around here some way. + // So lets get dirty. + // We take 20 px for each row, 5 px buffer, and cap that at may 400 pixel. + int height = Math.min(400, pokes.size() * 20 + 5); + panel.setPreferredSize(new Dimension(500, height)); pokes.forEach(p -> { String str = PokeHandler.getLocalPokeName(p) + " - CP: " + p.getCp() + ", IV: "