public abstract class IOColorPrint extends Object
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:
InputOutput
provided by IOProvider
has to implement Lookup.Provider
IOColorPrint
and implement its abstract methods
IOColorPrint
to Lookup
provided by InputOutput
IOColors
,
IOColorLines
Constructor and Description |
---|
IOColorPrint() |
Modifier and Type | Method and Description |
---|---|
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
|
public static void print(InputOutput io, CharSequence text, Color color) throws IOException
io
- IO to print totext
- a string to print to the tabcolor
- a color for the text (null allowed). If null is passed default color (see IOColors
) is used.IOException
public static void print(InputOutput io, CharSequence text, OutputListener listener, boolean important, Color color) throws IOException
io
- IO to print totext
- a string to print to the tablistener
- 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.IOException
public static boolean isSupported(InputOutput io)
io
- IO to check onprotected abstract void print(CharSequence text, OutputListener listener, boolean important, Color color) throws IOException
text
- a string to print to the tablistener
- 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.IOException