public class AboutPanel
extends javax.swing.JComponent
AboutPanel
is a component which has a background-image and a
rectangle in which a given text is scrolling (the scroll-area). You may also
specify an Image (e.g. a png-file with alpha-channel) that is drawn before
the scroll-text itself. An optional version-string may be given that will be
painted centered relative to the scroll-area.javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ABOUT_IMAGE_RESOURCE |
static java.lang.String |
BACKGROUND_IMAGE_RESOURCE |
static int |
MOUSE_BACKGROUND |
static int |
MOUSE_COMPONENT |
static int |
MOUSE_DISABLED |
static int |
MOUSE_SCROLLAREA |
static java.lang.String |
SCROLL_AREA_HEIGHT_RESOURCE |
static java.lang.String |
SCROLL_AREA_RESOURCE_BASE |
static java.lang.String |
SCROLL_AREA_TOOLTIP_TEXT_RESOURCE |
static java.lang.String |
SCROLL_AREA_WIDTH_RESOURCE |
static java.lang.String |
SCROLL_AREA_X_RESOURCE |
static java.lang.String |
SCROLL_AREA_Y_RESOURCE |
static java.lang.String |
SCROLL_TEXT_RESOURCE |
static java.lang.String |
TEXT_RESOURCE_BUNDLE_RESOURCE |
static java.lang.String |
TEXT_RESOURCE_PREFIX |
static java.lang.String |
VERSION_HEIGHT_RESOURCE |
static java.lang.String |
VERSION_TEXT_RESOURCE |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
AboutPanel() |
AboutPanel(java.net.URL backgroundImageUrl,
java.awt.Rectangle scrollArea,
java.lang.String scrollText)
Creates a new
AboutPanel initialized with the given parameters. |
AboutPanel(java.net.URL backgroundImageUrl,
java.awt.Rectangle scrollArea,
java.lang.String scrollText,
java.lang.String versionText,
int versionHeight)
Creates a new
AboutPanel initialized with the given parameters. |
AboutPanel(java.net.URL backgroundImageUrl,
java.awt.Rectangle scrollArea,
java.lang.String scrollText,
java.net.URL imageUrl,
java.lang.String versionText,
int versionHeight)
Creates a new
AboutPanel initialized with the given parameters. |
Modifier and Type | Method and Description |
---|---|
void |
addNotify()
This method calls
super.addNotify() and notifies the
scroll-thread by calling setScrolling(true) . |
protected void |
calculatePreferredSize()
This methods takes the insets (the border) of this component into account
when the preferred size is calculated.
|
static java.awt.image.ConvolveOp |
getGaussianBlurFilter(int radius,
boolean horizontal) |
int |
getMaximumScrollPosition()
Gets the MaximumScrollPosition attribute of the
AboutPanel
object. |
int |
getMinimumScrollPosition()
Gets the MinimumScrollPosition attribute of the
AboutPanel
object. |
java.lang.String |
getScrollAreaToolTipText()
Gets the ScrollAreaToolTipText attribute of the
AboutPanel
object |
int |
getScrollPosition()
Gets the ScrollPosition attribute of the
AboutPanel object |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent evt)
This method returns ScrollAreaToolTipText if the point of the
MouseEvent
is inside the scroll-area and null otherwise. |
protected boolean |
handleMouseEvent(java.awt.event.MouseEvent evt) |
protected void |
increaseScrollPosition()
Increases the ScrollPosition by SCROLL_PIXELS.
|
boolean |
isDebug() |
boolean |
isScrolling()
This method returns
true if scrolling is currently active. |
void |
paintComponent(java.awt.Graphics graphics)
Paints this component.
|
void |
removeNotify()
This method calls
super.removeNotify() and sends the
scroll-thread into a wait-state by calling setScrolling(false)
. |
void |
setAboutImage(java.awt.image.BufferedImage aboutImage) |
void |
setAboutImage(java.net.URL imageUrl) |
void |
setBackgroundImage(java.awt.image.BufferedImage backgroundImage)
Sets the backgroundImage attribute of the
AboutPanel object |
void |
setBackgroundImage(java.net.URL imageUrl)
Sets the backgroundImage attribute of the
AboutPanel object |
void |
setDebug(boolean debug) |
void |
setFont(java.awt.Font newFont)
Sets the font attribute of the
AboutPanel object. |
void |
setScrollArea(java.awt.Rectangle scrollArea)
Sets the scrollArea attribute of the
AboutPanel object |
void |
setScrollAreaToolTipText(java.lang.String toolTipText)
Sets the ToolTipText that will appear if the user moves the mouse over the
scroll-area of this component.
|
void |
setScrolling(boolean scrolling)
This method is used to set the scrolling-property of this component.
|
protected void |
setScrollLines(java.lang.String[] scrollLines) |
void |
setScrollPosition(int scrollPosition)
Sets the scrollPosition attribute of the
AboutPanel object. |
void |
setScrollText(java.lang.String scrollText) |
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String BACKGROUND_IMAGE_RESOURCE
public static final java.lang.String ABOUT_IMAGE_RESOURCE
public static final java.lang.String TEXT_RESOURCE_PREFIX
public static final java.lang.String SCROLL_TEXT_RESOURCE
public static final java.lang.String VERSION_TEXT_RESOURCE
public static final java.lang.String VERSION_HEIGHT_RESOURCE
public static final java.lang.String SCROLL_AREA_RESOURCE_BASE
public static final java.lang.String SCROLL_AREA_X_RESOURCE
public static final java.lang.String SCROLL_AREA_Y_RESOURCE
public static final java.lang.String SCROLL_AREA_WIDTH_RESOURCE
public static final java.lang.String SCROLL_AREA_HEIGHT_RESOURCE
public static final java.lang.String SCROLL_AREA_TOOLTIP_TEXT_RESOURCE
public static final java.lang.String TEXT_RESOURCE_BUNDLE_RESOURCE
public static final int MOUSE_DISABLED
public static final int MOUSE_COMPONENT
public static final int MOUSE_SCROLLAREA
public static final int MOUSE_BACKGROUND
public AboutPanel(java.net.URL backgroundImageUrl, java.awt.Rectangle scrollArea, java.lang.String scrollText) throws java.io.IOException
AboutPanel
initialized with the given parameters.backgroundImageUrl
- The URL to the Background-Image of the
AboutPanel. This parameter is mandatory.scrollArea
- The Rectangle inside the background-image where
scrolling should take place. This parameter is optional. If it's null
then the scroll-area is set to (0, 0, background.width,
background.height).scrollText
- The text that will be scrolled.java.io.IOException
- If receiving content from backgroundImageUrl failspublic AboutPanel(java.net.URL backgroundImageUrl, java.awt.Rectangle scrollArea, java.lang.String scrollText, java.lang.String versionText, int versionHeight) throws java.io.IOException
AboutPanel
initialized with the given parameters.backgroundImageUrl
- The URL to the Background-Image of the
AboutPanel. This parameter is mandatory.scrollArea
- The Rectangle inside the background-image where
scrolling should take place. This parameter is optional. If it's null
then the scroll-area is set to (0, 0, background.width,
background.height).scrollText
- The text to be scrolled.versionText
- The String describing the version of the program.
It is painted centered to the scroll-rectangle at the specified height.
This parameter is optional.versionHeight
- The height at which the version-string is
supposed to be painted. This parameter is optional but should be given
a correct value if versionText!=null..java.io.IOException
- if loading the images failed.public AboutPanel(java.net.URL backgroundImageUrl, java.awt.Rectangle scrollArea, java.lang.String scrollText, java.net.URL imageUrl, java.lang.String versionText, int versionHeight) throws java.io.IOException
AboutPanel
initialized with the given parameters.backgroundImageUrl
- The URL to the Background-Image of the
AboutPanel. This parameter is mandatory.scrollArea
- The Rectangle inside the background-image where
scrolling should take place. This parameter is optional. If it's null
then the scroll-area is set to (0, 0, background.width,
background.height).scrollText
- The text to be scrolled.imageUrl
- The URL to the Image that will be painted at the
start of the scroll-area. This parameter is optional.versionText
- The String describing the version of the program.
It is painted centered to the scroll-rectangle at the specified height.
This parameter is optional.versionHeight
- The height at which the version-string is
supposed to be painted. This parameter is optional but should be given
a correct value if versionText!=null..java.io.IOException
- if loading the images failed.public AboutPanel()
public boolean isDebug()
public void setDebug(boolean debug)
public void setScrollText(java.lang.String scrollText)
protected void setScrollLines(java.lang.String[] scrollLines)
public void setBackgroundImage(java.net.URL imageUrl) throws java.io.IOException
AboutPanel
objectimageUrl
- the image to be used as background.java.io.IOException
- if loading of image fails.public void setBackgroundImage(java.awt.image.BufferedImage backgroundImage)
AboutPanel
objectbackgroundImage
- The new backgroundImage valuepublic void setAboutImage(java.net.URL imageUrl) throws java.io.IOException
java.io.IOException
public void setAboutImage(java.awt.image.BufferedImage aboutImage)
public void setScrollArea(java.awt.Rectangle scrollArea)
AboutPanel
objectscrollArea
- The new scrollArea valuepublic void setScrollAreaToolTipText(java.lang.String toolTipText)
toolTipText
- The new ScrollAreaToolTipText valuepublic java.lang.String getScrollAreaToolTipText()
AboutPanel
objectpublic java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
MouseEvent
is inside the scroll-area and null
otherwise.
It's needed by the ToolTipManager
.getToolTipText
in class javax.swing.JComponent
evt
- a MouseEvent
.ToolTipManager
.protected boolean handleMouseEvent(java.awt.event.MouseEvent evt)
protected void increaseScrollPosition()
setScrollPosition
, therefore causing a
repaint of the scroll-area..setScrollPosition(int)
public void setScrollPosition(int scrollPosition)
AboutPanel
object. The
value will be corrected according Minimum- and MaximumScrollPosition.
Changing the scroll-position will result in a repaint of the scroll-area.scrollPosition
- The new scrollPosition value. This value indicates
the height-offset of the scroll-area.getMinimumScrollPosition()
,
getMaximumScrollPosition()
public int getScrollPosition()
AboutPanel
objectpublic int getMinimumScrollPosition()
AboutPanel
object. It's value is the negated value of the scroll-area-height.public int getMaximumScrollPosition()
AboutPanel
object. It's value is the height needed for all lines of text plus (if
available) the height of the image with an additional empty line.public static java.awt.image.ConvolveOp getGaussianBlurFilter(int radius, boolean horizontal)
public void setFont(java.awt.Font newFont)
AboutPanel
object. Setting it
will result in the recreation of all buffers. The font can even be safely
changed while the component is visible. It will be used for the version- and
scroll-text.
If the parameter is null
then UIManager.getFont( "Label.font" )
will be used.setFont
in class javax.swing.JComponent
newFont
- The new font value.public void paintComponent(java.awt.Graphics graphics)
paintComponent
in class javax.swing.JComponent
graphics
- Graphics
-objectprotected void calculatePreferredSize()
public void addNotify()
super.addNotify()
and notifies the
scroll-thread by calling setScrolling(true)
. It also
(re)initializes the scroll-position to MinimumScrollPosition (this is always
the negative height of the scroll-rectangle) and registers tbis component at
the ToolTipManager
.addNotify
in class javax.swing.JComponent
setScrolling(boolean)
,
setScrollPosition(int)
,
getMinimumScrollPosition()
public void removeNotify()
super.removeNotify()
and sends the
scroll-thread into a wait-state by calling setScrolling(false)
. It also unregisters this component from the ToolTipManager
.removeNotify
in class javax.swing.JComponent
setScrolling(boolean)
public void setScrolling(boolean scrolling)
true
will notify the scroll-thread that it has to resume
work. A value of false
will send it into wait-state instead.scrolling
- The new scrolling valuepublic boolean isScrolling()
true
if scrolling is currently active. If
it returns false
then the scroll-thread is waiting.