Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.gui.plaf
Class BevelRenderer

java.lang.Object
  extended by ch.randelshofer.gui.plaf.BevelRenderer

public class BevelRenderer
extends java.lang.Object

Takes an image and insets. The image must show a bevel and a fill area. The insets and the size of the image are used do determine which parts of the image shall be used to draw the corners and edges of the bevel as well the fill area.

For example, if you provide an image of size 10,10 and a insets of size 2, 2, 4, 4, then the corners of the border are made up of top left: 2,2, top right: 2,4, bottom left: 2,4, bottom right: 4,4 rectangle of the image. The inner area of the image is used to fill the inner area.

Version:
1.0 2001-10-16 Created.
Author:
Werner Randelshofer

Constructor Summary
BevelRenderer()
          Creates a new BevelRenderer without an image and without zero insets.
BevelRenderer(java.awt.Image img, java.awt.Insets insets)
          Creates a new BevelRenderer without the given image and insets.
 
Method Summary
 java.awt.Image getImage()
          Gets the image to be used for border painting.
 int getImageHeight()
           
 java.awt.Insets getImageInsets()
          Gets the insets of the image.
 int getImageWidth()
           
 void paintBevel(java.awt.Component c, java.awt.Graphics gr, int x, int y, int width, int height)
          Paints the bevel image for the specified component with the specified position and size.
 void setImage(java.awt.Image img)
          Sets the image to be used for border painting.
 void setImageInsets(java.awt.Insets insets)
          Sets the insets of the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BevelRenderer

public BevelRenderer()
Creates a new BevelRenderer without an image and without zero insets.


BevelRenderer

public BevelRenderer(java.awt.Image img,
                     java.awt.Insets insets)
Creates a new BevelRenderer without the given image and insets.

Method Detail

setImage

public void setImage(java.awt.Image img)
Sets the image to be used for border painting.


getImage

public java.awt.Image getImage()
Gets the image to be used for border painting.


getImageHeight

public int getImageHeight()

getImageWidth

public int getImageWidth()

setImageInsets

public void setImageInsets(java.awt.Insets insets)
Sets the insets of the image.


getImageInsets

public java.awt.Insets getImageInsets()
Gets the insets of the image.


paintBevel

public void paintBevel(java.awt.Component c,
                       java.awt.Graphics gr,
                       int x,
                       int y,
                       int width,
                       int height)
Paints the bevel image for the specified component with the specified position and size.

Parameters:
c - the component for which this border is being painted
gr - the paint graphics
x - the x position of the painted border
y - the y position of the painted border
width - the width of the painted border
height - the height of the painted border

Copyright 2012-02-25 Werner Randelshofer