public class GGPanel extends GGBackground
Modifier and Type | Method and Description |
---|---|
void |
arc(double radius,
double startAngle,
double extentAngle,
boolean fill)
Draws an arc with center at current graph position, radius in user x-coordinates,
start angle and angle extent.
|
void |
arc(double centerX,
double centerY,
double radius,
double startAngle,
double extentAngle,
boolean fill)
Draws an arc with given center coordinates, radius in user x-coordinates,
start angle and angle extent.
|
void |
arc(java.awt.geom.Point2D.Double center,
double radius,
double startAngle,
double extentAngle,
boolean fill)
Draws an arc with given center, radius in user x-coordinates,
start angle and angle extent.
|
void |
circle(double radius,
boolean fill)
Draws a circle with center at current graph position and given radius in user x-coordinates.
|
void |
circle(double centerX,
double centerY,
double radius,
boolean fill)
Draws a circle with given center coordinates and given radius in user x-coordinates.
|
void |
circle(java.awt.geom.Point2D.Double center,
double radius,
boolean fill)
Draws a circle with given center and given radius in user x-coordinates.
|
void |
clean()
Clears the frame buffer by painting it with the current background color.
|
void |
color(java.awt.Color color)
Sets the current paint color.
|
void |
draw(double x,
double y)
Draws a line from current graph position to the given coordinates
and sets the graph position to these coordinates.
|
void |
draw(java.awt.geom.Point2D.Double pt)
Draws a line from current graph position to the given point
and sets the graph position to this point.
|
void |
drawText(java.lang.String text,
double x,
double y)
Displays the given text at the given user coordinates using the
current font.
|
void |
drawText(java.lang.String text,
java.awt.geom.Point2D.Double pt)
Displays the given text at the given point using the
current font.
|
void |
erase()
Same as clear(), but remains the current graph position unchanged.
|
void |
generalPath(java.awt.geom.GeneralPath gp,
boolean fill)
Draws a figure defined by the given GeneralPath.
|
double |
getXmax()
Returns the right value of the x-coordinate axis.
|
double |
getXmin()
Returns the left value of the x-coordinate axis.
|
double |
getYmax()
Returns the top value of the y-coordinate axis.
|
double |
getYmin()
Returns the bottom value of the y-coordinate axis.
|
void |
image(java.awt.image.BufferedImage bi)
Draws the given image at position (0, 0) into the background buffer.
|
void |
image(java.awt.image.BufferedImage bi,
double x,
double y)
Draws the given image into the background buffer.
|
void |
line(double x1,
double y1,
double x2,
double y2)
Draws a line from (x1, y1) to (x2, y2)
|
void |
line(java.awt.geom.Point2D.Double pt1,
java.awt.geom.Point2D.Double pt2)
Draws a line from the first vertext to the second vertex.
|
void |
move(double x,
double y)
Sets the current graph position to the given coordinates
(without drawin anything).
|
void |
move(java.awt.geom.Point2D.Double pt)
Sets the current graph position to the given point
(without drawin anything).
|
void |
point()
Draws a single point at the current graph position.
|
void |
point(double x,
double y)
Draws a single point at given coordinates.
|
void |
point(java.awt.geom.Point2D.Double pt)
Draws a single point at given coordinates.
|
void |
polygon(double[] x,
double[] y,
boolean fill)
Draws a polygon with given vertexes.
|
void |
polygon(java.awt.geom.Point2D.Double[] vertexes,
boolean fill)
Draws a polygon with given vertexes.
|
void |
rectangle(double width,
double height,
boolean fill)
Draws a rectangle with center at the current graph position
and given width and height.
|
void |
rectangle(double x1,
double y1,
double x2,
double y2,
boolean fill)
Draws/fills a rectangle with given opposite vertexes.
|
void |
rectangle(java.awt.geom.Point2D.Double pt1,
java.awt.geom.Point2D.Double pt2,
boolean fill)
Draws a rectangle with given opposite vertexes.
|
void |
setRefreshEnabled(boolean enabled)
Enables/disables automatic refresh in all graphics methods of GGPanel.
|
java.awt.Point |
toPixelPoint(java.awt.geom.Point2D.Double pt)
Transforms horizontal user coordinates to pixel coordinates.
|
int |
toPixelX(double x)
Transforms horizontal user coordinates to pixel coordinates.
|
int |
toPixelY(double y)
Transforms vertical user coordinates to pixel coordinates.
|
java.awt.geom.Point2D.Double |
toUserPoint(java.awt.Point ptPix)
Transforms pixel coordinates to user coordinates.
|
double |
toUserX(int xPix)
Transforms horizontal pixel coordinates to user coordinates.
|
double |
toUserY(int yPix)
Transforms vertical pixel coordinates to user coordinates.
|
void |
triangle(double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
boolean fill)
Draws a triangle with given vertexes.
|
void |
triangle(java.awt.geom.Point2D.Double pt1,
java.awt.geom.Point2D.Double pt2,
java.awt.geom.Point2D.Double pt3,
boolean fill)
Draws a triangle with given vertexes.
|
void |
window(double xmin,
double xmax,
double ymin,
double ymax)
Sets the user coordinate system (x from left to right, y from bottom to top).
|
clear, clear, drawArc, drawCircle, drawGeneralPath, drawGridLines, drawImage, drawImage, drawImage, drawLine, drawLine, drawPoint, drawPolygon, drawRectangle, drawText, fillArc, fillCell, fillCell, fillCircle, fillGeneralPath, fillPolygon, fillRectangle, getAvailableFontFamilies, getBackgroundImage, getBgColor, getColor, getColor, getContext, getLineWidth, getPaintColor, restore, save, setBgColor, setFont, setLineWidth, setPaintColor, setPaintMode, setXORMode
public int toPixelX(double x)
x
- the user x-coordinatepublic int toPixelY(double y)
y
- the user y-coordinatepublic java.awt.Point toPixelPoint(java.awt.geom.Point2D.Double pt)
pt
- the user x-y-coordinatespublic double toUserX(int xPix)
xPix
- the pixel x-coordinatepublic double toUserY(int yPix)
yPix
- the pixel x-coordinatepublic java.awt.geom.Point2D.Double toUserPoint(java.awt.Point ptPix)
ptPix
- the pixel x-y-coordinatespublic void window(double xmin, double xmax, double ymin, double ymax)
xmin
- x-axis value at leftxmax
- x-axis value at rightymin
- y-axis value at bottomymax
- y-axis value at toppublic void line(double x1, double y1, double x2, double y2)
x1
- the x-coordinate of the first vertex.y1
- the y-coordinate of the first vertex.x2
- the x-coordinate of the second vertex.y2
- the y-coordinate of the second vertex.public void line(java.awt.geom.Point2D.Double pt1, java.awt.geom.Point2D.Double pt2)
pt1
- the first vertexpt2
- the second vertexpublic void image(java.awt.image.BufferedImage bi, double x, double y)
x
- x-coordinate of upper left vertexy
- y-coordinate of upper left vertexpublic void image(java.awt.image.BufferedImage bi)
public void move(double x, double y)
x
- the x-coordinate of the graph positiony
- the y-coordinate of the graph positionpublic void move(java.awt.geom.Point2D.Double pt)
pt
- the new graph positionpublic void draw(double x, double y)
x
- the x-coordinate of the end pointy
- the y-coordinate of the end pointpublic void draw(java.awt.geom.Point2D.Double pt)
pt
- the end pointpublic void circle(double centerX, double centerY, double radius, boolean fill)
centerX
- the x-coordinate of the centercenterY
- the y-coordinate of the centerradius
- the radius in x-coordinate unitsfill
- if true, the shape is filledpublic void circle(java.awt.geom.Point2D.Double center, double radius, boolean fill)
center
- the center of the circleradius
- the radius in x-coordinate unitsfill
- if true, the shape is filledpublic void circle(double radius, boolean fill)
radius
- the radius in x-coordinate unitsfill
- if true, the shape is filledpublic void rectangle(double x1, double y1, double x2, double y2, boolean fill)
x1
- x-coordinate of the first vertexy1
- y-coordinate of the first vertexx2
- x-coordinate of the opposite vertexy2
- y-coordinate of the opposite vertexfill
- if true, the shape is filledpublic void rectangle(java.awt.geom.Point2D.Double pt1, java.awt.geom.Point2D.Double pt2, boolean fill)
pt1
- the first vertexpt2
- the opposite vertexfill
- if true, the shape is filledpublic void rectangle(double width, double height, boolean fill)
width
- the width of the rectangleheight
- the height of the rectanglefill
- if true, the shape is filledpublic void arc(double centerX, double centerY, double radius, double startAngle, double extentAngle, boolean fill)
centerX
- the x-coordinate of the centercenterY
- the y-coordinate of the centerradius
- the radius in x-coordinate unitsstartAngle
- the start angle in degrees
(zero at east, positive counter-clockwise)extentAngle
- the angle extent in degreesfill
- if true, the shape is filledpublic void arc(java.awt.geom.Point2D.Double center, double radius, double startAngle, double extentAngle, boolean fill)
center
- the center of the arcradius
- the radius in x-coordinate unitsstartAngle
- the start angle in degrees
(zero at east, positive counter-clockwise)extentAngle
- the angle extent of the arc in degreesfill
- if true, the shape is filledpublic void arc(double radius, double startAngle, double extentAngle, boolean fill)
radius
- the radius in x-coordinate unitsstartAngle
- the start angle in degrees
(zero at east, positive counter-clockwise)extentAngle
- the angle extent of the arc in degreesfill
- if true, the shape is filledpublic void polygon(double[] x, double[] y, boolean fill)
x
- an array of the x-coordinates of the vertexesy
- an array of the y-coordinates of the vertexesfill
- if true, the shape is filledpublic void polygon(java.awt.geom.Point2D.Double[] vertexes, boolean fill)
vertexes
- an array of the vertexesfill
- if true, the shape is filledpublic void triangle(double x1, double y1, double x2, double y2, double x3, double y3, boolean fill)
x1
- the x-coordinate of the first vertexy1
- the y-coordinate of the first vertexx2
- the x-coordinate of the second vertexy2
- the y-coordinate of the second vertexx3
- the x-coordinate of the third vertexy3
- the y-coordinate of the third vertexfill
- if true, the shape is filledpublic void triangle(java.awt.geom.Point2D.Double pt1, java.awt.geom.Point2D.Double pt2, java.awt.geom.Point2D.Double pt3, boolean fill)
pt1
- the first vertexpt2
- the second vertexpt3
- the third vertexfill
- if true, the shape is filledpublic void generalPath(java.awt.geom.GeneralPath gp, boolean fill)
gp
- the GeneralPath that defines the shapefill
- if true, the shape is filledpublic void point(double x, double y)
x
- the x-coordinate of the pointy
- the y-coordinate of the pointpublic void point(java.awt.geom.Point2D.Double pt)
pt
- the point where to drawpublic void point()
public void drawText(java.lang.String text, double x, double y)
text
- the text to displayx
- the x-coordinate of the start point of the text baseliney
- the y-coordinate of the start point of the text baselinepublic void drawText(java.lang.String text, java.awt.geom.Point2D.Double pt)
text
- the text to displaypt
- the start point of the text baselinepublic void clean()
public void erase()
public double getXmin()
public double getXmax()
public double getYmin()
public double getYmax()
public void color(java.awt.Color color)
color
- the new paint colorpublic void setRefreshEnabled(boolean enabled)
enabled
- if true, refresh is enabled (default); otherwise
no refresh is done