gate.gui.teamware.AnnotationSetNameCellRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gate-core Show documentation
Show all versions of gate-core Show documentation
GATE - general achitecture for text engineering - is open source
software capable of solving almost any text processing problem. This
artifact enables you to embed the core GATE Embedded with its essential
dependencies. You will able to use the GATE Embedded API and load and
store GATE XML documents. This artifact is the perfect dependency for
CREOLE plugins or for applications that need to customize the GATE
dependencies due to confict with their own dependencies or for lower
footprint.
The newest version!
package gate.gui.teamware;
import java.awt.Component;
import java.awt.Font;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
@SuppressWarnings("serial")
class AnnotationSetNameCellRenderer extends DefaultListCellRenderer {
public static final String DEFAULT_SET_TEXT = "";
private Font defaultFont;
private Font italicFont;
AnnotationSetNameCellRenderer() {
defaultFont = getFont();
italicFont = defaultFont.deriveFont(Font.ITALIC);
}
@Override
public Component getListCellRendererComponent(JList> list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
Font font = defaultFont;
if(value == null) {
value = DEFAULT_SET_TEXT;
font = italicFont;
}
Component c = super.getListCellRendererComponent(list, value, index, isSelected,
cellHasFocus);
c.setFont(font);
return c;
}
}