public class ImageHyperlink extends Hyperlink
When image is taller than the text, additional style can be provided to control vertical alignment (supported values are SWT.TOP, SWT.BOTTOM and SWT.CENTER).
The class does not need to be sublassed but it is allowed to do so if some aspect of the image hyperlink needs to be modified.
| Modifier and Type | Field and Description |
|---|---|
int |
textSpacing
Amount of pixels between the image and the text (default is 5).
|
marginHeight, marginWidth| Constructor and Description |
|---|
ImageHyperlink(Composite parent,
int style)
Creates the image hyperlink instance.
|
| Modifier and Type | Method and Description |
|---|---|
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Computes the control size by reserving space for images in addition to
text.
|
Image |
getActiveImage()
Returns active image.
|
Image |
getHoverImage()
Returns the hover image.
|
Image |
getImage()
Returns the image to show in the normal state.
|
protected void |
handleActivate(Event e)
Called when hyperlink has been activated.
|
protected void |
handleEnter(Event e)
Called when hyperlink is entered.
|
protected void |
handleExit(Event e)
Called when hyperlink is exited.
|
protected void |
paintHyperlink(GC gc)
Paints the hyperlink text.
|
void |
setActiveImage(Image activeImage)
Sets the image to show when link is activated.
|
void |
setHoverImage(Image hoverImage)
Sets the image to show when link is hover state (on mouse over).
|
void |
setImage(Image image)
Sets the image to show when link is in the normal state.
|
computeTextSize, getText, initAccessible, isUnderlined, paintText, setText, setUnderlinedaddHyperlinkListener, getHref, getSelection, paint, removeHyperlinkListener, setHrefdrawBackground, getCaret, scroll, setCaret, setFontchanged, checkSubclass, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabListcomputeTrim, getClientArea, getHorizontalBar, getVerticalBaraddControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, updateaddDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toStringpublic int textSpacing
public ImageHyperlink(Composite parent, int style)
parent - the control parentstyle - the control style (SWT.WRAP, BOTTOM, TOP, MIDDLE, LEFT, RIGHT)protected void paintHyperlink(GC gc)
HyperlinkpaintHyperlink in class Hyperlinkgc - graphic contextpublic Point computeSize(int wHint, int hHint, boolean changed)
computeSize in class HyperlinkwHint - width hinthHint - height hintchanged - if true, any cached layout data should be
computed anewLayout,
Control.getBorderWidth(),
Control.getBounds(),
Control.getSize(),
Control.pack(boolean),
"computeTrim, getClientArea for controls that implement them"protected void handleEnter(Event e)
AbstractHyperlinkhandleEnter in class AbstractHyperlinkprotected void handleExit(Event e)
AbstractHyperlinkhandleExit in class AbstractHyperlinkprotected void handleActivate(Event e)
AbstractHyperlinkhandleActivate in class AbstractHyperlinkpublic Image getActiveImage()
null if not set.public void setActiveImage(Image activeImage)
activeImage - public Image getHoverImage()
null if not set.public void setHoverImage(Image hoverImage)
hoverImage - public Image getImage()
null if not set.public void setImage(Image image)
image - Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.