|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel yops.Graphic yops.Shape
public abstract class Shape
A Shape is a geometric visual component. To create a Shape, call a constructor for one of its subclasses, listed above. This class defines methods that are available on all Shape objects. Specific shapes may provide additional methods.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class yops.Graphic |
---|
THICK_STROKE |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
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 |
Method Summary | |
---|---|
boolean |
contains(int x,
int y)
Returns true if the given (x,y) pixel coordinate is within the boundary of the shape, where (0,0) represents the upper left corner of the bounding box of the shape. |
boolean |
isFilled()
I If a Graphic is filled, it will be painted in a solid color. |
void |
paint(Graphics g)
Paints the Shape when requested by the Java's graphics system. |
void |
setCenter(int x,
int y)
Sets the location of this Graphic so that its center is at the given pixel coordinates within its container. |
void |
setCorners(int x1,
int y1,
int x2,
int y2)
Sets bounding box of the Shape based on the coordinates of any two diagonally opposite corners. |
void |
setFilled(boolean filled)
Sets whether or not the graphic should be filled (painted in a solid color). |
void |
setSize(int width,
int height)
Sets the width and height of the Shape, in pixels. |
void |
setUpperLeft(int x,
int y)
Sets the location of this Graphic so that its upper left corner is at the given pixel coordinates within its container. |
Methods inherited from class yops.Graphic |
---|
add, setFillColor, setLineColor, toString |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public boolean contains(int x, int y)
contains
in class JComponent
public boolean isFilled()
Graphic
isFilled
in class Graphic
public void setFilled(boolean filled)
Graphic
setFilled
in class Graphic
filled
- whether or not the Graphic should be filledpublic void setSize(int width, int height)
setSize
in class Component
public void setCenter(int x, int y)
Graphic
setCenter
in class Graphic
x
- in pixelsy
- in pixelspublic void setCorners(int x1, int y1, int x2, int y2)
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointpublic void setUpperLeft(int x, int y)
Graphic
setUpperLeft
in class Graphic
x
- in pixelsy
- in pixelspublic void paint(Graphics g)
Component.repaint()
. (If you do not see the shape, it may not have been added to
a visible container, it may be behind another graphic, its color may blend with the background, or
its coordinates may be outside the visible region of the container.)
paint
in class JComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |