Skip to content

Commit ea9ffb7

Browse files
committed
Fixed Scroll Pane Starting Position In Immersive Dialogs
- Ensured that scroll panes in immersive dialogs start scrolled to the top by adding a `SwingUtilities.invokeLater` call.
1 parent 3715c19 commit ea9ffb7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

MekHQ/src/mekhq/gui/baseComponents/immersiveDialogs/ImmersiveDialogCore.java

+2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ private JPanel createCenterBox(String centerMessage, List<ButtonLabelTooltipPair
285285
JScrollPane scrollPane = new JScrollPane(editorPane);
286286
scrollPane.setMinimumSize(new Dimension(CENTER_WIDTH, scrollPane.getHeight()));
287287
scrollPane.setBorder(BorderFactory.createEmptyBorder());
288+
// This line ensures the scroll pane starts scrolled to the top, not bottom.
289+
SwingUtilities.invokeLater(() -> scrollPane.getViewport().setViewPosition(new Point(0, 0)));
288290

289291
// Create a container with a border for the padding
290292
JPanel scrollPaneContainer = new JPanel(new BorderLayout());

0 commit comments

Comments
 (0)