public class Toaster extends Object
| Modifier and Type | Field and Description |
|---|---|
static Color |
BACKGROUND_COLOR
Default background color for new toasters
|
static Color |
BORDER_COLOR
Default border color for new toasters
|
static int |
BOTTOM_LEFT
Toaster appears at the bottom left of the screen with messages flowing up
from bottom to top
|
static int |
BOTTOM_RIGHT
Toaster appears at the bottom right of the screen with messages flowing
up from bottom to top
|
static int |
DEFAULT_TIMEOUT
Default timeout
|
static Color |
FOREGROUND_COLOR
Default foreground color for new toasters
|
static Font |
TEXT_FONT
Default text font for new toasters
|
static Font |
TITLE_FONT
Default title font for new toasters
|
static int |
TOP_LEFT
Toaster appears at the top left of the screen with messages flowing down
from top to bottom
|
static int |
TOP_RIGHT
Toaster appears at the top right of the screen with messages flowing down
from top to bottom
|
| Constructor and Description |
|---|
Toaster(int position,
Dimension popupSize)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Color |
getBackgroundColor()
Get the background color
|
Color |
getBorderColor()
Get the border color
|
Color |
getForegroundColor()
Get the foreground color
|
Dimension |
getPopupSize()
Get the size of the popups.
|
int |
getPosition()
Get the position of messages.
|
static JFrame |
getSharedFrame() |
Font |
getTextFont()
Get the text text
|
Font |
getTitleFont()
Get the title font.
|
void |
popup(ActionListener callback,
String message,
String title)
Popup a new message for 10 seconds.
|
void |
popup(ActionListener callback,
String message,
String title,
Image image)
Popup a new message for 10 seconds with an option image.
|
void |
popup(ActionListener callback,
String message,
String title,
Image image,
int timeout)
Popup a new message.
|
void |
setBackgroundColor(Color backgroundColor)
Set the background color.
|
void |
setBorderColor(Color borderColor)
Set the border color.
|
void |
setForegroundColor(Color foregroundColor)
Set the foreground color.
|
void |
setPopupSize(Dimension popupSize)
Set the size of the popups.
|
void |
setPosition(int position)
Set the position of messages.
|
void |
setTextAlign(float textAlign)
Set the text alignment.
|
void |
setTextFont(Font textFont)
Set the text font.
|
void |
setTitleFont(Font titleFont)
Set the title font.
|
public static final int DEFAULT_TIMEOUT
public static final int BOTTOM_RIGHT
public static final int BOTTOM_LEFT
public static final int TOP_LEFT
public static final int TOP_RIGHT
public static Color BACKGROUND_COLOR
public static Color FOREGROUND_COLOR
public static Color BORDER_COLOR
public static Font TEXT_FONT
public static Font TITLE_FONT
public Toaster(int position,
Dimension popupSize)
position - popupSize - popup sizesetPosition(int)public void setTextAlign(float textAlign)
Component.LEFT_ALIGNMENT,
Component.CENTER_ALIGNMENT or
Component.RIGHT_ALIGNMENT.textAlign - text alignmentpublic void setPopupSize(Dimension popupSize)
popupSize - popup sizepublic Dimension getPopupSize()
public void setPosition(int position)
position - positionpublic int getPosition()
public Color getBackgroundColor()
public void setBackgroundColor(Color backgroundColor)
backgroundColor - background colorpublic Color getBorderColor()
public void setBorderColor(Color borderColor)
borderColor - border colorpublic Color getForegroundColor()
public void setForegroundColor(Color foregroundColor)
foregroundColor - public Font getTextFont()
public void setTextFont(Font textFont)
textFont - text fontpublic Font getTitleFont()
public void setTitleFont(Font titleFont)
titleFont - title fontpublic void popup(ActionListener callback, String message, String title)
callback - invoked when message is clickedmessage - message to displaytitle - title of messagepublic void popup(ActionListener callback, String message, String title, Image image)
callback - invoked when message is clickedmessage - message to displaytitle - title of messageimage - image or nullpublic void popup(ActionListener callback, String message, String title, Image image, int timeout)
callback - invoked when message is clickedmessage - message to displaytitle - title of messagetimeout - time to display message forimage - image or nullpublic static JFrame getSharedFrame()
Copyright © 2021. All rights reserved.