|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
edu.princeton.swing.PHyperlink
public class PHyperlink
PHyperlink is a subclass of AbstractButton which looks and feels like a hyperlink. Note the
following correlation between the properties of a ButtonModel and the state of the hyperlink:
!isPressed() && !isRollover() && !isSelected -> Link
!isPressed() && isRollover() && !isSelected -> Hover
!isPressed() && !isRollover() && isSelected -> Visited
!isPressed() && isRollover() && isSelected -> Visited Hover
isPressed() -> Active
Nested Class Summary | |
---|---|
static class |
PHyperlink.HyperlinkButtonModel
HyperlinkButtonModel is similar to JToggleButton.ToggleButtonModel except that once it is selected, it doesn't ever toggle back without an explicit setSelected() call. |
protected class |
PHyperlink.Listener
Listener implements ChangeListener to listen for changes in the ButtonModel's state and MouseListener to listen for mouse actions on the label. |
static class |
PHyperlink.UnderlineBorder
UnderlineBorder is a simple subclass of AbstractBorder that draws an underline. |
Nested classes/interfaces inherited from class javax.swing.AbstractButton |
---|
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static byte |
BLUE_STYLE
|
static byte |
CLASSIC_HOVER_STYLE
|
static byte |
CLASSIC_STYLE
|
static byte |
METAL_STYLE
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
PHyperlink()
Create a new PHyperlink. |
|
PHyperlink(Action a)
Create a new PHyperlink. |
|
PHyperlink(Action a,
byte style)
Create a new PHyperlink. |
|
PHyperlink(String text)
Create a new PHyperlink. |
|
PHyperlink(String text,
Icon icon)
Create a new PHyperlink. |
|
PHyperlink(String text,
Icon icon,
byte style)
Create a new PHyperlink. |
|
PHyperlink(String text,
Icon icon,
Color linkColor,
boolean linkUnderline,
Color hoverColor,
boolean hoverUnderline,
Color disabledColor,
boolean disabledUnderline,
Color visitedColor,
boolean visitedUnderline,
Color visitedHoverColor,
boolean visitedHoverUnderline,
Color visitedDisabledColor,
boolean visitedDisabledUnderline,
Color activeColor,
boolean activeUnderline)
Create a new PHyperlink. |
Method Summary | |
---|---|
Color |
getActiveColor()
Returns the color of the link in an active, non-disabled state. |
boolean |
getActiveUnderline()
Returns wheter or not to underline the link in an active, non-disabled state. |
Color |
getDisabledColor()
Returns the color of the link in a non-visited, disabled state. |
boolean |
getDisabledUnderline()
Returns wheter or not to underline the link in a non-visited, disabled state. |
Color |
getHoverColor()
Returns the color of the link in a hover, non-visited, non-active, non-disabled state. |
boolean |
getHoverUnderline()
Returns wheter or not to underline the link in a hover, non-visited, non-active, non-disabled state. |
Color |
getLinkColor()
Returns the color of the link in a non-hover, non-visited, non-active, non-disabled state. |
boolean |
getLinkUnderline()
Returns wheter or not to underline the link in a non-hover, non-visited, non-active, non-disabled state. |
Color |
getVisitedColor()
Returns the color of the link in a non-hover, visited, non-active, non-disabled state. |
Color |
getVisitedDisabledColor()
Returns the color of the link in a visited, disabled state. |
boolean |
getVisitedDisabledUnderline()
Returns wheter or not to underline the link in a visited, disabled state. |
Color |
getVisitedHoverColor()
Returns the color of the link in a hover, visited, non-active, non-disabled state. |
boolean |
getVisitedHoverUnderline()
Returns wheter or not to underline the link in a hover, visited, non-active, non-disabled state. |
boolean |
getVisitedUnderline()
Returns wheter or not to underline the link in a non-hover, visited, non-active, non-disabled state. |
void |
initHyperlink()
Called by the constructors to initialize the hyperlink. |
void |
setActiveColor(Color color)
Sets the color of the link in an active, non-disabled state. |
void |
setActiveUnderline(boolean underline)
Sets wheter or not to underline the link in an active, non-disabled state. |
void |
setDisabledColor(Color color)
Sets the color of the link in a non-visited, disabled state. |
void |
setDisabledIcon(Icon icon)
Intercept setDisabledIcon() calls to propagate the changes to the label. |
void |
setDisabledSelectedIcon(Icon icon)
Intercept setDisabledSelectedIcon() calls to propagate the changes to the label. |
void |
setDisabledUnderline(boolean underline)
Sets wheter or not to underline the link in a non-visited, disabled state. |
void |
setEnabled(boolean enabled)
Intercept setEnabled() calls to propagate the changes to the label. |
void |
setHoverColor(Color color)
Sets the color of the link in a hover, non-visited, non-active, non-disabled state. |
void |
setHoverUnderline(boolean underline)
Sets wheter or not to underline the link in a hover, non-visited, non-active, non-disabled state. |
void |
setIcon(Icon icon)
Intercept setIcon() calls to propagate the changes to the label. |
void |
setLinkColor(Color color)
Sets the color of the link in a non-hover, non-visited, non-active, non-disabled state. |
void |
setLinkUnderline(boolean underline)
Sets wheter or not to underline the link in a non-hover, non-visited, non-active, non-disabled state. |
void |
setModel(ButtonModel model)
Intercept setModel() calls to keep a listener on the model. |
void |
setPressedIcon(Icon icon)
Intercept setPressedIcon() calls to propagate the changes to the label. |
void |
setRolloverIcon(Icon icon)
Intercept setRolloverIcon() calls to propagate the changes to the label. |
void |
setRolloverSelectedIcon(Icon icon)
Intercept setRolloverSelectedIcon() calls to propagate the changes to the label. |
void |
setSelectedIcon(Icon icon)
Intercept setSelectedIcon() calls to propagate the changes to the label. |
void |
setText(String text)
Intercept setText() calls to propagate the changes to the label. |
void |
setVisitedColor(Color color)
Sets the color of the link in a non-hover, visited, non-active, non-disabled state. |
void |
setVisitedDisabledColor(Color color)
Sets the color of the link in a visited, disabled state. |
void |
setVisitedDisabledUnderline(boolean underline)
Sets wheter or not to underline the link in a visited, disabled state. |
void |
setVisitedHoverColor(Color color)
Sets the color of the link in a hover, visited, non-active, non-disabled state. |
void |
setVisitedHoverUnderline(boolean underline)
Sets wheter or not to underline the link in a hover, visited, non-active, non-disabled state. |
void |
setVisitedUnderline(boolean underline)
Sets wheter or not to underline the link in a non-hover, visited, non-active, non-disabled state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte CLASSIC_STYLE
public static final byte CLASSIC_HOVER_STYLE
public static final byte BLUE_STYLE
public static final byte METAL_STYLE
Constructor Detail |
---|
public PHyperlink()
public PHyperlink(String text)
public PHyperlink(String text, Icon icon)
public PHyperlink(String text, Icon icon, byte style)
public PHyperlink(Action a)
public PHyperlink(Action a, byte style)
public PHyperlink(String text, Icon icon, Color linkColor, boolean linkUnderline, Color hoverColor, boolean hoverUnderline, Color disabledColor, boolean disabledUnderline, Color visitedColor, boolean visitedUnderline, Color visitedHoverColor, boolean visitedHoverUnderline, Color visitedDisabledColor, boolean visitedDisabledUnderline, Color activeColor, boolean activeUnderline)
Method Detail |
---|
public void initHyperlink()
public void setModel(ButtonModel model)
setModel
in class AbstractButton
public void setEnabled(boolean enabled)
setEnabled
in class AbstractButton
public void setText(String text)
setText
in class AbstractButton
public void setPressedIcon(Icon icon)
setPressedIcon
in class AbstractButton
public void setIcon(Icon icon)
setIcon
in class AbstractButton
public void setSelectedIcon(Icon icon)
setSelectedIcon
in class AbstractButton
public void setRolloverIcon(Icon icon)
setRolloverIcon
in class AbstractButton
public void setRolloverSelectedIcon(Icon icon)
setRolloverSelectedIcon
in class AbstractButton
public void setDisabledIcon(Icon icon)
setDisabledIcon
in class AbstractButton
public void setDisabledSelectedIcon(Icon icon)
setDisabledSelectedIcon
in class AbstractButton
public void setLinkColor(Color color)
color
- The new color of a the link in a non-hover, non-visited, non-active,
non-disabled state.public Color getLinkColor()
public void setLinkUnderline(boolean underline)
underline
- Wheter or not to underline the link in a non-hover, non-visited,
non-active, non-disabled state.public boolean getLinkUnderline()
public void setHoverColor(Color color)
color
- The new color of a the link in a hover, non-visited, non-active,
non-disabled state.public Color getHoverColor()
public void setHoverUnderline(boolean underline)
underline
- Wheter or not to underline the link in a hover, non-visited,
non-active, non-disabled state.public boolean getHoverUnderline()
public void setDisabledColor(Color color)
color
- The new color of a the link in a non-visited, disabled state.public Color getDisabledColor()
public void setDisabledUnderline(boolean underline)
underline
- Wheter or not to underline the link in a non-visited, disabled state.public boolean getDisabledUnderline()
public void setVisitedColor(Color color)
color
- The new color of a the link in a non-hover, visited, non-active,
non-disabled state.public Color getVisitedColor()
public void setVisitedUnderline(boolean underline)
underline
- Wheter or not to underline the link in a non-hover, visited,
non-active, non-disabled state.public boolean getVisitedUnderline()
public void setVisitedHoverColor(Color color)
color
- The new color of a the link in a hover, visited, non-active,
non-disabled state.public Color getVisitedHoverColor()
public void setVisitedHoverUnderline(boolean underline)
underline
- Wheter or not to underline the link in a hover, visited,
non-active, non-disabled state.public boolean getVisitedHoverUnderline()
public void setVisitedDisabledColor(Color color)
color
- The new color of a the link in a visited, disabled state.public Color getVisitedDisabledColor()
public void setVisitedDisabledUnderline(boolean underline)
underline
- Wheter or not to underline the link in a visited, disabled state.public boolean getVisitedDisabledUnderline()
public void setActiveColor(Color color)
color
- The new color of a the link in an active, non-disabled state.public Color getActiveColor()
public void setActiveUnderline(boolean underline)
underline
- Wheter or not to underline the link in an active, non-disabled state.public boolean getActiveUnderline()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |