From e0161028c7931c4875fc5e6792c9416f10597f7e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 26 Jul 2014 16:09:18 +0000 Subject: [PATCH] * fix OSX LaF issues --- .../ui/episodelist/SeasonSpinnerEditor.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/source/net/filebot/ui/episodelist/SeasonSpinnerEditor.java b/source/net/filebot/ui/episodelist/SeasonSpinnerEditor.java index 6657edc2..a3313b8d 100644 --- a/source/net/filebot/ui/episodelist/SeasonSpinnerEditor.java +++ b/source/net/filebot/ui/episodelist/SeasonSpinnerEditor.java @@ -1,7 +1,5 @@ - package net.filebot.ui.episodelist; - import static net.filebot.ui.episodelist.SeasonSpinnerModel.*; import java.awt.Color; @@ -16,47 +14,44 @@ import javax.swing.SwingConstants; import javax.swing.text.DefaultFormatter; import javax.swing.text.DefaultFormatterFactory; - class SeasonSpinnerEditor extends DefaultEditor { - + public SeasonSpinnerEditor(JSpinner spinner) { super(spinner); - + getTextField().setFormatterFactory(new DefaultFormatterFactory(new DefaultFormatter() { - + @Override public Object stringToValue(String string) throws ParseException { if ("All Seasons".equals(string)) { return ALL_SEASONS; } - + Matcher matcher = Pattern.compile("Season (\\d+)").matcher(string); - + if (matcher.matches()) { return Integer.valueOf(matcher.group(1)); } - + // negative season number throw new ParseException("Illegal season number", 0); } - @Override public String valueToString(Object value) throws ParseException { int season = ((Number) value).intValue(); - + if (season == ALL_SEASONS) return "All Seasons"; else if (season >= 1) return String.format("Season %d", season); - + // negative season number throw new ParseException("Illegal season number", 0); } - + })); - - getTextField().setBorder(BorderFactory.createEmptyBorder(1, 3, 1, 1)); + getTextField().setHorizontalAlignment(SwingConstants.RIGHT); getTextField().setBackground(Color.white); }