gate.swing.IconTableCellRenderer 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.swing;
import java.awt.Component;
import javax.swing.Icon;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import gate.resources.img.svg.InvalidIcon;
import gate.resources.img.svg.MavenIcon;
import gate.resources.img.svg.OpenFileIcon;
@SuppressWarnings("serial")
public class IconTableCellRenderer extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
if(value instanceof Icon) {
super.getTableCellRendererComponent(table, "", isSelected, hasFocus,
row, column);
setIcon((Icon)value);
if (value instanceof MavenIcon)
setToolTipText("Maven Plugin");
else if (value instanceof OpenFileIcon)
setToolTipText("Directory Plugin");
else if (value instanceof InvalidIcon)
setToolTipText("Invalid Plugin");
return this;
} else {
return super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
}
}
}