Class symantec.itools.awt.RollOverButton
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.RollOverButton

Object
   |
   +----Component
           |
           +----symantec.itools.awt.RollOverButton

public class RollOverButton
extends Component
This is a button that allows three different states and displays the document with a given URL when clicked. Each button state has its own associated image. Each image is specified by providing the file name or the URL of the file containing the image. The document to show is specified by providing the "LinkURL" of that document.

The "standard" state is when the mouse is not over the button. If the standard image is null, the button will be transparent when in the standard state, otherwise the specified image will be displayed.

The "over" state is when the mouse cursor is over the button. This state also displays the LinkURL if it is not null.

The "down" state is when the mouse button is pressed inside the button. When there is a MOUSE_UP in the button, it will attempt to show the document at the LinkURL unless it is null. This state also displays the LinkURL if it is not null.

Version:
1.1, July 14, 1997
Author:
Symantec

Variable Index

 o context
The applet context that shows the document.
 o downFileName
The file name of the image to display while the mouse is over the button and pressed.
 o downImage
The image displayed while the mouse is pressed down inside the button.
 o downURL
The URL of the image to use while the mouse is over the button and pressed.
 o frame
The frame specifier for showing a URL document in a browser or applet viewer.
 o isCenterMode
If true the image will be centered within the bounds of the button.
 o isClearFrame
If true the frame is cleared in between drawing different button states.
 o isMouseDrag
True if the mouse is being dragged in the button.
 o isMouseOver
True if the mouse is over the button.
 o isPressed
True if the mouse button is being pressed.
 o linkURL
The URL of the document to show after the button has been pressed.
 o overFileName
The file name of the image to display while the mouse is over the button.
 o overImage
The image displayed while the mouse is over the button.
 o overURL
The URL of the image to use while the mouse is over the button.
 o standardFileName
The file name of the image to display while the mouse is not over the button.
 o standardImage
The image displayed while the mouse is not over the button.
 o standardURL
The URL of the image to use in while the mouse is not over the button.

Constructor Index

 o symantec.itools.awt.RollOverButton()
Constructs a default RollOverButton.
 o symantec.itools.awt.RollOverButton(String, String, String)
Constructs a RollOverButton with an image file name given for each button state.
 o symantec.itools.awt.RollOverButton(URL, URL, URL)
Constructs a RollOverButton with an image file URL given for each button state.
 o symantec.itools.awt.RollOverButton(Image, Image, Image)
Constructs a RollOverButton with an image given for each button state.

Method Index

 o addActionListener(ActionListener)
Adds the specified action listener to receive action events from this button.
 o addNotify()
Tells this component that it has been added to a container.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o getActionCommand()
 o getCenterMode()
 o getClearFrame()
 o getDownFileName()
Gets the file name of the image to display while the button is being pressed.
 o getDownImage()
Gets the image displayed while the button is being pressed.
 o getDownURL()
Gets the URL of the image to display while the button is being pressed.
 o getFrame()
Gets the frame specifier for showing a URL document in a browser or applet viewer.
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getOverFileName()
Gets the file name of the image to display while the mouse is over the button.
 o getOverImage()
Gets the image displayed while the mouse is over the button.
 o getOverURL()
Gets the URL of the image to display while the mouse is over the button.
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o getStandardFileName()
Gets the file name of the image to display while the mouse is not over the button.
 o getStandardImage()
Gets the image displayed while the mouse is not over the button.
 o getStandardURL()
Gets the URL of the image to display while the mouse is not over the button.
 o getURL()
Gets the URL of the document to display on mouse up.
 o isCenterMode()
Gets the flag that determines whether to center the image within the bounds of the button.
 o isClearFrame()
Gets the flag that determines if the background should be erased before the button is drawn.
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
 o removeActionListener(ActionListener)
Removes the specified action listener so it no longer receives action events from this button.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o setActionCommand(String)
Sets the command name of the action event fired by this button.
 o setAppletContext(AppletContext)
Sets the applet context used to view documents.
 o setCenterMode(boolean)
Sets the flag to center the image within the bounds of the button.
 o setClearFrame(boolean)
Sets the flag to erase the background before drawing the button.
 o setDownFileName(String)
