com.sygem.swing.borders
Class AnimatedBorder

java.lang.Object
  extended bycom.sygem.swing.borders.AnimatedBorder
All Implemented Interfaces:
javax.swing.border.Border

public class AnimatedBorder
extends java.lang.Object
implements javax.swing.border.Border

This border cycles between a set of borders to achieve an animated effect.

There is no real limit to the number of borders that can be added. The time between each border change can also be specified.

When each border change occurs, only the border of the component is repainted, not the whole component. This saves on processor time and guarantees each component retains its current display no matter what happens to the border.

Title: SyGem Swing Borders
Description: A set of free Borders
Copyright: Copyright (c) 2004
Company: SyGem Software

Version:
1.0b

Constructor Summary
AnimatedBorder()
          Constructs an AnimatedBorder.
 
Method Summary
 void addBorder(javax.swing.border.Border border)
          Adds a border to the end of the border list
 void addBorder(int pos, javax.swing.border.Border border)
          Adds a border into the border list at a specified position.
 int getAnimationDelay()
          Gets the value of the animation delay.
 javax.swing.border.Border getBorderAt(int pos)
          Returns the border at the specified position in the border list.
 java.awt.Insets getBorderInsets(java.awt.Component c)
          Returns the insets of the current border.
 boolean isBorderOpaque()
          Returns whether or not the current border is opaque.
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
          Paints the border for the specified component with the specified position and size.
 void removeBorder(javax.swing.border.Border border)
          Removes the specified border from the border list.
 void removeBorder(int pos)
          Removes a border at the specified position.
 void setAnimationDelay(int delay)
          Sets the size of the delay between border changes.
 void startAnimation()
          Starts the animation from the beginning of the sequence.
 void stopAnimation()
          Stops the animation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimatedBorder

public AnimatedBorder()
Constructs an AnimatedBorder. The default value for the animation delay is 1000 milliseconds (1 second). The animation will not start until you call the startAnimation() method.

Method Detail

addBorder

public void addBorder(javax.swing.border.Border border)
Adds a border to the end of the border list

Parameters:
border - The Border to add

addBorder

public void addBorder(int pos,
                      javax.swing.border.Border border)
Adds a border into the border list at a specified position.

Parameters:
pos - The position to add the border
border - The Border to add

getAnimationDelay

public int getAnimationDelay()
Gets the value of the animation delay.

Returns:
The animation delay

getBorderAt

public javax.swing.border.Border getBorderAt(int pos)
Returns the border at the specified position in the border list.

Parameters:
pos - The position in the border list to return
Returns:
The Border at that position

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Returns the insets of the current border.

Specified by:
getBorderInsets in interface javax.swing.border.Border
Parameters:
c - the component for which this border insets value applies
Returns:
The insets for the current border

isBorderOpaque

public boolean isBorderOpaque()
Returns whether or not the current border is opaque.

Specified by:
isBorderOpaque in interface javax.swing.border.Border
Returns:
True if the current border is opaque

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Paints the border for the specified component with the specified position and size.

Specified by:
paintBorder in interface javax.swing.border.Border
Parameters:
c - the component for which this border is being painted
g - 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

removeBorder

public void removeBorder(javax.swing.border.Border border)
Removes the specified border from the border list.

Parameters:
border - The Border to remove

removeBorder

public void removeBorder(int pos)
Removes a border at the specified position.

Parameters:
pos - The position to remove from the border list

setAnimationDelay

public void setAnimationDelay(int delay)
Sets the size of the delay between border changes. The delay is specified in milliseconds - 1000 milliseconds = 1 second.

Parameters:
delay - The number of milliseconds to wait before changing to the next border

startAnimation

public void startAnimation()
Starts the animation from the beginning of the sequence.


stopAnimation

public void stopAnimation()
Stops the animation. It can be restarted at any time using the startAnimation() method.



Copyright © 2004 SyGem Software. All Rights Reserved.