Package com.jbstrap.ui
Class LiveFavicon
java.lang.Object
com.jbstrap.ui.LiveFavicon
Live Favicon
With this class, we can give additional information to the user. This information is put inside a bubble, that appears on the application's icon (favicon) For example, this could be used to inform the user if there's a new message, or inform them about the amount of unread messages, etc.
- Since:
- 4.0
- Author:
- JBStrap
-
Constructor Summary
ConstructorDescriptionLiveFavicon
(String iconText) Creates a favicon bubble with the specified text contentLiveFavicon
(String iconText, String backgroundColor) Creates a bubble on the icon, with the specified text and background colorLiveFavicon
(String iconText, String textColor, Integer width, Integer height, String backgroundColor) Creates a bubble on the icon, with the specified parameters -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw()
final String
Gets the bubble background colorfinal int
Gets the bubble heightfinal String
Gets the bubble text.final String
Gets the bubble text colorfinal int
getWidth()
Gets the bubble widthfinal void
redraw()
Redraws the bubblefinal void
setBackgroundColor
(String backgroundColor) Sets the bubble background colorfinal void
setCurrentUi
(UI ui) final void
Sets the bubble heightfinal void
setIconText
(String iconText) Sets the bubble textfinal void
setTextColor
(String color) Sets the bubble text colorfinal void
Sets the bubble width
-
Constructor Details
-
LiveFavicon
Creates a favicon bubble with the specified text content- Parameters:
iconText
- The text that will be in the bubble
-
LiveFavicon
Creates a bubble on the icon, with the specified text and background color- Parameters:
iconText
- The text that will be in the bubblebackgroundColor
- The background color of the bubble. Can be specified using the #RRGGBB format. If specified asnull
the default color will be red (#ff0000).
-
LiveFavicon
public LiveFavicon(String iconText, String textColor, Integer width, Integer height, String backgroundColor) Creates a bubble on the icon, with the specified parameters- Parameters:
iconText
- The text that will be in the bubbletextColor
- The text color. If specified asnull
, the color will be #fff.width
- The width in pixels. If specified asnull
it will be 7px.height
- The height in pixels. If specified asnull
it will be 9px.backgroundColor
- The background color of the bubble. Can be specified using the #RRGGBB format. If specified asnull
the default color will be red (#ff0000).
-
-
Method Details
-
getIconText
Gets the bubble text.- Returns:
- The bubble text
-
setIconText
Sets the bubble text- Parameters:
iconText
- The text that will be in the bubble
-
getTextColor
Gets the bubble text color- Returns:
- The bubble text color
-
setTextColor
Sets the bubble text color- Parameters:
color
- The text color. If specified asnull
, the color will be #fff.
-
getWidth
public final int getWidth()Gets the bubble width- Returns:
- The bubble width in pixels
-
setWidth
Sets the bubble width- Parameters:
width
- The width in pixels. If specified asnull
it will be 7px.
-
getHeight
public final int getHeight()Gets the bubble height- Returns:
- The bubble height in pixels
-
setHeight
Sets the bubble height- Parameters:
height
- The height in pixels. If specified asnull
it will be 9px.
-
getBackgroundColor
Gets the bubble background color- Returns:
- The bubble background color
-
setBackgroundColor
Sets the bubble background color- Parameters:
backgroundColor
- The background color of the bubble. Can be specified using the #RRGGBB format. If specified asnull
the default color will be red (#ff0000).
-
setCurrentUi
- Parameters:
ui
- The UI instance where the bubble will appear
-
redraw
public final void redraw()Redraws the bubble -
draw
public void draw()
-