From 2214d5880dad3650ab376b29b047ec14287b419f Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 8 Aug 2016 03:10:55 +0800 Subject: [PATCH] Refactor FormatDialog --- source/net/filebot/ui/rename/FormatDialog.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/ui/rename/FormatDialog.java b/source/net/filebot/ui/rename/FormatDialog.java index 0594b53a..7fcd6e58 100644 --- a/source/net/filebot/ui/rename/FormatDialog.java +++ b/source/net/filebot/ui/rename/FormatDialog.java @@ -13,6 +13,7 @@ import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; +import java.awt.Rectangle; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; @@ -312,6 +313,7 @@ public class FormatDialog extends JDialog { public void setFormatCode(String text) { editor.setText(text); editor.requestFocusInWindow(); + editor.scrollRectToVisible(new Rectangle(0, 0)); // reset scroll editor.setCaretPosition(text.length()); // scroll to end of format } @@ -376,7 +378,7 @@ public class FormatDialog extends JDialog { formatLink.setFont(new Font(MONOSPACED, PLAIN, 11)); // compute format label in background - final JLabel formatExample = new JLabel("[evaluate]"); + JLabel formatExample = new JLabel("[evaluate]"); // bind text to preview addPropertyChangeListener("sample", new PropertyChangeListener() {