org.jdesktop.swingx.decorator
Class HighlighterFactory

java.lang.Object
  extended by org.jdesktop.swingx.decorator.HighlighterFactory

public final class HighlighterFactory
extends Object

A Factory which creates common Highlighters.

PENDING JW: really need the alternate striping? That's how the old AlternateRowHighlighter did it, but feels a bit wrong to have one stripe hardcoded to WHITE. Would prefer to remove.

Author:
Jeanette Winzenburg

Nested Class Summary
static class HighlighterFactory.UIColorHighlighter
          A ColorHighlighter with UI-dependent background.
 
Field Summary
static Color BEIGE
          predefined colors - from old alternateRow.
static Color CLASSIC_LINE_PRINTER
           
static Color FLORAL_WHITE
           
static Color GENERIC_GRAY
           
static Color LEDGER
           
static Color LINE_PRINTER
           
static Color NOTEPAD
           
static Color QUICKSILVER
           
 
Constructor Summary
HighlighterFactory()
           
 
Method Summary
static Highlighter createAlternateStriping()
          Creates and returns a Highlighter which highlights with alternate background.
static Highlighter createAlternateStriping(Color baseBackground, Color alternateBackground)
          Creates and returns a Highlighter which highlights with alternating background, starting with the base.
static Highlighter createAlternateStriping(Color baseBackground, Color alternateBackground, int linesPerStripe)
          Creates and returns a Highlighter which highlights with alternating background, starting with the base.
static Highlighter createAlternateStriping(int rowsPerGroup)
          Creates and returns a Highlighter which highlights with alternate background.
static Highlighter createComputedForegroundHighlighter()
          Creates a highlighter that sets the foreground color to WHITE or BLACK by computing the best match based on the current background color.
static Highlighter createSimpleStriping()
          Creates and returns a Highlighter which highlights every second row background with a color depending on the LookAndFeel.
static Highlighter createSimpleStriping(Color stripeBackground)
          Creates and returns a Highlighter which highlights every second row background with the given color.
static Highlighter createSimpleStriping(Color stripeBackground, int rowsPerGroup)
          Creates and returns a Highlighter which highlights every second row group background with the given color.
static Highlighter createSimpleStriping(int rowsPerGroup)
          Creates and returns a Highlighter which highlights every second row group background with a color depending on LF.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEIGE

public static final Color BEIGE
predefined colors - from old alternateRow.


LINE_PRINTER

public static final Color LINE_PRINTER

CLASSIC_LINE_PRINTER

public static final Color CLASSIC_LINE_PRINTER

FLORAL_WHITE

public static final Color FLORAL_WHITE

QUICKSILVER

public static final Color QUICKSILVER

GENERIC_GRAY

public static final Color GENERIC_GRAY

LEDGER

public static final Color LEDGER

NOTEPAD

public static final Color NOTEPAD
Constructor Detail

HighlighterFactory

public HighlighterFactory()
Method Detail

createComputedForegroundHighlighter

public static Highlighter createComputedForegroundHighlighter()
Creates a highlighter that sets the foreground color to WHITE or BLACK by computing the best match based on the current background color. It is recommended that no background changing highlighters be added after this highlighter, lest the computation be incorrect.

Returns:
a highlighter that computes the appropriate foreground color

createSimpleStriping

public static Highlighter createSimpleStriping()
Creates and returns a Highlighter which highlights every second row background with a color depending on the LookAndFeel. The rows between are not highlighted, that is typically, they will show the container's background.

Returns:
a Highlighter striping every second row background.

createSimpleStriping

public static Highlighter createSimpleStriping(int rowsPerGroup)
Creates and returns a Highlighter which highlights every second row group background with a color depending on LF. The row groups between are not highlighted, that is typically, they will show the container's background.

Parameters:
rowsPerGroup - the number of rows in a group
Returns:
a Highlighter striping every second row group background.

createSimpleStriping

public static Highlighter createSimpleStriping(Color stripeBackground)
Creates and returns a Highlighter which highlights every second row background with the given color. The rows between are not highlighted that is typically, they will show the container's background.

Parameters:
stripeBackground - the background color for the striping.
Returns:
a Highlighter striping every second row background.

createSimpleStriping

public static Highlighter createSimpleStriping(Color stripeBackground,
                                               int rowsPerGroup)
Creates and returns a Highlighter which highlights every second row group background with the given color. The row groups between are not highlighted, that is they typically will show the container's background.

Parameters:
stripeBackground - the background color for the striping.
rowsPerGroup - the number of rows in a group
Returns:
a Highlighter striping every second row group background.

createAlternateStriping

public static Highlighter createAlternateStriping()
Creates and returns a Highlighter which highlights with alternate background. The first is Color.WHITE, the second with the color depending on LF.

Returns:
a Highlighter striping every second row background.

createAlternateStriping

public static Highlighter createAlternateStriping(int rowsPerGroup)
Creates and returns a Highlighter which highlights with alternate background. the first Color.WHITE, the second with the color depending on LF.

Parameters:
rowsPerGroup - the number of rows in a group
Returns:
a Highlighter striping every second row group background.

createAlternateStriping

public static Highlighter createAlternateStriping(Color baseBackground,
                                                  Color alternateBackground)
Creates and returns a Highlighter which highlights with alternating background, starting with the base.

Parameters:
baseBackground - the background color for the even rows.
alternateBackground - background color for odd rows.
Returns:
a Highlighter striping alternating background.

createAlternateStriping

public static Highlighter createAlternateStriping(Color baseBackground,
                                                  Color alternateBackground,
                                                  int linesPerStripe)
Creates and returns a Highlighter which highlights with alternating background, starting with the base.

Parameters:
baseBackground - the background color for the even rows.
alternateBackground - background color for odd rows.
linesPerStripe - the number of rows in a group
Returns:
a Highlighter striping every second row group background.


Copyright © 2012. All Rights Reserved.