|
|||||||||
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
com.l2fprod.common.swing.JTipOfTheDay
public class JTipOfTheDay
Provides the "Tip of The Day" pane and dialog.
Tips are retrieved from the TipModel
. In
the most common usage, a tip (as returned by
TipModel.Tip.getTip()
) is just a
String
. However, the return type of this method is actually
Object
. Its interpretation depends on its type:
Component
is displayed in the dialog.
Icon
is wrapped in a JLabel
and
displayed in the dialog.
String
by calling its
toString
method. The result is wrapped in a
JEditorPane
or JTextArea
and displayed.
Nested Class Summary | |
---|---|
static interface |
JTipOfTheDay.ShowOnStartupChoice
Used in conjunction with the showDialog(Component, ShowOnStartupChoice) to save the
"Show tips on startup" choice. |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static java.lang.String |
CURRENT_TIP_CHANGED_KEY
Used when generating PropertyChangeEvents for the "currentTip" property |
static java.lang.String |
PREFERENCE_KEY
Key used to store the status of the "Show tip on startup" checkbox" |
static java.lang.String |
uiClassID
|
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 java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JTipOfTheDay()
|
|
JTipOfTheDay(TipModel model)
|
Method Summary | |
---|---|
protected javax.swing.JDialog |
createDialog(java.awt.Component parentComponent,
JTipOfTheDay.ShowOnStartupChoice choice)
Calls TipOfTheDayUI.createDialog(Component, JTipOfTheDay.ShowOnStartupChoice) |
static void |
forceShowOnStartup(java.util.prefs.Preferences showOnStartupPref)
Removes the value set for "ShowTipOnStartup" in the given Preferences to ensure the dialog shown by a later call to showDialog(Component, Preferences) will be visible to the user. |
int |
getCurrentTip()
|
TipModel |
getModel()
|
TipOfTheDayUI |
getUI()
Gets the UI object which implements the L&F for this component. |
java.lang.String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
static boolean |
isShowingOnStartup(java.util.prefs.Preferences showOnStartupPref)
|
void |
nextTip()
Shows the next tip in the list. |
void |
previousTip()
Shows the previous tip in the list. |
void |
setCurrentTip(int currentTip)
Sets the index of the tip to show |
void |
setModel(TipModel model)
|
void |
setUI(TipOfTheDayUI ui)
Sets the L&F object that renders this component. |
void |
showDialog(java.awt.Component parentComponent)
Pops up a "Tip of the day" dialog. |
boolean |
showDialog(java.awt.Component parentComponent,
JTipOfTheDay.ShowOnStartupChoice choice)
Pops up a "Tip of the day" dialog. |
boolean |
showDialog(java.awt.Component parentComponent,
JTipOfTheDay.ShowOnStartupChoice choice,
boolean force)
Pops up a "Tip of the day" dialog. |
boolean |
showDialog(java.awt.Component parentComponent,
java.util.prefs.Preferences showOnStartupPref)
Pops up a "Tip of the day" dialog. |
boolean |
showDialog(java.awt.Component parentComponent,
java.util.prefs.Preferences showOnStartupPref,
boolean force)
Pops up a "Tip of the day" dialog. |
void |
updateUI()
Notification from the UIManager that the L&F has changed. |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
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 |
Methods inherited from class java.awt.Component |
---|
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, 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, hide, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String uiClassID
public static final java.lang.String PREFERENCE_KEY
public static final java.lang.String CURRENT_TIP_CHANGED_KEY
Constructor Detail |
---|
public JTipOfTheDay()
public JTipOfTheDay(TipModel model)
Method Detail |
---|
public void updateUI()
UIManager
that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager
.
updateUI
in class javax.swing.JComponent
JComponent.updateUI()
public void setUI(TipOfTheDayUI ui)
ui
- the TipOfTheDayUI
L&F objectUIDefaults.getUI(javax.swing.JComponent)
public TipOfTheDayUI getUI()
public java.lang.String getUIClassID()
getUIClassID
in class javax.swing.JComponent
uiClassID
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public TipModel getModel()
public void setModel(TipModel model)
public int getCurrentTip()
public void setCurrentTip(int currentTip)
currentTip
- public void nextTip()
public void previousTip()
public void showDialog(java.awt.Component parentComponent) throws java.awt.HeadlessException
parentComponent
-
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.GraphicsEnvironment.isHeadless()
public boolean showDialog(java.awt.Component parentComponent, java.util.prefs.Preferences showOnStartupPref) throws java.awt.HeadlessException
parentComponent
- showOnStartupPref
-
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.
java.lang.IllegalArgumentException
- if showOnStartupPref is nullGraphicsEnvironment.isHeadless()
public boolean showDialog(java.awt.Component parentComponent, java.util.prefs.Preferences showOnStartupPref, boolean force) throws java.awt.HeadlessException
parentComponent
- showOnStartupPref
- force
- if true, the dialog is displayed even if the Preferences is set to
hide the dialog
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.
java.lang.IllegalArgumentException
- if showOnStartupPref is nullGraphicsEnvironment.isHeadless()
public boolean showDialog(java.awt.Component parentComponent, JTipOfTheDay.ShowOnStartupChoice choice)
choice
is not null, the method first checks if
JTipOfTheDay.ShowOnStartupChoice.isShowingOnStartup()
is true before showing the
dialog.
Additionally, it saves the state of the "Show tips on startup" checkbox
using the given JTipOfTheDay.ShowOnStartupChoice
object.
parentComponent
- choice
-
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.GraphicsEnvironment.isHeadless()
public boolean showDialog(java.awt.Component parentComponent, JTipOfTheDay.ShowOnStartupChoice choice, boolean force)
choice
is not null, the method first checks if
force
is true or if
JTipOfTheDay.ShowOnStartupChoice.isShowingOnStartup()
is true before showing the
dialog.
Additionally, it saves the state of the "Show tips on startup" checkbox
using the given JTipOfTheDay.ShowOnStartupChoice
object.
parentComponent
- choice
- force
- if true, the dialog is displayed even if
JTipOfTheDay.ShowOnStartupChoice.isShowingOnStartup()
is false
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.GraphicsEnvironment.isHeadless()
public static boolean isShowingOnStartup(java.util.prefs.Preferences showOnStartupPref)
showOnStartupPref
-
public static void forceShowOnStartup(java.util.prefs.Preferences showOnStartupPref)
showDialog(Component, Preferences)
will be visible to the user.
showOnStartupPref
- protected javax.swing.JDialog createDialog(java.awt.Component parentComponent, JTipOfTheDay.ShowOnStartupChoice choice)
TipOfTheDayUI.createDialog(Component, JTipOfTheDay.ShowOnStartupChoice)
parentComponent
- choice
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |