org.openide.io 1.23.1

org.openide.windows
Class IOColorPrint

java.lang.Object
  extended by org.openide.windows.IOColorPrint

public abstract class IOColorPrint
extends Object

Text printing with custom color.

Client usage:

  InputOutput io = ...;
  OutputListener l = ...;
  OutputListener l2 = ...;
  IOColorPrint.print(io, "Green text", Color.GREEN);
  IOColorPrint.print(io, " orange hyperlink ", l, false, Color.ORANGE);
  IOColorPrint.print(io, " green hyperlink\n", l2, false, Color.GREEN);
 
How to support IOColorPrint in own IOProvider implementation:

Since:
1.18
See Also:
IOColors, IOColorLines

Constructor Summary
IOColorPrint()
           
 
Method Summary
static boolean isSupported(InputOutput io)
          Checks whether this feature is supported for provided IO
protected abstract  void print(CharSequence text, OutputListener listener, boolean important, Color color)
          Prints text with selected color and optionaly add listener for it
static void print(InputOutput io, CharSequence text, Color color)
          Prints text with selected color
static void print(InputOutput io, CharSequence text, OutputListener listener, boolean important, Color color)
          Prints text with selected color and add listener for it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOColorPrint

public IOColorPrint()
Method Detail

print

public static void print(InputOutput io,
                         CharSequence text,
                         Color color)
                  throws IOException
Prints text with selected color

Parameters:
io - IO to print to
text - a string to print to the tab
color - a color for the text (null allowed). If null is passed default color (see IOColors) is used.
Throws:
IOException

print

public static void print(InputOutput io,
                         CharSequence text,
                         OutputListener listener,
                         boolean important,
                         Color color)
                  throws IOException
Prints text with selected color and add listener for it

Parameters:
io - IO to print to
text - a string to print to the tab
listener - a listener that will receive events about this text (null allowed)
important - important mark the line as important. Makes the UI respond appropriately, eg. stop the automatic scrolling or highlight the hyperlink.
color - a color for the text (null allowed). If null is passed default color (see IOColors) is used.
Throws:
IOException

isSupported

public static boolean isSupported(InputOutput io)
Checks whether this feature is supported for provided IO

Parameters:
io - IO to check on
Returns:
true if supported

print

protected abstract void print(CharSequence text,
                              OutputListener listener,
                              boolean important,
                              Color color)
                       throws IOException
Prints text with selected color and optionaly add listener for it

Parameters:
text - a string to print to the tab
listener - a listener that will receive events about this text (null allowed)
important - important mark the line as important. Makes the UI respond appropriately, eg. stop the automatic scrolling or highlight the hyperlink.
color - a color for the text (null allowed). If null is passed default color (see IOColors) is used.
Throws:
IOException

org.openide.io 1.23.1

Built on September 19 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.