FileDocCategorySizeDatePackage
SVTableUtils.javaAPI DocApache Poi 3.0.13018Mon Jan 01 12:39:34 GMT 2007org.apache.poi.hssf.contrib.view

SVTableUtils

public class SVTableUtils extends Object
SVTableCell Editor and Renderer helper functions.
author
Jason Height
since
16 July 2002

Fields Summary
private static final Hashtable
colors
public static final Color
black
Description of the Field
public static final Color
white
Description of the Field
public static Border
noFocusBorder
Description of the Field
Constructors Summary
Methods Summary
public static final java.awt.ColorgetAWTColor(int index, java.awt.Color deflt)
This method retrieves the AWT Color representation from the colour hash table

param
index Description of the Parameter
param
deflt Description of the Parameter
return
The aWTColor value

    HSSFColor clr = (HSSFColor) colors.get(new Integer(index));
    if (clr == null) {
      return deflt;
    }
    return getAWTColor(clr);
  
public static final java.awt.ColorgetAWTColor(org.apache.poi.hssf.util.HSSFColor clr)
Gets the aWTColor attribute of the SVTableUtils class

param
clr Description of the Parameter
return
The aWTColor value

    short[] rgb = clr.getTriplet();
    return new Color(rgb[0], rgb[1], rgb[2]);
  
public static java.awt.FontmakeFont(org.apache.poi.hssf.usermodel.HSSFFont font)
Creates a new font for a specific cell style



               
       
    boolean isbold = font.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
    boolean isitalics = font.getItalic();
    int fontstyle = Font.PLAIN;
    if (isbold) {
      fontstyle = Font.BOLD;
    }
    if (isitalics) {
      fontstyle = fontstyle | Font.ITALIC;
    }

    int fontheight = font.getFontHeightInPoints();
    if (fontheight == 9) {
      //fix for stupid ol Windows
      fontheight = 10;
    }

    return new Font(font.getFontName(), fontstyle, fontheight);