1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

Refactor FormatDialog

This commit is contained in:
Reinhard Pointner 2016-08-08 03:10:55 +08:00
parent faba420141
commit 2214d5880d

View File

@ -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() {