Sets the file name of the image to display while the button is being pressed.
 o setDownImage(Image)
Sets the image to display while the button is being pressed.
 o setDownURL(URL)
Sets the URL of the image to display while the button is being pressed.
 o setFrame(String)
Sets the frame specifier for showing a URL document in a browser or applet viewer.
 o setImageHelper(Image)
A function used to consolidate shared code between the three image setting functions.
 o setOverFileName(String)
Sets the file name of the image to display while the mouse is over the button.
 o setOverImage(Image)
Sets the image to display while the mouse is over the button.
 o setOverURL(URL)
Sets the URL of the image to display while the mouse is over the button.
 o setStandardFileName(String)
Sets the file name of the image to display while the mouse is not over the button.
 o setStandardImage(Image)
Sets the image to display while the mouse is not over the button.
 o setStandardURL(URL)
Sets the URL of the image to display while the mouse is not over the button.
 o setURL(URL)
Sets the URL of the document to display on mouse up.
 o sourceActionEvent()
Fire an action event to the listeners
 o update(Graphics)
Handles redrawing of this component on the screen.
 o validate()
Ensures that this component is laid out properly, as needed.

Variables

 o context
protected transient java.applet.AppletContext context
The applet context that shows the document.

 o downFileName
protected java.lang.String downFileName
The file name of the image to display while the mouse is over the button and pressed.

 o downImage
protected transient java.awt.Image downImage
The image displayed while the mouse is pressed down inside the button. If this is null, no drawing takes place.

 o downURL
protected java.net.URL downURL
The URL of the image to use while the mouse is over the button and pressed.

 o frame
protected java.lang.String frame
The frame specifier for showing a URL document in a browser or applet viewer. It is interpreted as follows:

 o isCenterMode
protected boolean isCenterMode
If true the image will be centered within the bounds of the button. If false the image is drawn at 0,0 relative to the bounds of the button.

 o isClearFrame
protected boolean isClearFrame
If true the frame is cleared in between drawing different button states.

 o isMouseDrag
protected transient boolean isMouseDrag
True if the mouse is being dragged in the button.

 o isMouseOver
protected transient boolean isMouseOver
True if the mouse is over the button.

 o isPressed
protected transient boolean isPressed
True if the mouse button is being pressed.

 o linkURL
protected java.net.URL linkURL
The URL of the document to show after the button has been pressed.

 o overFileName
protected java.lang.String overFileName
The file name of the image to display while the mouse is over the button.

 o overImage
protected transient java.awt.Image overImage
The image displayed while the mouse is over the button. If this is null, the StandardImage will be used. If that is null, the button will be invisible in this state.

 o overURL
protected java.net.URL overURL
The URL of the image to use while the mouse is over the button.

 o standardFileName
protected java.lang.String standardFileName
The file name of the image to display while the mouse is not over the button.

 o standardImage
protected transient java.awt.Image standardImage
The image displayed while the mouse is not over the button. If this is null, the button will be invisible in this state.

 o standardURL
protected java.net.URL standardURL
The URL of the image to use in while the mouse is not over the button.

Constructors

 o RollOverButton
public RollOverButton()
Constructs a default RollOverButton. It has no associated images nor a LinkURL.

 o RollOverButton
public RollOverButton(String standard,
                      String over,
                      String down) throws MalformedURLException
Constructs a RollOverButton with an image file name given for each button state.

Parameters:
Standard - the file name of the image to use while the mouse is not over the button
Over - the file name of the image to use while the mouse is over the button
Down - the file name of the image to use while the mouse is over the button and pressed
Throws: MalformedURLException
if a URL cannot be created from any of file names
 o RollOverButton
public RollOverButton(URL standard,
                      URL over,
                      URL down)
Constructs a RollOverButton with an image file URL given for each button state.

Parameters:
Standard - the URL of the image to use while the mouse is not over the button
Over - the URL of the image to use while the mouse is over the button
Down - the URL of the image to use while the mouse is over the button and pressed
 o RollOverButton
public RollOverButton(Image standard,
                      Image over,
                      Image down)
Constructs a RollOverButton with an image given for each button state.

