ElegantJ Gauges Java API Specification v1.1

com.elegantj.gauges
Class GfxKit

java.lang.Object
  extended bycom.elegantj.gauges.Kit
      extended bycom.elegantj.gauges.GfxKit
All Implemented Interfaces:
java.io.Serializable

public class GfxKit
extends Kit
implements java.io.Serializable

Utility class to draw the gauge

See Also:
Serialized Form

Constructor Summary
GfxKit()
           
 
Method Summary
static java.lang.String clipString(java.lang.String text, java.awt.FontMetrics fm, int availableWidth)
          Clips the given string to the available width
static void drawCenteredString(java.awt.Graphics g, java.lang.String str, java.awt.Dimension rect, java.awt.FontMetrics fm)
          Renders a String centered within a given rectangle
static void drawCenteredString(java.awt.Graphics g, java.lang.String str, int width, int height, java.awt.FontMetrics fm)
          Renders a String centered within a given rectangle
static void drawCenteredString(java.awt.Graphics g, java.lang.String str, java.awt.Rectangle rect, java.awt.FontMetrics fm)
          Renders a String centered within a given rectangle
static void drawHorizontal(java.awt.Graphics g, int x1, int x2, int y)
          Draws horizontal line
static void drawPixel(java.awt.Graphics g, int x, int y)
          Draws a single pixel
static void drawVertical(java.awt.Graphics g, int y1, int y2, int x)
          Draws vertical line
static java.awt.Image loadImage(java.lang.String imageFilename)
          Load an image file (GIF or JPEG)
static void wipeImage(java.awt.Image image, java.awt.Color color, java.awt.image.ImageObserver observer)
          Wipes an image to some background color
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GfxKit

public GfxKit()
Method Detail

drawHorizontal

public static void drawHorizontal(java.awt.Graphics g,
                                  int x1,
                                  int x2,
                                  int y)
Draws horizontal line

Parameters:
g - graphics context
x1 - x-cordinate of starting location of the line
x2 - x-cordinate of ending location of the line
y - y-cordinate of the line

drawVertical

public static void drawVertical(java.awt.Graphics g,
                                int y1,
                                int y2,
                                int x)
Draws vertical line

Parameters:
g - graphics context
y1 - y-cordinate of starting location of the line
y2 - y-cordinate of ending location of the line
x - x-cordinate of the line

drawPixel

public static void drawPixel(java.awt.Graphics g,
                             int x,
                             int y)
Draws a single pixel

Parameters:
g - graphics context
x - x-cordinate of the pixel
y - y-cordinate of the pixel

wipeImage

public static void wipeImage(java.awt.Image image,
                             java.awt.Color color,
                             java.awt.image.ImageObserver observer)
Wipes an image to some background color

Parameters:
image - a background image
color - color of the image
observer - imageObserver is used to draw image

drawCenteredString

public static void drawCenteredString(java.awt.Graphics g,
                                      java.lang.String str,
                                      int width,
                                      int height,
                                      java.awt.FontMetrics fm)
Renders a String centered within a given rectangle

Parameters:
g - graphics context
str - a string which is drawn
width - width of the rectangle in which string is rendered
height - height of the rectangle in which string is rendered
fm - fontmetrics represents font

drawCenteredString

public static void drawCenteredString(java.awt.Graphics g,
                                      java.lang.String str,
                                      java.awt.Dimension rect,
                                      java.awt.FontMetrics fm)
Renders a String centered within a given rectangle

Parameters:
g - graphics context
str - a string which is drawn
rect - Specifies rectangle in which string is rendered
fm - fontmetrics represents font

drawCenteredString

public static void drawCenteredString(java.awt.Graphics g,
                                      java.lang.String str,
                                      java.awt.Rectangle rect,
                                      java.awt.FontMetrics fm)
Renders a String centered within a given rectangle

Parameters:
g - graphics context
str - a string which is drawn
rect - Specifies rectangle in which string is rendered
fm - fontmetrics represents font

loadImage

public static java.awt.Image loadImage(java.lang.String imageFilename)
Load an image file (GIF or JPEG)

Parameters:
imageFilename - name of the image file
Returns:
image which is created using filename

clipString

public static java.lang.String clipString(java.lang.String text,
                                          java.awt.FontMetrics fm,
                                          int availableWidth)
Clips the given string to the available width


ElegantJ Gauges Java API Specification v1.1

Submit a bug or feature

Copyright(c)
Elegant Microweb Technologies Pvt. Ltd.
www.elegantmicroweb.com
www.elegantjcharts.com
All Rights Reserved.