|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJLogView_.datastructs.LGLegend
public class LGLegend
LGLegend is a class representing the data structure of a graph legend. It contains one entry for each plot of the graph. Each entry reflet the colour, linestyle and symbol being used (or not) from the overall settings.
Constructor Summary | |
---|---|
LGLegend(int nitems)
This is the constructor LGLegend. |
Method Summary | |
---|---|
void |
addLegendItem(java.lang.String text)
This method appends a new entry to the list of existing items in the legend. |
void |
addLegendItem(java.lang.String text,
java.awt.Color col,
java.awt.BasicStroke str,
int symb,
int symbsize)
This method appends a new entry to the list of existing items in the legend. |
int |
countItems()
This method returns the current number of item of the legend |
void |
draw(java.awt.Graphics2D g,
boolean useColours,
boolean useLineStyles,
boolean useSymbols)
This methods draws the legend on the given graphic context. |
java.awt.Font |
getFont()
This method returns the font details (font face,style and size) being used to write the legend entries. |
java.lang.String |
getItemName(int index)
Given an index, this method return the corresponding legend item name. |
int[] |
getPosition()
This method returns the position of the legend on the canvas. |
java.awt.Dimension |
getSize()
This method returns size of the legend in pixels. |
void |
setFont(java.awt.Font f)
This method sets the font details (font face,style and size) being used to write the legend entries. |
void |
setInitialPosition(int x,
int y,
int width,
int height)
This method sets the initial position. |
void |
setItemName(int index,
java.lang.String name)
This method sets the item name of the item situated at the given index. |
void |
setPosition(int x,
int y)
This method sets the position of the legend on the canvas. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LGLegend(int nitems)
nitems
- the number of items in the legendMethod Detail |
---|
public int countItems()
public java.lang.String getItemName(int index)
index
- the item index (starting from 0)
String
public void setItemName(int index, java.lang.String name)
index
- the item index (starting from 0)name
- a String representing the item nameString
public void addLegendItem(java.lang.String text)
text
- a String representing the item nameString
public void addLegendItem(java.lang.String text, java.awt.Color col, java.awt.BasicStroke str, int symb, int symbsize)
text
- a String representing the item namecol
- a Color object specifying the colour to use for this itemstr
- a BasicStroke object specifying the linestyle to use for this itemsymb
- a integer (value between 0 and 7) specifying the symbol to use for this itemsymbsize
- an integer giving the size in pixels for the symbol used.String
,
Color
,
BasicStroke
public void setPosition(int x, int y)
x
- the x coordinate in pixelsy
- the y coordinate in pixelspublic void setInitialPosition(int x, int y, int width, int height)
x
- the x coordinate in pixelsy
- the y coordinate in pixelswidth
- the width of the canvas in pixelsheight
- the height of the canvas pixelspublic int[] getPosition()
public java.awt.Dimension getSize()
Dimension
public java.awt.Font getFont()
Font
public void setFont(java.awt.Font f)
f
- a Font object containing the font information (face+style+size)Font
public void draw(java.awt.Graphics2D g, boolean useColours, boolean useLineStyles, boolean useSymbols)
g
- the graphic context we will draw the annotation onuseColours
- a boolean, true -> use colours, false -> use blackuseLineStyles
- a boolean, true -> use line styles, false -> use plain lineuseSymbols
- a boolean, true -> use symbols, false -> use only discsGraphics2D
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |