|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrut.KRUT_GUI.ScreenMarkerLine
public class ScreenMarkerLine
This is a class to draw lines that usually look like they are drawn directly on the screen. It can be used to mark an area of the screen. At the moment, only straight lines can be drawn. The drawing is performed very crudly by using an undecorated JFrame to draw a series of pixels, lines, or rectangular shapes over a snapshot that has been taken of the background. These drawings are aligned and added up to a line of the specified dimensions. This class is almost, but not entirely, finished. It is not currently used in the Krut program.
Field Summary | |
---|---|
static int |
HORIZONTAL
The horizontal orientation for this class. |
java.awt.Color |
marker
|
java.awt.Color |
safeColor
|
static int |
VERTICAL
The vertical orientation for this class. |
Constructor Summary | |
---|---|
ScreenMarkerLine()
Creates a new instance of ScreenMarkerLine with no size and orientation HORIZONTAL. |
|
ScreenMarkerLine(java.awt.Rectangle bounds,
int orientation)
Creates a new instance of ScreenMarkerLine with the given bounds and orientation, provided they are valid, with one segment and no gap size. |
|
ScreenMarkerLine(java.awt.Rectangle bounds,
int orientation,
int segmentSize,
int gapSize)
Creates a new instance of ScreenMarkerLine with the given parameters, provided they are valid. |
Method Summary | |
---|---|
void |
createLine()
Create the JFrame that the line is drawn in. |
java.awt.Rectangle |
getBounds()
Get the bounds for this line. |
int |
getGapSize()
Gives the gap size in the orientation of the line. |
int |
getLength()
Returns the length of the line. |
int |
getSegmentSize()
Gives the segment size in the orientation of the line. |
int |
getWidth()
Returns the width of the line. |
void |
hold(long ms)
Used as a place to wait for sync in the updating of the graphics. |
int |
moveLine(int x,
int y)
Moves the top left corner of the line to the position (x, y) and updates the line once. |
int |
setBounds(java.awt.Rectangle bounds)
Sets the bounds of this line. |
void |
setFrame(javax.swing.JFrame inFrame)
This is just for testing. |
int |
setGapSize(int size)
Sets the gap size in the orientation of the line. |
int |
setOrientation(int orientation)
Sets the orientation of this line. |
int |
setSegmentSize(int size)
Sets the segment size in the orientation of the line. |
void |
updateLineGraphics()
This takes a new snapshot of the background, and fills in the line segments. |
void |
wakeUp()
Called by the user to start capturing images. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.awt.Color marker
public java.awt.Color safeColor
public static final int HORIZONTAL
public static final int VERTICAL
Constructor Detail |
---|
public ScreenMarkerLine()
public ScreenMarkerLine(java.awt.Rectangle bounds, int orientation)
bounds
- Should be a Rectangle with only
positive integer values.orientation
- Should be either HORIZONTAL or VERTICAL.public ScreenMarkerLine(java.awt.Rectangle bounds, int orientation, int segmentSize, int gapSize)
bounds
- Should be a Rectangle with only
positive integer values.orientation
- Should be either HORIZONTAL or VERTICAL.segmentSize
- Should be a positive integer larger than 0.gapSize
- Should be a positive integer no larger than
the orientation.Method Detail |
---|
public void hold(long ms)
ms
- The time to wait in ms. If 0 is given,
the wait will be indefinite (until a
notifyAll).public void wakeUp()
public int getLength()
public int getWidth()
public int setSegmentSize(int size)
size
- The requested segment size
in the orientation of the line.
public int getSegmentSize()
public int setGapSize(int size)
size
- The requested gap size in
the orientation of the line.
public int getGapSize()
public int moveLine(int x, int y)
x
- The new x position of the
line. Should be a positive
integer.y
- The new y position of the
line. Should be a positive
integer.
public int setBounds(java.awt.Rectangle bounds)
bounds
- The requested new bounds for the line.
public java.awt.Rectangle getBounds()
public int setOrientation(int orientation)
orientation
- The requested orientation.
public void updateLineGraphics()
public void setFrame(javax.swing.JFrame inFrame)
public void createLine()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |