All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.RollOverButton
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----symantec.itools.awt.RollOverButton
- public class RollOverButton
- extends Canvas
- implements TransparencyTrick
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.
-
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.
-
RollOverButton()
- Constructs a default RollOverButton.
-
RollOverButton(Image, Image, Image)
- Constructs a RollOverButton with an image given for each button state.
-
RollOverButton(String, String, String)
- Constructs a RollOverButton with an image file name given for each
button state.
-
RollOverButton(URL, URL, URL)
- Constructs a RollOverButton with an image file URL given for each
button state.
-
getCenterMode()
- Gets the flag that determines whether to center the image within the
bounds of the button.
-
getClearFrame()
- Gets the flag that determines if the background should be erased before
the button is drawn.
-
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.
-
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.
-
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.
-
mouseDown(Event, int, int)
- Processes MOUSE_DOWN events.
-
mouseDrag(Event, int, int)
- Processes MOUSE_DRAG events.
-
mouseEnter(Event, int, int)
- Processes MOUSE_ENTER events.
-
mouseExit(Event, int, int)
- Processes MOUSE_EXIT events.
-
mouseMove(Event, int, int)
- Processes MOUSE_MOVE events.
-
mouseUp(Event, int, int)
- Processes MOUSE_UP events.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
preferredSize()
- Returns the recommended dimensions to properly display this component.
-
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.
-
setFileNameHelper(String)
- A function used to consolidate shared code between the three file name
setting methods.
-
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.
-
update(Graphics)
- Handles redrawing of this component on the screen.
-
validate()
- Ensures that this component is laid out properly, as needed.
StandardImage
protected 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.
OverImage
protected 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.
DownImage
protected Image DownImage
- The image displayed while the mouse is pressed down inside the button.
If this is null, no drawing takes place.
StandardFileName
protected String StandardFileName
- The file name of the image to display while the mouse is not over the button.
OverFileName
protected String OverFileName
- The file name of the image to display while the mouse is over the button.
DownFileName
protected String DownFileName
- The file name of the image to display while the mouse is over the button and pressed.
frame
protected 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
StandardURL
protected URL StandardURL
- The URL of the image to use in while the mouse is not over the button.
OverURL
protected URL OverURL
- The URL of the image to use while the mouse is over the button.
DownURL
protected URL DownURL
- The URL of the image to use while the mouse is over the button and pressed.
LinkURL
protected URL LinkURL
- The URL of the document to show after the button has been pressed.
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.
isMouseOver
protected boolean isMouseOver
- True if the mouse is over the button.
isClearFrame
protected boolean isClearFrame
- If true the frame is cleared in between drawing
different button states.
isPressed
protected boolean isPressed
- True if the mouse button is being pressed.
isMouseDrag
protected boolean isMouseDrag
- True if the mouse is being dragged in the button.
context
protected AppletContext context
- The applet context that shows the document.
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
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
setStandardFileName
public void setStandardFileName(String str) throws MalformedURLException
- Sets the file name of the image to display while the mouse is not over
the button.
- Parameters:
- str - the image file name
- See Also:
- getStandardFileName
getStandardFileName
public 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
setOverFileName
public void setOverFileName(String str) throws MalformedURLException
- Sets the file name of the image to display while the mouse is over
the button.
- Parameters:
- str - the image file name
- See Also:
- getOverFileName
getOverFileName
public 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
setDownFileName
public void setDownFileName(String str) throws MalformedURLException
- Sets the file name of the image to display while the button is being pressed.
- Parameters:
- str - the image file name
- See Also:
- getDownFileName
getDownFileName
public 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
setFileNameHelper
protected void setFileNameHelper(String str) throws MalformedURLException
- A function used to consolidate shared code between the three file name
setting methods. Do not call directly.
- Parameters:
- str - the image file name to set
setStandardURL
public void setStandardURL(URL aUrl)
- Sets the URL of the image to display while the mouse is not over
the button.
- Parameters:
- aURL - the image URL
- See Also:
- getStandardURL
getStandardURL
public 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
setOverURL
public void setOverURL(URL aUrl)
- Sets the URL of the image to display while the mouse is over
the button.
- Parameters:
- aURL - the image URL
- See Also:
- getOverURL
getOverURL
public URL getOverURL()
- Gets the URL of the image to display while the mouse is over
the button.
- Returns:
- the image URL
- See Also:
- setOverURL
setDownURL
public void setDownURL(URL aUrl)
- Sets the URL of the image to display while the button is being pressed.
- Parameters:
- aURL - the image URL
- See Also:
- getDownURL
getDownURL
public URL getDownURL()
- Gets the URL of the image to display while the button is being pressed.
- Returns:
- the image URL
- See Also:
- setDownURL
setStandardImage
public void setStandardImage(Image img)
- Sets the image to display while the mouse is not over the button.
- Parameters:
- img - the image
- See Also:
- getStandardImage
getStandardImage
public Image getStandardImage()
- Gets the image displayed while the mouse is not over the button.
- Returns:
- the image
- See Also:
- setStandardImage
setOverImage
public void setOverImage(Image img)
- Sets the image to display while the mouse is over the button.
- Parameters:
- img - the image
- See Also:
- getOverImage
getOverImage
public Image getOverImage()
- Gets the image displayed while the mouse is over the button.
- Returns:
- the image
- See Also:
- setOverImage
setDownImage
public void setDownImage(Image img)
- Sets the image to display while the button is being pressed.
- Parameters:
- img - the image
- See Also:
- getDownImage
getDownImage
public Image getDownImage()
- Gets the image displayed while the button is being pressed.
- Returns:
- the image
- See Also:
- setDownImage
setImageHelper
protected void setImageHelper(Image img)
- A function used to consolidate shared code between the three image setting functions.
Do not call directly.
- Parameters:
- img - the image to set
setClearFrame
public void setClearFrame(boolean b)
- 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
- See Also:
- getClearFrame
getClearFrame
public boolean getClearFrame()
- 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
setURL
public void setURL(URL u)
- Sets the URL of the document to display on mouse up.
- Parameters:
- u - the URL of the document to display
- See Also:
- getURL
getURL
public URL getURL()
- Gets the URL of the document to display on mouse up.
- Returns:
- the URL of the document to display
- See Also:
- setURL
setFrame
public void setFrame(String f)
- 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
- See Also:
- getFrame, frame
getFrame
public 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
setCenterMode
public void setCenterMode(boolean flag)
- Sets the flag to center the image within the bounds of the button.
- Parameters:
- b - true to center the image within the button,
false to draw the image at 0,0 relative to the button
- See Also:
- getCenterMode
getCenterMode
public boolean getCenterMode()
- 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
setAppletContext
protected void setAppletContext(AppletContext c)
- Sets the applet context used to view documents.
- Parameters:
- c - the new applet context
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 Canvas
- See Also:
- repaint, update
mouseEnter
public boolean mouseEnter(Event e,
int x,
int y)
- Processes MOUSE_ENTER events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_ENTER
event. These events occur when the mouse first moves over this
component.
It keeps track of the mouse position relative to the button, and
displays the URL link.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- always true since the event was handled
- Overrides:
- mouseEnter in class Component
- See Also:
- mouseExit, handleEvent
mouseExit
public boolean mouseExit(Event e,
int x,
int y)
- Processes MOUSE_EXIT events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_EXIT
event. These events occur when the mouse first leaves this
component.
It keeps track of the mouse position relative to the button,
and erases the URL link.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- always true since the event was handled
- Overrides:
- mouseExit in class Component
- See Also:
- mouseEnter, handleEvent
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- Processes MOUSE_DOWN events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_DOWN
event. These events occur when the mouse button is pressed while
inside this component.
It handles the mouse down event by setting the boolean isPressed.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- always true since the event was handled
- Overrides:
- mouseDown in class Component
- See Also:
- mouseUp, handleEvent
mouseUp
public boolean mouseUp(Event e,
int x,
int y)
- Processes MOUSE_UP events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_UP
event. These events occur when the mouse button is released while
inside this component.
It handles the mouse up event by linking to the LinkURL if it is not null, sets the
isPressed boolean, and posts an Action Event.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- always true since the event was handled
- Overrides:
- mouseUp in class Component
- See Also:
- mouseDown, handleEvent
mouseDrag
public boolean mouseDrag(Event e,
int x,
int y)
- Processes MOUSE_DRAG events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_DRAG
event. These events occur when the mouse is moved around inside this
component while the button is pressed.
It keeps track of the state of the mouse button while the mouse
position is in the button.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- always true since the event was handled
- Overrides:
- mouseDrag in class Component
- See Also:
- mouseMove, handleEvent
mouseMove
public boolean mouseMove(Event e,
int x,
int y)
- Processes MOUSE_MOVE events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_MOVE
event. These events occur when the mouse is moved around inside this
component while the button is NOT pressed.
It keeps track of the state of the mouse button while the mouse
position is in the button.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- always true since the event was handled
- Overrides:
- mouseMove in class Component
- See Also:
- mouseDrag, handleEvent
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
preferredSize
public Dimension preferredSize()
- 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:
- preferredSize in class Component
- See Also:
- minimumSize
All Packages Class Hierarchy This Package Previous Next Index