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
-
context
- The applet context that shows the document.
-
downFileName
- The file name of the image to display while the mouse is over the button and pressed.
-
downImage
- The image displayed while the mouse is pressed down inside the button.
-
downURL
- The URL of the image to use while the mouse is over the button and pressed.
-
frame
- The frame specifier for showing a URL document in a browser or applet
viewer.
-
isCenterMode
- If true the image will be centered within the bounds of the
button.
-
isClearFrame
- If true the frame is cleared in between drawing
different button states.
-
isMouseDrag
- True if the mouse is being dragged in the button.
-
isMouseOver
- True if the mouse is over the button.
-
isPressed
- True if the mouse button is being pressed.
-
linkURL
- The URL of the document to show after the button has been pressed.
-
overFileName
- The file name of the image to display while the mouse is over the button.
-
overImage
- The image displayed while the mouse is over the button.
-
overURL
- The URL of the image to use while the mouse is over the button.
-
standardFileName
- The file name of the image to display while the mouse is not over the button.
-
standardImage
- The image displayed while the mouse is not over the button.
-
standardURL
- The URL of the image to use in while the mouse is not over the button.
-
symantec.itools.awt.RollOverButton()
- Constructs a default RollOverButton.
-
symantec.itools.awt.RollOverButton(String, String, String)
- Constructs a RollOverButton with an image file name given for each
button state.
-
symantec.itools.awt.RollOverButton(URL, URL, URL)
- Constructs a RollOverButton with an image file URL given for each
button state.
-
symantec.itools.awt.RollOverButton(Image, Image, Image)
- Constructs a RollOverButton with an image given for each button state.
-
addActionListener(ActionListener)
- Adds the specified action listener to receive action events
from this button.
-
addNotify()
- Tells this component that it has been added to a container.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener for all event changes.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a vetoable listener for all event changes.
-
getActionCommand()
-
-
getCenterMode()
-
-
getClearFrame()
-
-
getDownFileName()
- Gets the file name of the image to display while the button is being
pressed.
-
getDownImage()
- Gets the image displayed while the button is being pressed.
-
getDownURL()
- Gets the URL of the image to display while the button is being pressed.
-
getFrame()
- Gets the frame specifier for showing a URL document in a browser or applet
viewer.
-
getMinimumSize()
- Returns the minimum dimensions to properly display this component.
-
getOverFileName()
- Gets the file name of the image to display while the mouse is over
the button.
-
getOverImage()
- Gets the image displayed while the mouse is over the button.
-
getOverURL()
- Gets the URL of the image to display while the mouse is over
the button.
-
getPreferredSize()
- Returns the recommended dimensions to properly display this component.
-
getStandardFileName()
- Gets the file name of the image to display while the mouse is not over
the button.
-
getStandardImage()
- Gets the image displayed while the mouse is not over the button.
-
getStandardURL()
- Gets the URL of the image to display while the mouse is not over
the button.
-
getURL()
- Gets the URL of the document to display on mouse up.
-
isCenterMode()
- Gets the flag that determines whether to center the image within the
bounds of the button.
-
isClearFrame()
- Gets the flag that determines if the background should be erased before
the button is drawn.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
preferredSize()
-
-
removeActionListener(ActionListener)
- Removes the specified action listener so it no longer receives
action events from this button.
-
removeNotify()
- Tells this component that it is being removed from a container.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a listener for all event changes.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable listener for all event changes.
-
setActionCommand(String)
- Sets the command name of the action event fired by this button.
-
setAppletContext(AppletContext)
- Sets the applet context used to view documents.
-
setCenterMode(boolean)
- Sets the flag to center the image within the bounds of the button.
-
setClearFrame(boolean)
- Sets the flag to erase the background before drawing the button.
-
setDownFileName(String)
- Sets the file name of the image to display while the button is being pressed.
-
setDownImage(Image)
- Sets the image to display while the button is being pressed.
-
setDownURL(URL)
- Sets the URL of the image to display while the button is being pressed.
-
setFrame(String)
- Sets the frame specifier for showing a URL document in a browser or applet
viewer.
-
setImageHelper(Image)
- A function used to consolidate shared code between the three image setting functions.
-
setOverFileName(String)
- Sets the file name of the image to display while the mouse is over
the button.
-
setOverImage(Image)
- Sets the image to display while the mouse is over the button.
-
setOverURL(URL)
- Sets the URL of the image to display while the mouse is over
the button.
-
setStandardFileName(String)
- Sets the file name of the image to display while the mouse is not over
the button.
-
setStandardImage(Image)
- Sets the image to display while the mouse is not over the button.
-
setStandardURL(URL)
- Sets the URL of the image to display while the mouse is not over
the button.
-
setURL(URL)
- Sets the URL of the document to display on mouse up.
-
sourceActionEvent()
- Fire an action event to the listeners
-
update(Graphics)
- Handles redrawing of this component on the screen.
-
validate()
- Ensures that this component is laid out properly, as needed.
context
protected transient java.applet.AppletContext context
- The applet context that shows the document.
downFileName
protected java.lang.String downFileName
- The file name of the image to display while the mouse is over the button and pressed.
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.
downURL
protected java.net.URL downURL
- The URL of the image to use while the mouse is over the button and pressed.
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:
- "_self" show document in the current frame
- "_parent" show document in the parent frame
- "_top" show document in the topmost frame
- "_blank" show document in a new unnamed toplevel window
- all others show document in a new toplevel window with the given name
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.
isClearFrame
protected boolean isClearFrame
- If true the frame is cleared in between drawing
different button states.
isMouseDrag
protected transient boolean isMouseDrag
- True if the mouse is being dragged in the button.
isMouseOver
protected transient boolean isMouseOver
- True if the mouse is over the button.
isPressed
protected transient boolean isPressed
- True if the mouse button is being pressed.
linkURL
protected java.net.URL linkURL
- The URL of the document to show after the button has been pressed.
overFileName
protected java.lang.String overFileName
- The file name of the image to display while the mouse is over the button.
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.
overURL
protected java.net.URL overURL
- The URL of the image to use while the mouse is over the button.
standardFileName
protected java.lang.String standardFileName
- The file name of the image to display while the mouse is not over the button.
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.
standardURL
protected java.net.URL standardURL
- The URL of the image to use in while the mouse is not over the button.
RollOverButton
public RollOverButton()
- Constructs a default RollOverButton.
It has no associated images nor a LinkURL.
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
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
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
addActionListener
public synchronized void addActionListener(ActionListener l)
- Adds the specified action listener to receive action events
from this button.
- Parameters:
- l - the action listener
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
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener for all event changes.
- Parameters:
- listener - the listener to add.
- See Also:
- removePropertyChangeListener
addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a vetoable listener for all event changes.
- Parameters:
- listener - the listener to add.
- See Also:
- removeVetoableChangeListener
getActionCommand
public java.lang.String getActionCommand()
-
- Returns:
- the command name of the action event fired by this button.
getCenterMode
public boolean getCenterMode()
- Note: getCenterMode() is deprecated.
-
- See Also:
- isCenterMode
getClearFrame
public boolean getClearFrame()
- Note: getClearFrame() is deprecated.
-
- See Also:
- isClearFrame
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
getDownImage
public java.awt.Image getDownImage()
- Gets the image displayed while the button is being pressed.
- Returns:
- the image
- See Also:
- setDownImage
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
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:
- "_self" show document in the current frame
- "_parent" show document in the parent frame
- "_top" show document in the topmost frame
- "_blank" show document in a new unnamed toplevel window
- all others show document in a new toplevel window with the given name
- Returns:
- the current frame specifier
- See Also:
- setFrame, frame
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
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
getOverImage
public java.awt.Image getOverImage()
- Gets the image displayed while the mouse is over the button.
- Returns:
- the image
- See Also:
- setOverImage
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
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
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
getStandardImage
public java.awt.Image getStandardImage()
- Gets the image displayed while the mouse is not over the button.
- Returns:
- the image
- See Also:
- setStandardImage
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
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
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
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
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
preferredSize
public java.awt.Dimension preferredSize()
- Note: preferredSize() is deprecated.
-
- Overrides:
- preferredSize in class Component
- See Also:
- getPreferredSize
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
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
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener for all event changes.
- Parameters:
- listener - the listener to remove.
- See Also:
- addPropertyChangeListener
removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable listener for all event changes.
- Parameters:
- listener - the listener to remove.
- See Also:
- addVetoableChangeListener
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
setAppletContext
protected void setAppletContext(AppletContext c)
- Sets the applet context used to view documents.
- Parameters:
- c - the new applet context
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
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
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
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
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
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:
- "_self" show document in the current frame
- "_parent" show document in the parent frame
- "_top" show document in the topmost frame
- "_blank" show document in a new unnamed toplevel window
- all others show document in a new toplevel window with the given name
- Parameters:
- f - the new frame specifier
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getFrame, frame
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
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
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
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
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
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
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
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
sourceActionEvent
public void sourceActionEvent()
- Fire an action event to the listeners
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
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