Parameters:
Standard - the image to use while the mouse is not over the button
Over - the image to use while the mouse is over the button
Down - the image to use while the mouse is over the button and pressed

Methods

 o addActionListener
public synchronized void addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this button.

Parameters:
l - the action listener
 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to hook-up event listeners.

Overrides:
addNotify in class Component
See Also:
removeNotify
 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
listener - the listener to add.
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
listener - the listener to add.
See Also:
removeVetoableChangeListener
 o getActionCommand
public java.lang.String getActionCommand()

Returns:
the command name of the action event fired by this button.
 o getCenterMode
public boolean getCenterMode()
Note: getCenterMode() is deprecated.

See Also:
isCenterMode
 o getClearFrame
public boolean getClearFrame()
Note: getClearFrame() is deprecated.

See Also:
isClearFrame
 o getDownFileName
public java.lang.String getDownFileName()
Gets the file name of the image to display while the button is being pressed.

Returns:
the image file name
See Also:
setDownFileName
 o getDownImage
public java.awt.Image getDownImage()
Gets the image displayed while the button is being pressed.

Returns:
the image
See Also:
setDownImage
 o getDownURL
public java.net.URL getDownURL()
Gets the URL of the image to display while the button is being pressed.

Returns:
the image URL
See Also:
setDownURL
 o getFrame
public java.lang.String getFrame()
Gets the frame specifier for showing a URL document in a browser or applet viewer. It is interpreted as follows:

Returns:
the current frame specifier
See Also:
setFrame, frame
 o getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component. In this case the minimum size simply returns the results of a call to getPreferedSize().

Overrides:
getMinimumSize in class Component
See Also:
getPreferredSize
 o getOverFileName
public java.lang.String getOverFileName()
Gets the file name of the image to display while the mouse is over the button.

Returns:
the image file name
See Also:
setOverFileName
 o getOverImage
public java.awt.Image getOverImage()
Gets the image displayed while the mouse is over the button.

Returns:
the image
See Also:
setOverImage
 o getOverURL
public java.net.URL getOverURL()
Gets the URL of the image to display while the mouse is over the button.

Returns:
the image URL
See Also:
setOverURL
 o getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component. In this case the recommended size is the minimum dimension needed to encompass the three images that might be displayed.

Overrides:
getPreferredSize in class Component
See Also:
getMinimumSize
 o getStandardFileName
public java.lang.String getStandardFileName()
Gets the file name of the image to display while the mouse is not over the button.

Returns:
the image file name
See Also:
setStandardFileName
 o getStandardImage
public java.awt.Image getStandardImage()
Gets the image displayed while the mouse is not over the button.

Returns:
the image
See Also:
setStandardImage
 o getStandardURL
public java.net.URL getStandardURL()
Gets the URL of the image to display while the mouse is not over the button.

Returns:
the image URL
See Also:
setStandardURL
 o getURL
public java.net.URL getURL()
Gets the URL of the document to display on mouse up.

Returns:
the URL of the document to display
See Also:
setURL
 o isCenterMode
public boolean isCenterMode()
Gets the flag that determines whether to center the image within the bounds of the button.

Returns:
true if the image will be centered within the button, false if the image will be drawn at 0,0 relative to the button.
See Also:
setCenterMode
 o isClearFrame
public boolean isClearFrame()
Gets the flag that determines if the background should be erased before the button is drawn.

Returns:
true if the background will be cleared before painting the button, false if it will not be cleared
See Also:
setClearFrame
 o paint
public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its [0,0] coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Component
See Also:
repaint, update
 o preferredSize
public java.awt.Dimension preferredSize()
Note: preferredSize() is deprecated.

Overrides:
preferredSize in class Component
See Also:
getPreferredSize
 o removeActionListener
public synchronized void removeActionListener(ActionListener l)
Removes the specified action listener so it no longer receives action events from this button.

Parameters:
l - the action listener
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

Overrides:
removeNotify in class Component
See Also:
addNotify
 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
listener - the listener to remove.
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
listener - the listener to remove.
See Also:
addVetoableChangeListener
 o setActionCommand
public void setActionCommand(String command) throws PropertyVetoException
Sets the command name of the action event fired by this button.

Parameters:
command - The name of the action event command fired by this button
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setAppletContext
protected void setAppletContext(AppletContext c)
Sets the applet context used to view documents.

Parameters:
c - the new applet context
 o setCenterMode
public void setCenterMode(boolean flag) throws PropertyVetoException
Sets the flag to center the image within the bounds of the button.

Parameters:
flag - true to center the image within the button, false to draw the image at 0,0 relative to the button
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
isCenterMode
 o setClearFrame
public void setClearFrame(boolean b) throws PropertyVetoException
Sets the flag to erase the background before drawing the button. Not erasing the background often results in a faster, more flicker-free update.

Parameters:
b - if true clear the background before painting, if false then don't
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
isClearFrame
 o setDownFileName
public void setDownFileName(String str) throws MalformedURLException, PropertyVetoException
Sets the file name of the image to display while the button is being pressed.

Parameters:
str - the image file name
Throws: MalformedURLException
if a URL cannot be created from the file name
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getDownFileName
 o setDownImage
public void setDownImage(Image img) throws PropertyVetoException
Sets the image to display while the button is being pressed.

Parameters:
img - the image
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getDownImage
 o setDownURL
public void setDownURL(URL aUrl) throws MalformedURLException, PropertyVetoException
Sets the URL of the image to display while the button is being pressed.

Parameters:
aURL - the image URL
Throws: PropertyVetoException
if the specified property value is unacceptable
Throws: MalformedURLException
if the given URL is bad
See Also:
getDownURL
 o setFrame
public void setFrame(String f) throws PropertyVetoException
Sets the frame specifier for showing a URL document in a browser or applet viewer. It is interpreted as follows:

Parameters:
f - the new frame specifier
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getFrame, frame
 o setImageHelper
protected void setImageHelper(Image img)
A function used to consolidate shared code between the three image setting functions.

Parameters:
img - the image to set
 o setOverFileName
public void setOverFileName(String str) throws MalformedURLException, PropertyVetoException
Sets the file name of the image to display while the mouse is over the button.

Parameters:
str - the image file name
Throws: MalformedURLException
if a URL cannot be created from the file name
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getOverFileName
 o setOverImage
public void setOverImage(Image img) throws PropertyVetoException
Sets the image to display while the mouse is over the button.

Parameters:
img - the image
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getOverImage
 o setOverURL
public void setOverURL(URL aUrl) throws MalformedURLException, PropertyVetoException
Sets the URL of the image to display while the mouse is over the button.

Parameters:
aURL - the image URL
Throws: PropertyVetoException
if the specified property value is unacceptable
Throws: MalformedURLException
if the given URL is bad
See Also:
getOverURL
 o setStandardFileName
public void setStandardFileName(String str) throws MalformedURLException, PropertyVetoException
Sets the file name of the image to display while the mouse is not over the button.

Parameters:
str - the image file name
Throws: MalformedURLException
if a URL cannot be created from the file name
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getStandardFileName
 o setStandardImage
public void setStandardImage(Image img) throws PropertyVetoException
Sets the image to display while the mouse is not over the button.

Parameters:
img - the image
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getStandardImage
 o setStandardURL
public void setStandardURL(URL aUrl) throws MalformedURLException, PropertyVetoException
Sets the URL of the image to display while the mouse is not over the button.

Parameters:
aURL - the image URL
Throws: PropertyVetoException
if the specified property value is unacceptable
Throws: MalformedURLException
if the given URL is bad
See Also:
getStandardURL
 o setURL
public void setURL(URL aUrl) throws PropertyVetoException
Sets the URL of the document to display on mouse up.

Parameters:
u - the URL of the document to display
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getURL
 o sourceActionEvent
public void sourceActionEvent()
Fire an action event to the listeners

 o update
public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its [0,0] coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to add the clear frame feature to this button.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o validate
public void validate()
Ensures that this component is laid out properly, as needed. This is a standard Java AWT method which gets called by the AWT to make sure this component and its subcomponents have a valid layout. If this component was made invalid with a call to invalidate(), then it is laid out again. It is overridden here to locate the applet containing this component.

Overrides:
validate in class Component
See Also:
invalidate

All Packages  Class Hierarchy  This Package  Previous  Next  Index