1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-05 08:55:08 -05:00
filebot/source/net/sourceforge/tuned/ui/DefaultFancyListCellRenderer.java
Reinhard Pointner a0a43b0e03 * removed Settings singleton, always use Preferences directly
* simplified HistoryPanel by using MigLayout
* added MigLayout jar to libs
* improved decimal format for file count and size in AnalyzePanel
* put application name and version getters into FileBotUtil
2008-10-11 20:42:03 +00:00

76 lines
1.5 KiB
Java

package net.sourceforge.tuned.ui;
import java.awt.Color;
import java.awt.Insets;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JList;
public class DefaultFancyListCellRenderer extends AbstractFancyListCellRenderer {
private final JLabel label = new JLabel();
public DefaultFancyListCellRenderer() {
add(label);
}
public DefaultFancyListCellRenderer(int padding) {
super(new Insets(padding, padding, padding, padding));
add(label);
}
protected DefaultFancyListCellRenderer(int padding, int margin, Color selectedBorderColor) {
super(new Insets(padding, padding, padding, padding), new Insets(margin, margin, margin, margin), selectedBorderColor);
add(label);
}
@Override
protected void configureListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.configureListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
label.setOpaque(false);
setText(value.toString());
}
public void setIcon(Icon icon) {
label.setIcon(icon);
}
public void setText(String text) {
label.setText(text);
}
public void setHorizontalTextPosition(int textPosition) {
label.setHorizontalTextPosition(textPosition);
}
public void setVerticalTextPosition(int textPosition) {
label.setVerticalTextPosition(textPosition);
}
@Override
public void setForeground(Color fg) {
super.setForeground(fg);
// label is null while in super constructor
if (label != null) {
label.setForeground(fg);
}
}
}