com.sshtools.ui.awt
Class Toaster

java.lang.Object
  extended by com.sshtools.ui.awt.Toaster

public class Toaster
extends java.lang.Object

UI component that display toaster style messages. When a request to display a message is made, the message will appear at a specified location on the users desktop. It will stay visible for a specified amount of time. If more messages are sent in the meantime, they will appear in a new window either just above or just below the last messages.

Author:
Brett Smith <brett@3sp.com>

Field Summary
static java.awt.Color BACKGROUND_COLOR
          Default background color for new toasters
static java.awt.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 java.awt.Color FOREGROUND_COLOR
          Default foreground color for new toasters
static java.awt.Font TEXT_FONT
          Default text font for new toasters
static java.awt.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 Summary
Toaster(int position, java.awt.Dimension popupSize)
          Constructor.
 
Method Summary
 java.awt.Color getBackgroundColor()
          Get the background color
 java.awt.Color getBorderColor()
          Get the border color
 java.awt.Color getForegroundColor()
          Get the foreground color
 java.awt.Dimension getPopupSize()
          Get the size of the popups.
 int getPosition()
          Get the position of messages.
 java.awt.Font getTextFont()
          Get the text text
 java.awt.Font getTitleFont()
          Get the title font.
static void main(java.lang.String[] args)
          Test.
 void popup(java.awt.event.ActionListener callback, java.lang.String message, java.lang.String title)
          Popup a new message for 10 seconds.
 void popup(java.awt.event.ActionListener callback, java.lang.String message, java.lang.String title, java.awt.Image image)
          Popup a new message for 10 seconds with an option image.
 void popup(java.awt.event.ActionListener callback, java.lang.String message, java.lang.String title, java.awt.Image image, int timeout)
          Popup a new message.
 void setBackgroundColor(java.awt.Color backgroundColor)
          Set the background color.
 void setBorderColor(java.awt.Color borderColor)
          Set the border color.
 void setForegroundColor(java.awt.Color foregroundColor)
          Set the foreground color.
 void setPopupSize(java.awt.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(java.awt.Font textFont)
          Set the text font.
 void setTitleFont(java.awt.Font titleFont)
          Set the title font.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT
Default timeout

See Also:
Constant Field Values

BOTTOM_RIGHT

public static final int BOTTOM_RIGHT
Toaster appears at the bottom right of the screen with messages flowing up from bottom to top

See Also:
Constant Field Values

BOTTOM_LEFT

public static final int BOTTOM_LEFT
Toaster appears at the bottom left of the screen with messages flowing up from bottom to top

See Also:
Constant Field Values

TOP_LEFT

public static final int TOP_LEFT
Toaster appears at the top left of the screen with messages flowing down from top to bottom

See Also:
Constant Field Values

TOP_RIGHT

public static final int TOP_RIGHT
Toaster appears at the top right of the screen with messages flowing down from top to bottom

See Also:
Constant Field Values

BACKGROUND_COLOR

public static java.awt.Color BACKGROUND_COLOR
Default background color for new toasters


FOREGROUND_COLOR

public static java.awt.Color FOREGROUND_COLOR
Default foreground color for new toasters


BORDER_COLOR

public static java.awt.Color BORDER_COLOR
Default border color for new toasters


TEXT_FONT

public static java.awt.Font TEXT_FONT
Default text font for new toasters


TITLE_FONT

public static java.awt.Font TITLE_FONT
Default title font for new toasters

Constructor Detail

Toaster

public Toaster(int position,
               java.awt.Dimension popupSize)
Constructor.

Parameters:
position -
popupSize - popup size
See Also:
setPosition(int)
Method Detail

setTextAlign

public void setTextAlign(float textAlign)
Set the text alignment. May be one of Component.LEFT_ALIGNMENT, Component.CENTER_ALIGNMENT or Component.RIGHT_ALIGNMENT.

Parameters:
textAlign - text alignment

setPopupSize

public void setPopupSize(java.awt.Dimension popupSize)
Set the size of the popups. This will only take affect on new messages.

Parameters:
popupSize - popup size

getPopupSize

public java.awt.Dimension getPopupSize()
Get the size of the popups.

Returns:
popup size

setPosition

public void setPosition(int position)
Set the position of messages. Can be one of TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT or BOTTOM_RIGHT.

Parameters:
position - position

getPosition

public int getPosition()
Get the position of messages. Can be one of TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT or BOTTOM_RIGHT.

Returns:
position

getBackgroundColor

public java.awt.Color getBackgroundColor()
Get the background color

Returns:
background color

setBackgroundColor

public void setBackgroundColor(java.awt.Color backgroundColor)
Set the background color. This will only take affect on new messages.

Parameters:
backgroundColor - background color

getBorderColor

public java.awt.Color getBorderColor()
Get the border color

Returns:
border color

setBorderColor

public void setBorderColor(java.awt.Color borderColor)
Set the border color. This will only take affect on new messages.

Parameters:
borderColor - border color

getForegroundColor

public java.awt.Color getForegroundColor()
Get the foreground color

Returns:
foreground color

setForegroundColor

public void setForegroundColor(java.awt.Color foregroundColor)
Set the foreground color. This will only take affect on new messages.

Parameters:
foregroundColor -

getTextFont

public java.awt.Font getTextFont()
Get the text text

Returns:
text font

setTextFont

public void setTextFont(java.awt.Font textFont)
Set the text font. This will only take affect on new messages.

Parameters:
textFont - text font

getTitleFont

public java.awt.Font getTitleFont()
Get the title font. This will only take affect on new messages.

Returns:
title font

setTitleFont

public void setTitleFont(java.awt.Font titleFont)
Set the title font. This will only take affect on new messages.

Parameters:
titleFont - title font

popup

public void popup(java.awt.event.ActionListener callback,
                  java.lang.String message,
                  java.lang.String title)
Popup a new message for 10 seconds.

Parameters:
callback - invoked when message is clicked
message - message to display
title - title of message

popup

public void popup(java.awt.event.ActionListener callback,
                  java.lang.String message,
                  java.lang.String title,
                  java.awt.Image image)
Popup a new message for 10 seconds with an option image.

Parameters:
callback - invoked when message is clicked
message - message to display
title - title of message
image - image or null

popup

public void popup(java.awt.event.ActionListener callback,
                  java.lang.String message,
                  java.lang.String title,
                  java.awt.Image image,
                  int timeout)
Popup a new message.

Parameters:
callback - invoked when message is clicked
message - message to display
title - title of message
timeout - time to display message for
image - image or null

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test.

Parameters:
args -
Throws:
java.lang.Exception


Copyright © 2003-2009 SSHTOOLS LTD. All Rights Reserved.