org.beanizer.jxosd
Class JXosd

java.lang.Object
  extended byorg.beanizer.jxosd.JXosd

public class JXosd
extends java.lang.Object

Class to create an On Screen Display.

This class is a Java binding of the useful native XOSD library (http://www.ignavus.net/software.html).
As XOSD author explains:
"XOSD displays text on your screen, sounds simple right? The difference is it is unmanaged and shaped, so it appears transparent. This gives the effect of an On Screen Display, like your TV/VCR etc.".

Typical Usage:
    libxosd.so and libjxosd.so must be in java.library.path or LD_LIBRARY_PATH.

    A simple example

    JXosd x = new JXosd(2); // creates 2 lines display
    x.setPosition(JXosd.TOP); // vertical position
    x.setTimeout(5); // 5 seconds of display time
    x.setColor("MediumSpringGreen"); // see following notices
    x.setFont("-misc-fixed-bold-r-normal--15-*-*-*-c-*-*-*"); // see following notices
    x.setShadowOffset(1); // shadow offset in pixels
    x.setShadowColor("gray"); // shadow color
    x.showText(0, "This is a test string........"); // text to show on line 0
    x.waitUntilNoDisplay(); // wait
    x.destroy(); // finalize


    You can also use showPercentage or showSlider.

 NOTICE ABOUT COLOURS:
    Colours string are those you can find in the rgb.txt file in your X11 distribution

 NOTICE ABOUT FONTS:
    Use xfontsel or xlsfont to get a list of fonts


Field Summary
static int BOTTOM
           
static int CENTER
           
static int FAILURE
           
static int HIDDEN
           
static int LEFT
           
static int MIDDLE
           
static int RIGHT
           
static int SHOWN
           
static int SUCCESS
           
static int TOP
           
 
Constructor Summary
JXosd(int lines)
          Constructor for the JXosd object
 
Method Summary
 int destroy()
          Destroys the native object
 int getNumberLines()
          Gets the number of lines of the display
 int hide()
          Hides the display
 int isOnScreen()
          Gets the onScreen status of the display
 int scroll(int lines)
          Scrolls th display a given number of lines
 int setAlign(int pos)
          Sets the horizontal alignment of the display
 void setBarLength(int length)
          Sets the bar length(for percentage or slider)
 int setColor(java.lang.String color)
          Sets the foreground color
 int setFont(java.lang.String font)
          Sets the font
 int setHorizontalOffset(int offset)
          Sets the horizontal offset
 int setOutlineColor(java.lang.String color)
          Sets the outline color
 int setOutlineOffset(int offset)
          Sets the outline offset
 int setPosition(int pos)
          Sets the vertical position of the display
 int setShadowColor(java.lang.String color)
          Sets the shadow color
 int setShadowOffset(int offset)
          Sets the shadow offset
 void setTimeout(int timeout)
          Sets the nymber of seconds before the display is hidden
 int setVerticalOffset(int offset)
          Sets the vertical offset
 int show()
          Makes the display visible.
 int showPercentage(int line, int value)
          Description of the Method
 int showSlider(int line, int value)
          Description of the Method
 int showText(int line, java.lang.String text)
          Show given text
 int waitUntilNoDisplay()
          Waits until display is empty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

FAILURE

public static final int FAILURE
See Also:
Constant Field Values

HIDDEN

public static final int HIDDEN
See Also:
Constant Field Values

SHOWN

public static final int SHOWN
See Also:
Constant Field Values

TOP

public static final int TOP
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

MIDDLE

public static final int MIDDLE
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

JXosd

public JXosd(int lines)
Constructor for the JXosd object

Parameters:
lines - Number of lines for the display
Method Detail

destroy

public int destroy()
Destroys the native object

Returns:
SUCCESS or FAILURE

show

public int show()
Makes the display visible.

Returns:
SUCCESS or FAILURE

hide

public int hide()
Hides the display

Returns:
SUCCESS or FAILURE

getNumberLines

public int getNumberLines()
Gets the number of lines of the display

Returns:
The number of lines of the display

isOnScreen

public int isOnScreen()
Gets the onScreen status of the display

Returns:
SHOWN, HIDDEN or FAILURE

waitUntilNoDisplay

public int waitUntilNoDisplay()
Waits until display is empty

Returns:
SUCCESS or FAILURE

setTimeout

public void setTimeout(int timeout)
Sets the nymber of seconds before the display is hidden

Parameters:
timeout - number of seconds

setPosition

public int setPosition(int pos)
Sets the vertical position of the display

Parameters:
pos - TOP, BOTTOM, MIDDLE
Returns:
SUCCESS or FAILURE

setAlign

public int setAlign(int pos)
Sets the horizontal alignment of the display

Parameters:
pos - LEFT, CENTER or RIGHT
Returns:
SUCCESS or FAILURE

setBarLength

public void setBarLength(int length)
Sets the bar length(for percentage or slider)

Parameters:
length - length in pixels

setColor

public int setColor(java.lang.String color)
Sets the foreground color

Parameters:
color - The new color
Returns:
SUCCESS or FAILURE

setFont

public int setFont(java.lang.String font)
Sets the font

Parameters:
font - The new font
Returns:
SUCCESS or FAILURE

setOutlineColor

public int setOutlineColor(java.lang.String color)
Sets the outline color

Parameters:
color - The new outline color
Returns:
SUCCESS or FAILURE

setOutlineOffset

public int setOutlineOffset(int offset)
Sets the outline offset

Parameters:
offset - The new outline offset
Returns:
SUCCESS or FAILURE

setShadowColor

public int setShadowColor(java.lang.String color)
Sets the shadow color

Parameters:
color - The new shadow color
Returns:
SUCCESS or FAILURE

setShadowOffset

public int setShadowOffset(int offset)
Sets the shadow offset

Parameters:
offset - The new shadow offset
Returns:
SUCCESS or FAILURE

setHorizontalOffset

public int setHorizontalOffset(int offset)
Sets the horizontal offset

Parameters:
offset - The new horizontal offset value
Returns:
SUCCESS or FAILURE

setVerticalOffset

public int setVerticalOffset(int offset)
Sets the vertical offset

Parameters:
offset - The new vertical offset
Returns:
SUCCESS or FAILURE

showText

public int showText(int line,
                    java.lang.String text)
Show given text

Parameters:
line - Line of the display where to show text
text - Text string
Returns:
SUCCESS or FAILURE

showPercentage

public int showPercentage(int line,
                          int value)
Description of the Method

Parameters:
line - Line of the display where to show the percentage bar
value - Value to show
Returns:
SUCCESS or FAILURE

showSlider

public int showSlider(int line,
                      int value)
Description of the Method

Parameters:
line - Line of the display where to show the slider
value - Value to show
Returns:
SUCCESS or FAILURE

scroll

public int scroll(int lines)
Scrolls th display a given number of lines

Parameters:
lines - Bunber of lines to scroll
Returns:
SUCCESS or FAILURE