All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gate.swing.IconTableCellRenderer Maven / Gradle / Ivy

Go to download

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);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy