Class LegendPainter
- java.lang.Object
-
- com.metsci.glimpse.core.painter.base.GlimpsePainterBase
-
- com.metsci.glimpse.core.painter.decoration.LegendPainter
-
- All Implemented Interfaces:
GlimpsePainter
- Direct Known Subclasses:
LegendPainter.BlockLegendPainter
,LegendPainter.LineLegendPainter
public abstract class LegendPainter extends GlimpsePainterBase
Displays a simple color based legend floating on top of the plot.- Author:
- bumgarner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LegendPainter.BlockLegendPainter
static class
LegendPainter.LegendPlacement
static class
LegendPainter.LineLegendPainter
-
Constructor Summary
Constructors Constructor Description LegendPainter(LegendPainter.LegendPlacement placement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addItem(String label, float[] rgba)
void
addItem(String label, float r, float g, float b, float a)
void
clear()
void
doDispose(GlimpseContext context)
void
doPaintTo(GlimpseContext context)
Font
getFont()
void
removeItem(String label)
void
setColor(String label, float[] rgba)
void
setColor(String label, float r, float g, float b, float a)
LegendPainter
setFont(int size, boolean bold)
LegendPainter
setFont(int size, boolean bold, boolean antialias)
LegendPainter
setFont(Font font)
LegendPainter
setFont(Font font, boolean antialias)
void
setLegendItemWidth(int width)
Sets the width of the item to the left of the label in the legend.void
setLookAndFeel(LookAndFeel laf)
Sets display options for the painter based on the provided LookAndFeel.void
setOffset(int offsetX, int offsetY)
void
setOffsetX(int offset)
void
setOffsetY(int offset)
void
setPlacement(LegendPainter.LegendPlacement placement)
void
setSpacing(int spacer)
Sets the space between elements in the legend.LegendPainter
setTextColor(float[] rgba)
void
setTextColor(float r, float g, float b, float a)
-
Methods inherited from class com.metsci.glimpse.core.painter.base.GlimpsePainterBase
dispose, getAxis1D, getAxis2D, getBounds, getGL3, isDisposed, isVisible, paintTo, requireAxis1D, requireAxis2D, setVisible
-
-
-
-
Constructor Detail
-
LegendPainter
public LegendPainter(LegendPainter.LegendPlacement placement)
-
-
Method Detail
-
setFont
public LegendPainter setFont(Font font)
-
setFont
public LegendPainter setFont(Font font, boolean antialias)
-
setFont
public LegendPainter setFont(int size, boolean bold)
-
setFont
public LegendPainter setFont(int size, boolean bold, boolean antialias)
-
getFont
public Font getFont()
-
setTextColor
public LegendPainter setTextColor(float[] rgba)
-
setTextColor
public void setTextColor(float r, float g, float b, float a)
-
addItem
public void addItem(String label, float r, float g, float b, float a)
-
addItem
public void addItem(String label, float[] rgba)
-
removeItem
public void removeItem(String label)
-
clear
public void clear()
-
setColor
public void setColor(String label, float r, float g, float b, float a)
-
setColor
public void setColor(String label, float[] rgba)
-
setPlacement
public void setPlacement(LegendPainter.LegendPlacement placement)
-
setOffsetX
public void setOffsetX(int offset)
-
setOffsetY
public void setOffsetY(int offset)
-
setOffset
public void setOffset(int offsetX, int offsetY)
-
setSpacing
public void setSpacing(int spacer)
Sets the space between elements in the legend.- Parameters:
spacer
-
-
setLegendItemWidth
public void setLegendItemWidth(int width)
Sets the width of the item to the left of the label in the legend.- Parameters:
width
-
-
doPaintTo
public void doPaintTo(GlimpseContext context)
-
setLookAndFeel
public void setLookAndFeel(LookAndFeel laf)
Description copied from interface:GlimpsePainter
Sets display options for the painter based on the provided LookAndFeel.- Specified by:
setLookAndFeel
in interfaceGlimpsePainter
- Overrides:
setLookAndFeel
in classGlimpsePainterBase
-
doDispose
public void doDispose(GlimpseContext context)
-
-