Package megamek.common.util
Class TipOfTheDay
java.lang.Object
megamek.common.util.TipOfTheDay
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionTipOfTheDay(String title, String bundleName, Component referenceComponent) Constructor for TipOfTheDay -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawTipOfTheDay(Graphics2D graphics2D, Rectangle referenceBounds, TipOfTheDay.Position position) Deprecated, for removal: This API element is subject to removal in a future version.voiddrawTipOfTheDay(Graphics2D graphics2D, Rectangle referenceBounds, TipOfTheDay.Position position, boolean useRadialGradient) Draws the Tip of the Day text with word wrap and styling.floatDeprecated, for removal: This API element is subject to removal in a future version.Gets a random tip from the listDeprecated, for removal: This API element is subject to removal in a future version.booleanReturns whether the tip is currently visiblevoidsetVisible(boolean visible) Sets the visibility of the tipvoidStarts the tip cycling animationvoidStops the tip cycling animationvoidupdateScaleFactor(Component referenceComponent) Updates the scale factor and adjusts the font sizes accordingly.
-
Constructor Details
-
TipOfTheDay
Constructor for TipOfTheDay- Parameters:
bundleName- The name of the resource bundle containing the tipsreferenceComponent- A component to determine scaling
-
-
Method Details
-
startCycling
public void startCycling()Starts the tip cycling animation -
stopCycling
public void stopCycling()Stops the tip cycling animation -
getCurrentAlpha
Deprecated, for removal: This API element is subject to removal in a future version.Returns the current alpha value for fade animations -
isVisible
public boolean isVisible()Returns whether the tip is currently visible -
setVisible
public void setVisible(boolean visible) Sets the visibility of the tip -
updateScaleFactor
Updates the scale factor and adjusts the font sizes accordingly.- Parameters:
referenceComponent- A component to determine scaling
-
getTodaysTip
Deprecated, for removal: This API element is subject to removal in a future version.Gets the tip for today based on the current date- Returns:
- A tip string for today
-
getRandomTip
Gets a random tip from the list- Returns:
- A random tip string
-
drawTipOfTheDay
@Deprecated(since="0.51.0", forRemoval=true) public void drawTipOfTheDay(Graphics2D graphics2D, Rectangle referenceBounds, TipOfTheDay.Position position) Deprecated, for removal: This API element is subject to removal in a future version.Draws the Tip of the Day text with word wrap and styling.- Parameters:
graphics2D- The Graphics2D object to draw onreferenceBounds- The bounds of the reference componentposition- The position of the tip (BOTTOM_BORDER, etc.)
-
drawTipOfTheDay
public void drawTipOfTheDay(Graphics2D graphics2D, Rectangle referenceBounds, TipOfTheDay.Position position, boolean useRadialGradient) Draws the Tip of the Day text with word wrap and styling.- Parameters:
graphics2D- The Graphics2D object to draw onreferenceBounds- The bounds of the reference componentposition- The position of the tip (BOTTOM_BORDER, etc.)useRadialGradient- Whether to use a radial gradient for the background (only for corners)
-