WebCab JGraph v2.0

## com.webcab.beans.newchart
Class Pie

    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Canvas
                  |
                  +--com.webcab.beans.newchart.Pie

All Implemented Interfaces:
  Accessible, ActionListener, ComponentListener, EventListener, ImageObserver, MenuContainer, MouseListener, MouseMotionListener, Serializable

public class Pie
extends Canvas
implements Serializable, MouseListener, ComponentListener, MouseMotionListener, ActionListener

Author:
  WebCab Components
See Also:
  Serialized Form

Field Summary
`static int` `ASCENDING_LABELS` This value indicates that the components will be sorted ascending acording to their labels.
`static int` `ASCENDING_VALUES` This value indicates that the components will be sorted ascending acording to their values.
`static int` `BOTTOM_CENTER` This value indicates that the background image is centered to the lower line.
`static int` `BOTTOM_LEFT` This value indicates that the background image is aligned to the lower left corner.
`static int` `BOTTOM_RIGHT` This value indicates that the background image is aligned to the lower right corner.
`static int` `DESCENDING_LABELS` This value indicates that the components will be sorted descending acording to their labels.
`static int` `DESCENDING_VALUES` This value indicates that the components will be sorted descending acording to their values.
`static int` `INVERTED_ORIGINAL` This value indicates that the components will be in the inverted original order.
`static int` `MIDDLE_CENTER` This value indicates that the background image is centered on the middle line.
`static int` `MIDDLE_LEFT` This value indicates that the background image is aligned to the left end of the middle line.
`static int` `MIDDLE_RIGHT` This value indicates that the background image is aligned to the right end of the middle line.
`static int` `ORIGINAL_ORDER` This value indicates that the components will return to the original order maintaining custom colors.
`static int` `PIE_CHART` Ease-of-use constant for setType.
`static int` `PIE_CHART_3D` Ease-of-use constant for setType.
`static int` `RESET` This value indicates that the components will return to the original order and colors.
`static int` `STRECHED` This value indicates that the background image is streched.
`static int` `TILED` This value indicates that the background image is tiled.
`static int` `TOP_CENTER` This value indicates that the background image is centered on the upper line.
`static int` `TOP_LEFT` This value indicates that the background image is aligned to the upper left corner.
`static int` `TOP_RIGHT` This value indicates that the background image is aligned to the upper right corner.
`static int` `TORUS_CHART` Ease-of-use constant for setType.

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`Pie()` This is the non-zero constructor required by the java.beans.Bean class in order to instantiate the bean.

Method Summary
`void` `actionPerformed(ActionEvent e)`
`void` `componentHidden(ComponentEvent e)`
`void` `componentMoved(ComponentEvent e)`
`void` `componentResized(ComponentEvent e)`
`void` `componentShown(ComponentEvent e)`
`boolean` `getAntialias()` Returns true if antilaias is used while drawing.
`Color` `getBackground()` Gets the background color.
`int` `getDepth()` Gets the depth of 3D perspective charts.
`boolean` `getDisplayGrid()` Returns true if a grid is shown.
`boolean` `getDisplayImage()` Returns true if an image is used as background.
`boolean` `getDisplayValues()` Returns true if the values are displayed.
`Font` `getFont()` Gets the current font.
`Color` `getForeground()` Gets the foreground color.
`Color` `getGridColor()` Gets the grid's color.
`int` `getGridThickness()` Gets the current grid thickness.
`String` `getImageUrl()` Gets the string representation of the URL where to find the background image.
`boolean` `getInteractive()` Returns true if the program responds to mouse clicks.
`String` `getJDBCDriver()` Gets the current JDBC driver.
`String` `getJDBCPassword()` Gets the current JDBC password.
`String` `getJDBCQuery()` Gets the current JDBC query.
`String` `getJDBCUrl()` Gets the current JDBC URL.
`String` `getJDBCUser()` Gets the current JDBC user.
`boolean` `getLight()` Returns true if a light effect is used.
`Dimension` `getMinimumSize()`
`String` `getNameOfPie()` Gets the name of the chart.
`int` `getSpace()` Gets the space (in pixels) between the chart and the edge of the viewable area.
`int` `getTransparency()` Returns the transparency level.
`int` `getType()` Gets the type of chart displayed on the screen.
`int` `getTypeOfImage()` Gets the type of image alignament.
`boolean` `getUseRandomColors()` Returns true if custom colors are used.
`void` `mouseClicked(MouseEvent e)`
`void` `mouseDragged(MouseEvent e)`
`void` `mouseEntered(MouseEvent e)`
`void` `mouseExited(MouseEvent e)`
`void` `mouseMoved(MouseEvent e)`
`void` `mousePressed(MouseEvent e)`
`void` `mouseReleased(MouseEvent e)`
`void` `paint(Graphics g)`
`void` `setAntialias(boolean b)` Sets whether antialias is used while drawing.
`void` `setBackground(Color color)` Sets the background color.
`void` `setDepth(int value)` Sets the depth of 3D charts.
`void` `setDisplayGrid(boolean b)` Sets whether a grid is shown.
`void` `setDisplayImage(boolean b)` Sets whether an image should be used as background.
`void` `setDisplayValues(boolean b)` Sets whether the values are displayed.
`void` `setFont(Font f)` Sets the font to write with.
`void` `setForeground(Color color)` Sets the foreground color (it is used as text color).
`void` `setGridColor(Color color)` Sets the grid's color.
`void` `setGridThickness(int value)` Sets the grid thickness value.
`void` `setImageUrl(String url)` Sets the string representation of the URL where the program should find an valid image to use as background.
`void` `setInteractive(boolean b)` Sets whether the program should respond to users's mouse clicks or not.
`void` `setJDBCDriver(String driver)` This method only sends a new driver to the JavaBeans component.
`void` `setJDBCPassword(String value)` This method only registers this password as the next password to use when sending the next query.
`void` `setJDBCQuery(String query)` This method tries to send the specified query to the JDBC server (as previously registered with the `setJDBCDriver` and the `setJDBCUrl` methods.
`void` `setJDBCUrl(String url)` This method only registers this url as the next url to use when sending the next query.
`void` `setJDBCUser(String value)` This method only registers this user as the next user to use when sending the next query.
`void` `setLight(boolean b)` Sets whether a light effect is used when drawing the charts that uses 3D prospective.
`void` `setNameOfPie(String name)` Sets the name of the chart.
`void` `setSpace(int value)` Sets the space (in pixels) between the chart and the edge of the viewable area.
`void` `setTransparency(int value)` Sets the transparency level from 0 (opaque) to 100.
`void` `setType(int type)` Sets the type of chart that should be displayed.
`void` `setTypeOfImage(int type)` Sets the type of alignament for the image used as background.
`void` `setUseRandomColors(boolean b)` Sets whether a custom colors will be used.
`void` `update(Graphics g)`

Methods inherited from class java.awt.Canvas
`addNotify, getAccessibleContext`

Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### TOP_LEFT

    public static final int TOP_LEFT

  This value indicates that the background image is aligned to the upper left corner.

### TOP_CENTER

    public static final int TOP_CENTER

  This value indicates that the background image is centered on the upper line.

### TOP_RIGHT

    public static final int TOP_RIGHT

  This value indicates that the background image is aligned to the upper right corner.

### MIDDLE_LEFT

    public static final int MIDDLE_LEFT

  This value indicates that the background image is aligned to the left end of the middle line.

### MIDDLE_CENTER

    public static final int MIDDLE_CENTER

  This value indicates that the background image is centered on the middle line.

### MIDDLE_RIGHT

    public static final int MIDDLE_RIGHT

  This value indicates that the background image is aligned to the right end of the middle line.

### BOTTOM_LEFT

    public static final int BOTTOM_LEFT

  This value indicates that the background image is aligned to the lower left corner.

### BOTTOM_CENTER

    public static final int BOTTOM_CENTER

  This value indicates that the background image is centered to the lower line.

### BOTTOM_RIGHT

    public static final int BOTTOM_RIGHT

  This value indicates that the background image is aligned to the lower right corner.

### TILED

    public static final int TILED

  This value indicates that the background image is tiled.

### STRECHED

    public static final int STRECHED

  This value indicates that the background image is streched.

### RESET

    public static final int RESET

  This value indicates that the components will return to the original order and colors.

### ASCENDING_VALUES

    public static final int ASCENDING_VALUES

  This value indicates that the components will be sorted ascending acording to their values.

### DESCENDING_VALUES

    public static final int DESCENDING_VALUES

  This value indicates that the components will be sorted descending acording to their values.

### ASCENDING_LABELS

    public static final int ASCENDING_LABELS

  This value indicates that the components will be sorted ascending acording to their labels.

### DESCENDING_LABELS

    public static final int DESCENDING_LABELS

  This value indicates that the components will be sorted descending acording to their labels.

### ORIGINAL_ORDER

    public static final int ORIGINAL_ORDER

  This value indicates that the components will return to the original order maintaining custom colors.

### INVERTED_ORIGINAL

    public static final int INVERTED_ORIGINAL

  This value indicates that the components will be in the inverted original order.

### PIE_CHART

    public static final int PIE_CHART

  Ease-of-use constant for setType.

### PIE_CHART_3D

    public static final int PIE_CHART_3D

  Ease-of-use constant for setType.

### TORUS_CHART

    public static final int TORUS_CHART

  Ease-of-use constant for setType.

Constructor Detail

### Pie

    public Pie()

  This is the non-zero constructor required by the java.beans.Bean class in order to instantiate the bean.

Method Detail

### setType

    public void setType(int type)

  Sets the type of chart that should be displayed. Predefined constants can be used to select the type or the following values:
  - 0 - Pie Chart
  - 1 - Pie Chart in a 3D prospective
  - 2 - Torus Chart
  Parameters:
    `type` - the type of chart.

### getType

    public int getType()

  Gets the type of chart displayed on the screen.

### setNameOfPie

    public void setNameOfPie(String name)

  Sets the name of the chart. The name of the chart can be dragged with the mouse to any position.
  Parameters:
    `name` - the string to use as name of the chart.

### getNameOfPie

    public String getNameOfPie()

  Gets the name of the chart.

### setDepth

    public void setDepth(int value)

  Sets the depth of 3D charts.
  Parameters:
    `value` - the number of pixels.

### getDepth

    public int getDepth()

  Gets the depth of 3D perspective charts.

### setTypeOfImage

    public void setTypeOfImage(int type)

  Sets the type of alignament for the image used as background. Predefined constants can be used to select the type or the following values:
  - 0 - Top left
  - 1 - Top center
  - 2 - Top right
  - 3 - Midle left
  - 4 - Midle center
  - 5 - Midle right
  - 6 - Bottom left
  - 7 - Bottom center
  - 8 - Bottom right
  - 9 - Tiled
  - 10 - Streched
  Parameters:
    `type` - the type of alignament.

### getTypeOfImage

    public int getTypeOfImage()

  Gets the type of image alignament.
  See Also:
    `setTypeOfImage(int)`

### setSpace

    public void setSpace(int value)

  Sets the space (in pixels) between the chart and the edge of the viewable area.
  Parameters:
    `value` - the space between the chart and the clossest edge.

### getSpace

    public int getSpace()

  Gets the space (in pixels) between the chart and the edge of the viewable area.

### setBackground

    public void setBackground(Color color)

  Sets the background color.
  Overrides:
    `setBackground` in class `Component`

### getBackground

    public Color getBackground()

  Gets the background color.
  Overrides:
    `getBackground` in class `Component`

### setDisplayImage

    public void setDisplayImage(boolean b)

  Sets whether an image should be used as background.
  Parameters:
    `b` - true if an image is used as background; false otherwise.
  See Also:
    `setImageUrl(java.lang.String)`

### getDisplayImage

    public boolean getDisplayImage()

  Returns true if an image is used as background.
  See Also:
    `setDisplayImage(boolean)`

### setGridThickness

    public void setGridThickness(int value)

  Sets the grid thickness value.
  Parameters:
    `value` - the grid thickness.

### getGridThickness

    public int getGridThickness()

  Gets the current grid thickness.

### setDisplayValues

    public void setDisplayValues(boolean b)

  Sets whether the values are displayed.
  Parameters:
    `b` - true if the values are displayed; false otherwise.

### getDisplayValues

    public boolean getDisplayValues()

  Returns true if the values are displayed.

### setFont

    public void setFont(Font f)

  Sets the font to write with. This is the font to write all the texts on the screen.
  Overrides:
    `setFont` in class `Component`
  Parameters:
    `f` - the font to write with.

### getFont

    public Font getFont()

  Gets the current font.
  Overrides:
    `getFont` in class `Component`

### setDisplayGrid

    public void setDisplayGrid(boolean b)

  Sets whether a grid is shown.
  Parameters:
    `b` - true if a grid is shown; false otherwise.

### getDisplayGrid

    public boolean getDisplayGrid()

  Returns true if a grid is shown.

### setImageUrl

    public void setImageUrl(String url)

  Sets the string representation of the URL where the program should find an valid image to use as background. Valid image types are: JPEG, GIF, PNG.
  Parameters:
    `url` - the string representation of URL where to download the image used as background.
  See Also:
    `setDisplayImage(boolean)`

### getImageUrl

    public String getImageUrl()

  Gets the string representation of the URL where to find the background image.

### setGridColor

    public void setGridColor(Color color)

  Sets the grid's color. If a grid is shown this is the color to use to draw it.
  Parameters:
    `color` - the color to be used.

### getGridColor

    public Color getGridColor()

  Gets the grid's color.

### setForeground

    public void setForeground(Color color)

  Sets the foreground color (it is used as text color).
  Overrides:
    `setForeground` in class `Component`
  Parameters:
    `color` - the color to be used.

### getForeground

    public Color getForeground()

  Gets the foreground color.
  Overrides:
    `getForeground` in class `Component`

### setAntialias

    public void setAntialias(boolean b)

  Sets whether antialias is used while drawing.
  Parameters:
    `a` - true if antialias is used; false othwerwise.

### getAntialias

    public boolean getAntialias()

  Returns true if antilaias is used while drawing.

### setTransparency

    public void setTransparency(int value)

  Sets the transparency level from 0 (opaque) to 100.
  Parameters:
    `value` - the transparency level.

### getTransparency

    public int getTransparency()

  Returns the transparency level.

### setLight

    public void setLight(boolean b)

  Sets whether a light effect is used when drawing the charts that uses 3D prospective.
  Parameters:
    `b` - true if a light effect is used; false otherwise.

### getLight

    public boolean getLight()

  Returns true if a light effect is used.

### setUseRandomColors

    public void setUseRandomColors(boolean b)

  Sets whether a custom colors will be used.
  Parameters:
    `b` - true if custom colors are used; false otherwise.

### getUseRandomColors

    public boolean getUseRandomColors()

  Returns true if custom colors are used.

### setInteractive

    public void setInteractive(boolean b)

  Sets whether the program should respond to users's mouse clicks or not. This is usefull to protect a certain layout of the elements of the chart.
  Parameters:
    `b` - true if the program will respond to mouse clicks; false otherwise.

### getInteractive

    public boolean getInteractive()

  Returns true if the program responds to mouse clicks.

### actionPerformed

    public void actionPerformed(ActionEvent e)

  Specified by:
    `actionPerformed` in interface `ActionListener`

### componentHidden

    public void componentHidden(ComponentEvent e)

  Specified by:
    `componentHidden` in interface `ComponentListener`

### componentMoved

    public void componentMoved(ComponentEvent e)

  Specified by:
    `componentMoved` in interface `ComponentListener`

### componentShown

    public void componentShown(ComponentEvent e)

  Specified by:
    `componentShown` in interface `ComponentListener`

### componentResized

    public void componentResized(ComponentEvent e)

  Specified by:
    `componentResized` in interface `ComponentListener`

### mouseMoved

    public void mouseMoved(MouseEvent e)

  Specified by:
    `mouseMoved` in interface `MouseMotionListener`

### mouseDragged

    public void mouseDragged(MouseEvent e)

  Specified by:
    `mouseDragged` in interface `MouseMotionListener`

### mousePressed

    public void mousePressed(MouseEvent e)

  Specified by:
    `mousePressed` in interface `MouseListener`

### mouseEntered

    public void mouseEntered(MouseEvent e)

  Specified by:
    `mouseEntered` in interface `MouseListener`

### mouseExited

    public void mouseExited(MouseEvent e)

  Specified by:
    `mouseExited` in interface `MouseListener`

### mouseClicked

    public void mouseClicked(MouseEvent e)

  Specified by:
    `mouseClicked` in interface `MouseListener`

### mouseReleased

    public void mouseReleased(MouseEvent e)

  Specified by:
    `mouseReleased` in interface `MouseListener`

### setJDBCDriver

    public void setJDBCDriver(String driver)

  This method only sends a new driver to the JavaBeans component. It will not take effect until a new query is sent to the JDBC server.

### setJDBCUrl

    public void setJDBCUrl(String url)

  This method only registers this url as the next url to use when sending the next query. It will not take effect until the `setJDBCQuery` method is actually run.

### setJDBCQuery

    public void setJDBCQuery(String query)

  This method tries to send the specified query to the JDBC server (as previously registered with the `setJDBCDriver` and the `setJDBCUrl` methods. It requires that the query return a ResultSet containing such: 1. double (the x coordinate) 2. double (the y coordinate)

  The method will not throw an exception, instead it will print its stack-trace. Please send a request if you wish it to be in any other way.

### getJDBCDriver

    public String getJDBCDriver()

  Gets the current JDBC driver.

### getJDBCUrl

    public String getJDBCUrl()

  Gets the current JDBC URL.

### getJDBCQuery

    public String getJDBCQuery()

  Gets the current JDBC query.

### setJDBCUser

    public void setJDBCUser(String value)

  This method only registers this user as the next user to use when sending the next query. It will not take effect until the `setJDBCQuery` method is actually run.

### getJDBCUser

    public String getJDBCUser()

  Gets the current JDBC user.

### setJDBCPassword

    public void setJDBCPassword(String value)

  This method only registers this password as the next password to use when sending the next query. It will not take effect until the `setJDBCQuery` method is actually run.

### getJDBCPassword

    public String getJDBCPassword()

  Gets the current JDBC password.

### paint

    public void paint(Graphics g)

  Overrides:
    `paint` in class `Canvas`

### getMinimumSize

    public Dimension getMinimumSize()

  Overrides:
    `getMinimumSize` in class `Component`

### update

    public void update(Graphics g)

  Overrides:
    `update` in class `Component`

WebCab JGraph v2.0