* use system laf on Windows and Mac, use Nimbus on all the others (Linux, *BSD, ...)

* visual imrovements under Nimbus LAF
This commit is contained in:
Reinhard Pointner 2009-04-05 21:03:40 +00:00
parent d7a5b58c32
commit 4afc701ff7
5 changed files with 75 additions and 47 deletions

View File

@ -21,6 +21,8 @@ import net.sourceforge.filebot.ui.panel.sfv.SfvPanelBuilder;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import com.sun.jna.Platform;
public class Main {
@ -47,15 +49,15 @@ public class Main {
initializeSettings();
try {
// UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
// UIManager.setLookAndFeel("a03.swing.plaf.A03LookAndFeel");
// UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel");
// UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceNebulaBrickWallLookAndFeel");
// UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceSaharaLookAndFeel");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
if (Platform.isWindows() || Platform.isMac()) {
// use native laf of windows and mac
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} else {
// use nimubs laf on linux, bsd, ...
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
} catch (Exception e) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, e.toString(), e);
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.toString(), e);
}
SwingUtilities.invokeLater(new Runnable() {

View File

@ -120,8 +120,14 @@ public class EpisodeFormatBindingBean {
return null;
}
@Define("general")
public SortedMap<String, String> getGeneralMediaInfo() {
return getMediaInfo().snapshot(StreamKind.General, 0);
}
@Define("video")
public SortedMap<String, String> getVideoInfo() {
return getMediaInfo().snapshot(StreamKind.Video, 0);
@ -133,12 +139,18 @@ public class EpisodeFormatBindingBean {
return getMediaInfo().snapshot(StreamKind.Audio, 0);
}
@Define("general")
public SortedMap<String, String> getGeneralMediaInfo() {
return getMediaInfo().snapshot(StreamKind.General, 0);
@Define("text")
public SortedMap<String, String> getTextInfo() {
return getMediaInfo().snapshot(StreamKind.Text, 0);
}
@Define("image")
public SortedMap<String, String> getImageInfo() {
return getMediaInfo().snapshot(StreamKind.Image, 0);
}
public synchronized MediaInfo getMediaInfo() {
if (mediaFile == null) {

View File

@ -1,43 +1,57 @@
package net.sourceforge.filebot.ui.panel.episodelist;
import static net.sourceforge.filebot.ui.panel.episodelist.SeasonSpinnerModel.ALL_SEASONS;
import java.awt.Color;
import java.text.ParseException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JSpinner;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.SwingConstants;
import javax.swing.JSpinner.DefaultEditor;
import javax.swing.text.DefaultFormatter;
import javax.swing.text.DefaultFormatterFactory;
class SeasonSpinnerEditor extends DefaultEditor {
class SeasonSpinnerEditor extends JLabel implements ChangeListener {
public SeasonSpinnerEditor(JSpinner spinner) {
setHorizontalAlignment(RIGHT);
super(spinner);
spinner.addChangeListener(this);
setValueFromSpinner(spinner);
setBorder(BorderFactory.createEmptyBorder(1, 3, 1, 3));
setBackground(Color.WHITE);
setOpaque(true);
}
getTextField().setFormatterFactory(new DefaultFormatterFactory(new DefaultFormatter() {
public void stateChanged(ChangeEvent e) {
setValueFromSpinner((JSpinner) e.getSource());
}
@Override
public Object stringToValue(String string) throws ParseException {
if ("All Seasons".equals(string)) {
return ALL_SEASONS;
}
private void setValueFromSpinner(JSpinner spinner) {
int season = ((SeasonSpinnerModel) spinner.getModel()).getSeason();
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);
}
}));
if (season == ALL_SEASONS)
setText("All Seasons");
else
setText(String.format("Season %d", season));
getTextField().setHorizontalAlignment(SwingConstants.RIGHT);
}
}

View File

@ -67,9 +67,9 @@ public class ListPanel extends JComponent {
add(new JLabel("Pattern:"), "gapbefore indent");
add(textField, "gap related, wmin 2cm");
add(new JLabel("From:"), "gap 5mm");
add(fromSpinner, "gap related, wmax 12mm, sizegroup spinner");
add(fromSpinner, "gap related, wmax 14mm, sizegroup spinner");
add(new JLabel("To:"), "gap 5mm");
add(toSpinner, "gap related, wmax 12mm, sizegroup spinner");
add(toSpinner, "gap related, wmax 14mm, sizegroup spinner");
add(new JButton(createAction), "gap 7mm, gapafter indent, wrap paragraph");
add(list, "grow");

View File

@ -40,12 +40,12 @@ public class FancyTreeCellRenderer extends DefaultTreeCellRenderer {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, false);
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, false);
setIconTextGap(5);
if (sel) {
if (selected) {
setPaintGradient(true);
setGradientBeginColor(backgroundSelectionColor.brighter());
setGradientEndColor(backgroundSelectionColor);