maclib
Class MacLib

java.lang.Object
  extended by maclib.MacLib

public class MacLib
extends java.lang.Object

The class MacLib implements QuickDraw-like drawing and event routines. It is mostly a static wrapper around a GrafPort object.

Version:
04 may 2012
Author:
Philippe Chassignet, Ecole Polytechnique
See Also:
GrafPort

Field Summary
static int blackColor
          Used to specify one of the standard painting color.
static int blueColor
          Used to specify one of the standard painting color.
static int bold
          Used to specify a text style.
static int control
          Used to encode the control modifier in the button state.
static int cyanColor
          Used to specify one of the standard painting color.
static java.lang.String dialog
          Used to specify one of the standard text font.
static java.lang.String dialogInput
          Used to specify one of the standard text font.
static int greenColor
          Used to specify one of the standard painting color.
static int italic
          Used to specify a text style.
static int magentaColor
          Used to specify one of the standard painting color.
static int meta
          Used to encode the meta modifier in the button state.
static java.lang.String monospaced
          Used to specify one of the standard text font.
static int none
          Used to specify no modifier in the button state .
static int patCopy
          Used to specify the normal painting mode.
static int patXor
          Used to specify the XOR painting mode.
static int plain
          Used to specify a text style.
static int randSeed
          The seed value used by the random() generator.
static int redColor
          Used to specify one of the standard painting color.
static java.lang.String sansSerif
          Used to specify one of the standard text font.
static java.lang.String serif
          Used to specify one of the standard text font.
static int shift
          Used to encode the shift modifier in the button state.
static int whiteColor
          Used to specify one of the standard painting color.
static int yellowColor
          Used to specify one of the standard painting color.
 
Method Summary
static void addPt(Point src, Point dst)
          Translates the second given point by the displacement vector specified as the first given point.
static void AddPt(Point src, Point dst)
           
static void backColor(java.awt.Color color)
          Sets the current background color, used when erasing or inverting, as specified by the given java.awt.Color object.
static void backColor(int color)
          Sets the current background color, used when erasing or inverting, as specified by one of the height constant flags : blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor or yellowColor.
static void BackColor(int color)
           
static boolean button()
          Returns the state of the mouse button.
static boolean Button()
           
static int buttonState()
          Returns the int value that describes the modifier keys state at the time of the last mouse pressed event.
static int ButtonState()
           
static int charWidth(char c)
          Returns the width in pixels of the given character.
static int CharWidth(char c)
           
static void delay(long numTicks)
          Causes the current thread to sleep approximately for the number of ticks (sixtieths of a second) specified by numTicks.
static void Delay(long numTicks)
           
static void dispose()
          Disposes of the GrafPort and associated objects.
static void drawChar(char c)
          Draws the given character.
static void DrawChar(char c)
           
 boolean drawImage(java.awt.Image img)
          Draws the given image, starting at location (0,0).
static void drawLine(int x1, int y1, int x2, int y2)
          Draws a line from the location that is specified by x1 and y1 to the location that is specified by x2 and y2 (in coordinates relative to the Drawing window).
static void DrawLine(int x1, int y1, int x2, int y2)
           
static void drawString(java.lang.String s)
          Draws the given text string.
static void DrawString(java.lang.String s)
           
static void drawText(char[] textBuf, int firstByte, int byteCount)
          Draws the specified text.
static void DrawText(char[] textBuf, int firstByte, int byteCount)
           
static boolean emptyRect(Rect r)
          Determines whether the given rectangle is empty or not.
static boolean EmptyRect(Rect r)
           
static boolean equalPt(Point p1, Point p2)
          Determines whether the two given points have the same coordinates.
static boolean EqualPt(Point p1, Point p2)
           
static boolean equalRect(Rect r1, Rect r2)
          Determines whether the two given rectangles have the same coordinates.
static boolean EqualRect(Rect r1, Rect r2)
           
static void eraseArc(Rect r, int startAngle, int arcAngle)
          Paints inside a wedge of the oval that fits inside the specified rectangle, using the background color.
static void EraseArc(Rect r, int startAngle, int arcAngle)
           
static void eraseOval(Rect r)
          Paints inside the oval that fits inside the specified rectangle, using the background color.
static void EraseOval(Rect r)
           
static void erasePolygon(Point[] points, int pCount)
          Paints inside the specified polygon, using the background color.
static void ErasePolygon(Point[] points, int pCount)
           
static void eraseRect(Rect r)
          Paints inside the specified rectangle, using the background color.
static void EraseRect(Rect r)
           
static void eraseRoundRect(Rect r, int arcWidth, int arcHeight)
          Paints inside the specified rounded-corner rectangle, using the background color.
static void EraseRoundRect(Rect r, int arcWidth, int arcHeight)
           
static void foreColor(java.awt.Color color)
          Sets the current pen color, used for drawing lines or text and painting shapes, as specified by the given java.awt.Color object.
static void foreColor(int color)
          Sets the current pen color, used for drawing lines or text and painting shapes, as specified by one of the height constant flags : blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor or yellowColor.
static void ForeColor(int color)
           
static void frameArc(Rect r, int startAngle, int arcAngle)
          Draws an arc of outline just inside the oval that fits inside the specified rectangle.
static void FrameArc(Rect r, int startAngle, int arcAngle)
           
static void frameOval(Rect r)
          Draws an outline just inside the oval that fits inside the specified rectangle.
static void FrameOval(Rect r)
           
static void framePolygon(Point[] points, int pCount)
          Draws an outline of the specified polygon.
static void FramePolygon(Point[] points, int pCount)
           
static void frameRect(Rect r)
          Draws an outline just inside the specified rectangle.
static void FrameRect(Rect r)
           
static void frameRoundRect(Rect r, int arcWidth, int arcHeight)
          Draws an outline just inside the specified rounded-corner rectangle.
static void FrameRoundRect(Rect r, int arcWidth, int arcHeight)
           
static void getClick(Point p)
          Waits until the mouse button is pressed and then released in the Drawing window.
static void GetClick(Point p)
           
static void getDrawingRect(Rect r)
          Gets the bounds of the Drawing window.
static void GetDrawingRect(Rect r)
           
 FontInfo getFontInfo()
          Returns the metric informations about the current font as a FontInfo object.
 FontInfo GetFontInfo()
           
static char getKey()
          Returns the char corresponding to the last keyboard event in the Drawing window.
static char GetKey()
           
static void getMouse(Point p)
          Stores the current mouse location (relative to the Drawing window) in the given PointPoint object.
static void GetMouse(Point p)
           
static void getPen(Point p)
          Stores the current pen location (relative to the Drawing window) in the given point.
static void GetPen(Point p)
           
static GrafPort getPort()
          Returns the GrafPort for the current Drawing window.
static GrafPort GetPort()
           
static void getTextRect(Rect r)
          Gets the bounds of the Text window.
static void GetTextRect(Rect r)
           
static void hideAll()
          Hides both the Drawing and Text windows.
static void HideAll()
           
static short hiWord(int value)
          Returns the short integer value corresponding to the 16 most significant bits of the given 32 bits integer.
static short HiWord(int value)
           
static void initQuickDraw()
          Initializes a MacLib session or reset the existing one.
static void InitQuickDraw()
           
static void initQuickDraw(GrafPort port)
          Initializes or reset a MacLib session with the given GrafPort.
static void insetRect(Rect r, int dh, int dv)
          Shrinks or expands the given rectangle by the specified amounts.
static void InsetRect(Rect r, int dh, int dv)
           
static void invertArc(Rect r, int startAngle, int arcAngle)
          Inverts pixels inside a wedge of the oval that fits inside the specified rectangle.
static void InvertArc(Rect r, int startAngle, int arcAngle)
           
static void invertCircle(int x, int y, int r)
          Inverts pixels inside the specified circle.
static void InvertCircle(int x, int y, int r)
           
static void invertOval(Rect r)
          Inverts pixels inside the oval that fits inside the specified rectangle.
static void InvertOval(Rect r)
           
static void invertPolygon(Point[] points, int pCount)
          Inverts pixels inside the specified polygon.
static void InvertPolygon(Point[] points, int pCount)
           
static void invertRect(Rect r)
          Inverts pixels inside the specified rectangle.
static void InvertRect(Rect r)
           
static void invertRoundRect(Rect r, int arcWidth, int arcHeight)
          Inverts pixels inside the specified rounded-corner rectangle.
static void InvertRoundRect(Rect r, int arcWidth, int arcHeight)
           
static boolean keyPressed()
          Checks whether the char, corresponding to the last keyboard event occured in the Drawing window, is still available.
static boolean KeyPressed()
           
static void line(int dh, int dv)
          Draws a line from the current pen location to the location that is at distance of dh horizontally and dv vertically.
static void Line(int dh, int dv)
           
static void lineTo(int h, int v)
          Draws a line from the current pen location to the location that is specified by h and v (in coordinates relative to the Drawing window).
static void LineTo(int h, int v)
           
static short loWord(int value)
          Returns the short integer value corresponding to the 16 least significant bits of the given 32 bits integer.
static short LoWord(int value)
           
static void move(int dh, int dv)
          Translates the coordinates of the pen by the specified displacement vector.
static void Move(int dh, int dv)
           
static void moveTo(int h, int v)
          Sets the coordinates of the pen (relative to the Drawing window) to the specified location.
static void MoveTo(int h, int v)
           
static Point[] newPointArray(int pCount)
          Allocates an new array of also allocated Point objects, which is useful for specifying polygonal shapes.
static void offsetRect(Rect r, int dh, int dv)
          Translates the given rectangle by the specified displacement.
static void OffsetRect(Rect r, int dh, int dv)
           
static void paintArc(Rect r, int startAngle, int arcAngle)
          Paints inside a wedge of the oval that fits inside the specified rectangle.
static void PaintArc(Rect r, int startAngle, int arcAngle)
           
static void paintCircle(int x, int y, int r)
          Paints inside the specified circle.
static void PaintCircle(int x, int y, int r)
           
static void paintOval(Rect r)
          Paints inside the oval that fits inside the specified rectangle.
static void PaintOval(Rect r)
           
static void paintPolygon(Point[] points, int pCount)
          Paints inside the specified polygon.
static void PaintPolygon(Point[] points, int pCount)
           
static void paintRect(Rect r)
          Paints inside the specified rectangle.
static void PaintRect(Rect r)
           
static void paintRoundRect(Rect r, int arcWidth, int arcHeight)
          Paints inside the specified rounded-corner rectangle.
static void PaintRoundRect(Rect r, int arcWidth, int arcHeight)
           
static void penMode(int mode)
          Sets the current transfer mode, used for drawing lines and painting shapes, to be one of the two constant flags patCopy or patXor.
static void PenMode(int mode)
           
static void penNormal()
          Resets the initial state (mode and size) of the pen.
static void PenNormal()
           
static void penSize(int width, int height)
          Sets the dimensions of the rectangular pen, used for drawing lines and framed shapes.
static void PenSize(int width, int height)
           
static void pt2Rect(Point p1, Point p2, Rect dst)
          Sets the coordinates of the given rectangle to the smallest one which encloses the two given points.
static void Pt2Rect(Point p1, Point p2, Rect dst)
           
static boolean ptInRect(Point pt, Rect r)
          Determines whether the pixel below and to the right of the given point is enclosed in the given rectangle.
static boolean PtInRect(Point pt, Rect r)
           
static short random()
          Returns a pseudo-random, uniformly distributed, integer value in the range from -32768 through 32767.
static short Random()
           
static void RGBBackColor(RGBColor color)
          Sets the current background color, used when erasing or inverting, as specified by the given RGBColor object.
static void RGBForeColor(RGBColor color)
          Sets the current pen color, used for drawing lines or text and painting shapes, as specified by the given RGBColor object.
static boolean sectRect(Rect src1, Rect src2, Rect dst)
          Sets the coordinates of the third given rectangle to the rectangle that is the intersection of the two first given rectangles.
static boolean SectRect(Rect src1, Rect src2, Rect dst)
           
static void setDrawingRect(Rect r)
          Sets the bounds of the Drawing window.
static void SetDrawingRect(Rect r)
           
static void setPort(GrafPort port)
          Defines the given GrafPort as the current Drawing window, but doesn't reset it.
static void SetPort(GrafPort port)
           
static void setPt(Point p, int h, int v)
          Sets the coordinates of the given point to the specified location.
static void SetPt(Point p, int h, int v)
           
static void setRect(Rect r, int left, int top, int right, int bottom)
          Sets the coordinates of the given rectangle as specified.
static void SetRect(Rect r, int left, int top, int right, int bottom)
           
static void setText(java.awt.Frame frame)
          Defines the given external frame as the current Text window.
static void setTextRect(Rect r)
          Sets the bounds of the Text window.
static void SetTextRect(Rect r)
           
static void showDrawing()
          Makes the Drawing window visible and brings it to the front.
static void ShowDrawing()
           
static void showText()
          Makes the Text window visible and brings it to the front.
static void ShowText()
           
static int stringWidth(java.lang.String s)
          Returns the width in pixels of the given text string.
static int StringWidth(java.lang.String s)
           
static void subPt(Point src, Point dst)
          Translates the second given point by the displacement vector specified as the inverse of the first given point.
static void SubPt(Point src, Point dst)
           
static void sysBeep(int duration)
          Causes the system to beep
static void SysBeep(int duration)
           
 void textFace(int face)
          Sets the style of the font used for drawing text, it should be one of the followings constants : plain, bold, italic or bold+italic.
 void TextFace(int face)
           
 void textFont(java.lang.String name)
          Sets the name of the font used for drawing text.
 void TextFont(java.lang.String name)
           
 void textSize(int size)
          Sets the size of the font used for drawing text.
 void TextSize(int size)
           
static int textWidth(char[] textBuf, int firstByte, int byteCount)
          Returns the width in pixels of the specified text.
static int TextWidth(char[] textBuf, int firstByte, int byteCount)
           
static long tickCount()
          Returns the current number of ticks (sixtieths of a second) since midnight, January 1, 1970 UTC.
static long TickCount()
           
static boolean trackMouse(Point p)
          Waits until the mouse button is released, after being pressed, or until the mouse location is dragged.
static boolean TrackMouse(Point p)
           
static void unionRect(Rect src1, Rect src2, Rect dst)
          Sets the coordinates of the third given rectangle to the smallest one which encloses the two first given rectangles.
static void UnionRect(Rect src1, Rect src2, Rect dst)
           
static void waitClickDown()
          Waits until the mouse button is pressed in the Drawing window.
static void WaitClickDown()
           
static void waitClickUp()
          Waits until the mouse button is released after being pressed in the Drawing window.
static void WaitClickUp()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

patCopy

public static final int patCopy
Used to specify the normal painting mode.

See Also:
penMode(int), Constant Field Values

patXor

public static final int patXor
Used to specify the XOR painting mode.

See Also:
penMode(int), Constant Field Values

blackColor

public static final int blackColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

whiteColor

public static final int whiteColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

redColor

public static final int redColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

greenColor

public static final int greenColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

blueColor

public static final int blueColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

cyanColor

public static final int cyanColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

magentaColor

public static final int magentaColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

yellowColor

public static final int yellowColor
Used to specify one of the standard painting color.

See Also:
foreColor(int), backColor(int), Constant Field Values

dialog

public static final java.lang.String dialog
Used to specify one of the standard text font.

See Also:
textFont(String), Constant Field Values

dialogInput

public static final java.lang.String dialogInput
Used to specify one of the standard text font.

See Also:
textFont(String), Constant Field Values

sansSerif

public static final java.lang.String sansSerif
Used to specify one of the standard text font.

See Also:
textFont(String), Constant Field Values

serif

public static final java.lang.String serif
Used to specify one of the standard text font.

See Also:
textFont(String), Constant Field Values

monospaced

public static final java.lang.String monospaced
Used to specify one of the standard text font.

See Also:
textFont(String), Constant Field Values

plain

public static final int plain
Used to specify a text style.

See Also:
textFace(int), Constant Field Values

bold

public static final int bold
Used to specify a text style.

See Also:
textFace(int), Constant Field Values

italic

public static final int italic
Used to specify a text style.

See Also:
textFace(int), Constant Field Values

none

public static final int none
Used to specify no modifier in the button state .

See Also:
buttonState(), Constant Field Values

shift

public static final int shift
Used to encode the shift modifier in the button state.

See Also:
buttonState(), Constant Field Values

control

public static final int control
Used to encode the control modifier in the button state.

See Also:
buttonState(), Constant Field Values

meta

public static final int meta
Used to encode the meta modifier in the button state.

See Also:
buttonState(), Constant Field Values

randSeed

public static int randSeed
The seed value used by the random() generator. It is initialized to 1 and is reset by any call to initQuickDraw.

It may be set to a different value in order to start a different random sequence.

See Also:
random(), initQuickDraw()
Method Detail

setPt

public static void setPt(Point p,
                         int h,
                         int v)
Sets the coordinates of the given point to the specified location.

Parameters:
p - the Point object to be modified
h - the h coordinate of the new location
v - the v coordinate of the new location

SetPt

public static void SetPt(Point p,
                         int h,
                         int v)
See Also:
setPt(Point, int, int)

addPt

public static void addPt(Point src,
                         Point dst)
Translates the second given point by the displacement vector specified as the first given point. Adds the coordinates of point src to the coordinates of point dst.

Parameters:
src - the Point object used as a vector to specify the displacement
dst - the Point object to be modified

AddPt

public static void AddPt(Point src,
                         Point dst)
See Also:
addPt(Point, Point)

subPt

public static void subPt(Point src,
                         Point dst)
Translates the second given point by the displacement vector specified as the inverse of the first given point. Subtracts the coordinates of point src from the coordinates of point dst.

Parameters:
src - the Point object used as a vector to specify the displacement
dst - the Point object to be modified

SubPt

public static void SubPt(Point src,
                         Point dst)
See Also:
subPt(Point, Point)

equalPt

public static boolean equalPt(Point p1,
                              Point p2)
Determines whether the two given points have the same coordinates.

Parameters:
p1 - the first Point object
p2 - the second Point object to compare with
Returns:
true if both points have same coordinates; false otherwise

EqualPt

public static boolean EqualPt(Point p1,
                              Point p2)
See Also:
equalPt(Point, Point)

newPointArray

public static Point[] newPointArray(int pCount)
Allocates an new array of also allocated Point objects, which is useful for specifying polygonal shapes.

Parameters:
pCount - the number of wanted Point objects
Returns:
an new array of pCount new Point objects
See Also:
framePolygon(Point[], int), paintPolygon(Point[], int), erasePolygon(Point[], int), invertPolygon(Point[], int)

setRect

public static void setRect(Rect r,
                           int left,
                           int top,
                           int right,
                           int bottom)
Sets the coordinates of the given rectangle as specified.

Parameters:
r - the Rect object to be modified
left - the new left coordinate
top - the new top coordinate
right - the new right coordinate
bottom - the new bottom coordinate

SetRect

public static void SetRect(Rect r,
                           int left,
                           int top,
                           int right,
                           int bottom)
See Also:
setRect(Rect, int, int, int, int)

pt2Rect

public static void pt2Rect(Point p1,
                           Point p2,
                           Rect dst)
Sets the coordinates of the given rectangle to the smallest one which encloses the two given points.

Parameters:
p1 - the first Point object used to specify the coordinates
p2 - the second Point object used to specify the coordinates
dst - the Rect object to be modified

Pt2Rect

public static void Pt2Rect(Point p1,
                           Point p2,
                           Rect dst)
See Also:
pt2Rect(Point, Point, Rect)

offsetRect

public static void offsetRect(Rect r,
                              int dh,
                              int dv)
Translates the given rectangle by the specified displacement. Adds dh to each horizontal coordinate and dv to each vertical coordinate.

Parameters:
r - the Rect object to be modified
dh - the horizontal displacement
dv - the vertical displacement

OffsetRect

public static void OffsetRect(Rect r,
                              int dh,
                              int dv)
See Also:
offsetRect(Rect, int, int)

insetRect

public static void insetRect(Rect r,
                             int dh,
                             int dv)
Shrinks or expands the given rectangle by the specified amounts. Adds dh to the left coordinate and subtracts dh from the right coordinate. Adds dv to the top coordinate and subtracts dv from the bottom coordinate.

Parameters:
r - the Rect object to be modified
dh - the horizontal displacement
dv - the vertical displacement

InsetRect

public static void InsetRect(Rect r,
                             int dh,
                             int dv)
See Also:
insetRect(Rect, int, int)

unionRect

public static void unionRect(Rect src1,
                             Rect src2,
                             Rect dst)
Sets the coordinates of the third given rectangle to the smallest one which encloses the two first given rectangles.

Parameters:
src1 - the first Rect object used to specify the coordinates
src2 - the second Rect object used to specify the coordinates
dst - the Rect object to be modified

UnionRect

public static void UnionRect(Rect src1,
                             Rect src2,
                             Rect dst)
See Also:
unionRect(Rect, Rect, Rect)

equalRect

public static boolean equalRect(Rect r1,
                                Rect r2)
Determines whether the two given rectangles have the same coordinates.

Parameters:
r1 - the first Rect object
r2 - the second Rect object to compare with
Returns:
true if both rectangles have same coordinates; false otherwise

EqualRect

public static boolean EqualRect(Rect r1,
                                Rect r2)
See Also:
equalRect(Rect, Rect)

sectRect

public static boolean sectRect(Rect src1,
                               Rect src2,
                               Rect dst)
Sets the coordinates of the third given rectangle to the rectangle that is the intersection of the two first given rectangles. Determines also whether they indeed intersect. Rectangles that "touch" at a line or a point are not considered intersecting. If the rectangles do not intersect, the third rectangle is set to (0,0,0,0).

Parameters:
src1 - the first Rect object used to specify the coordinates
src2 - the second Rect object used to specify the coordinates
dst - the Rect object to be modified
Returns:
true if the two rectangles really intersect; false otherwise

SectRect

public static boolean SectRect(Rect src1,
                               Rect src2,
                               Rect dst)
See Also:
sectRect(Rect, Rect, Rect)

ptInRect

public static boolean ptInRect(Point pt,
                               Rect r)
Determines whether the pixel below and to the right of the given point is enclosed in the given rectangle.

Parameters:
pt - the Point object
r - the Rect object to check with
Returns:
true if so; false otherwise

PtInRect

public static boolean PtInRect(Point pt,
                               Rect r)
See Also:
ptInRect(Point, Rect)

emptyRect

public static boolean emptyRect(Rect r)
Determines whether the given rectangle is empty or not. A rectangle is considered empty if the bottom coordinate is equal to or less than the top or the right coordinate is equal to or less than the left.

Parameters:
r - the Rect object
Returns:
true if so; false otherwise

EmptyRect

public static boolean EmptyRect(Rect r)
See Also:
emptyRect(Rect)

initQuickDraw

public static void initQuickDraw()
Initializes a MacLib session or reset the existing one.

See Also:
initQuickDraw(GrafPort)

InitQuickDraw

public static void InitQuickDraw()
See Also:
initQuickDraw()

initQuickDraw

public static void initQuickDraw(GrafPort port)
Initializes or reset a MacLib session with the given GrafPort.

Parameters:
port - a GrafPort object
See Also:
initQuickDraw()

dispose

public static void dispose()
Disposes of the GrafPort and associated objects.


setPort

public static void setPort(GrafPort port)
Defines the given GrafPort as the current Drawing window, but doesn't reset it.

Parameters:
port - a GrafPort object
See Also:
initQuickDraw(GrafPort), getPort()

SetPort

public static void SetPort(GrafPort port)
See Also:
setPort(GrafPort)

getPort

public static GrafPort getPort()
Returns the GrafPort for the current Drawing window.

Returns:
the GrafPort object
See Also:
setPort(GrafPort)

GetPort

public static GrafPort GetPort()
See Also:
getPort()

setText

public static void setText(java.awt.Frame frame)
Defines the given external frame as the current Text window.

Parameters:
frame - a Frame object

setDrawingRect

public static void setDrawingRect(Rect r)
Sets the bounds of the Drawing window.

Parameters:
r - a Rect object that specifies the new screen coordinates

SetDrawingRect

public static void SetDrawingRect(Rect r)
See Also:
setDrawingRect(Rect)

setTextRect

public static void setTextRect(Rect r)
Sets the bounds of the Text window.

Parameters:
r - a Rect object that specifies the new screen coordinates

SetTextRect

public static void SetTextRect(Rect r)
See Also:
setTextRect(Rect)

getDrawingRect

public static void getDrawingRect(Rect r)
Gets the bounds of the Drawing window.

Parameters:
r - a Rect object filled with the screen coordinates

GetDrawingRect

public static void GetDrawingRect(Rect r)
See Also:
getDrawingRect(Rect)

getTextRect

public static void getTextRect(Rect r)
Gets the bounds of the Text window.

Parameters:
r - a Rect object filled with the screen coordinates

GetTextRect

public static void GetTextRect(Rect r)
See Also:
getTextRect(Rect)

showDrawing

public static void showDrawing()
Makes the Drawing window visible and brings it to the front.


ShowDrawing

public static void ShowDrawing()
See Also:
showDrawing()

showText

public static void showText()
Makes the Text window visible and brings it to the front.


ShowText

public static void ShowText()
See Also:
showText()

hideAll

public static void hideAll()
Hides both the Drawing and Text windows.


HideAll

public static void HideAll()
See Also:
hideAll()

button

public static boolean button()
Returns the state of the mouse button.

Returns:
true if the button is currently down after being pressed in the Drawing window; false otherwise

Button

public static boolean Button()
See Also:
button()

waitClickDown

public static void waitClickDown()
Waits until the mouse button is pressed in the Drawing window.


WaitClickDown

public static void WaitClickDown()
See Also:
waitClickDown()

waitClickUp

public static void waitClickUp()
Waits until the mouse button is released after being pressed in the Drawing window.


WaitClickUp

public static void WaitClickUp()
See Also:
waitClickUp()

getMouse

public static void getMouse(Point p)
Stores the current mouse location (relative to the Drawing window) in the given PointPoint object.

Parameters:
p - the Point object to be modified

GetMouse

public static void GetMouse(Point p)
See Also:
getMouse(Point)

getClick

public static void getClick(Point p)
Waits until the mouse button is pressed and then released in the Drawing window. Stores the mouse location (relative to the Drawing window) at the release time in the given point.

Parameters:
p - the Point object to be modified

GetClick

public static void GetClick(Point p)
See Also:
getClick(Point)

trackMouse

public static boolean trackMouse(Point p)
Waits until the mouse button is released, after being pressed, or until the mouse location is dragged. Stores the issued mouse location (relative to the Drawing window) in the given point.

Parameters:
p - the Point object to be modified

TrackMouse

public static boolean TrackMouse(Point p)
See Also:
trackMouse(Point)

buttonState

public static int buttonState()
Returns the int value that describes the modifier keys state at the time of the last mouse pressed event. The returned value is either none, or a combination of the shift, control and meta (for the Alt key) constant flags.

Returns:
the modifier keys state as an int value
See Also:
none, shift, control, meta

ButtonState

public static int ButtonState()
See Also:
buttonState()

keyPressed

public static boolean keyPressed()
Checks whether the char, corresponding to the last keyboard event occured in the Drawing window, is still available.

Returns:
true if any char available; false otherwise

KeyPressed

public static boolean KeyPressed()
See Also:
keyPressed()

getKey

public static char getKey()
Returns the char corresponding to the last keyboard event in the Drawing window. If no char is available, will block until a new keyboard event occurs. The char is made unavailable for further calls.

Returns:
the last key char

GetKey

public static char GetKey()
See Also:
getKey()

penMode

public static void penMode(int mode)
Sets the current transfer mode, used for drawing lines and painting shapes, to be one of the two constant flags patCopy or patXor.

The initial pen mode is patCopy.

Parameters:
mode - the specified painting mode
See Also:
patCopy, patXor

PenMode

public static void PenMode(int mode)
See Also:
penMode(int)

penSize

public static void penSize(int width,
                           int height)
Sets the dimensions of the rectangular pen, used for drawing lines and framed shapes.

The initial pen size is 1x1.

Parameters:
width - the new width for the pen
height - the new height for the pen

PenSize

public static void PenSize(int width,
                           int height)
See Also:
penSize(int, int)

penNormal

public static void penNormal()
Resets the initial state (mode and size) of the pen. The pen location is not changed.

See Also:
penMode(int), penSize(int, int)

PenNormal

public static void PenNormal()
See Also:
penNormal()

foreColor

public static void foreColor(java.awt.Color color)
Sets the current pen color, used for drawing lines or text and painting shapes, as specified by the given java.awt.Color object.

The initial pen color is as specified by java.awt.Color.black.

Parameters:
color - the Color object

foreColor

public static void foreColor(int color)
Sets the current pen color, used for drawing lines or text and painting shapes, as specified by one of the height constant flags : blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor or yellowColor.

The initial pen color is as specified by blackColor.

Parameters:
color - the specified color flag
See Also:
blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor, yellowColor

ForeColor

public static void ForeColor(int color)
See Also:
foreColor(int)

RGBForeColor

public static void RGBForeColor(RGBColor color)
Sets the current pen color, used for drawing lines or text and painting shapes, as specified by the given RGBColor object.

The initial pen color is as specified by new RGBColor(0,0,0).

Parameters:
color - the RGBColor object
See Also:
foreColor(java.awt.Color)

backColor

public static void backColor(java.awt.Color color)
Sets the current background color, used when erasing or inverting, as specified by the given java.awt.Color object.

The initial background color is as specified by java.awt.Color.white.

Parameters:
color - the Color object

backColor

public static void backColor(int color)
Sets the current background color, used when erasing or inverting, as specified by one of the height constant flags : blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor or yellowColor.

The initial background color is as specified by whiteColor.

Parameters:
color - the specified color flag
See Also:
blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor, yellowColor

BackColor

public static void BackColor(int color)
See Also:
backColor(int)

RGBBackColor

public static void RGBBackColor(RGBColor color)
Sets the current background color, used when erasing or inverting, as specified by the given RGBColor object.

The initial background color is as specified by new RGBColor(255,255,255).

Parameters:
color - the RGBColor object
See Also:
backColor(java.awt.Color)

getPen

public static void getPen(Point p)
Stores the current pen location (relative to the Drawing window) in the given point.

Parameters:
p - the Point object to be modified

GetPen

public static void GetPen(Point p)
See Also:
getPen(Point)

moveTo

public static void moveTo(int h,
                          int v)
Sets the coordinates of the pen (relative to the Drawing window) to the specified location.

No drawing is performed.

Parameters:
h - the horizontal coordinate of the new location
v - the vertical coordinate of the new location

MoveTo

public static void MoveTo(int h,
                          int v)
See Also:
moveTo(int, int)

move

public static void move(int dh,
                        int dv)
Translates the coordinates of the pen by the specified displacement vector.

No drawing is performed.

Parameters:
dh - the horizontal displacement
dv - the vertical displacement

Move

public static void Move(int dh,
                        int dv)
See Also:
move(int, int)

textFont

public void textFont(java.lang.String name)
Sets the name of the font used for drawing text. Some supported fonts are given by the followings constants : dialog, dialogInput, sansSerif, serif or monospaced.

The initial text font is as specified by serif.

Parameters:
the - name of the new font used for drawing text
See Also:
dialog, dialogInput, sansSerif, serif, monospaced

TextFont

public void TextFont(java.lang.String name)
See Also:
textFont(java.lang.String)

textSize

public void textSize(int size)
Sets the size of the font used for drawing text.

The initial text size is 12.

Parameters:
the - new size for drawing text

TextSize

public void TextSize(int size)
See Also:
textSize(int)

textFace

public void textFace(int face)
Sets the style of the font used for drawing text, it should be one of the followings constants : plain, bold, italic or bold+italic.

The initial text style is as specified by plain.

Parameters:
the - code of the new style for drawing text
See Also:
plain, bold, italic

TextFace

public void TextFace(int face)
See Also:
textFace(int)

getFontInfo

public FontInfo getFontInfo()
Returns the metric informations about the current font as a FontInfo object.

Returns:
the FontInfo object

GetFontInfo

public FontInfo GetFontInfo()
See Also:
getFontInfo()

line

public static void line(int dh,
                        int dv)
Draws a line from the current pen location to the location that is at distance of dh horizontally and dv vertically. The pen location becomes this new location.

Parameters:
dh - the horizontal displacement
dv - the vertical displacement
See Also:
penMode(int), penSize(int, int), foreColor(java.awt.Color)

Line

public static void Line(int dh,
                        int dv)
See Also:
line(int, int)

lineTo

public static void lineTo(int h,
                          int v)
Draws a line from the current pen location to the location that is specified by h and v (in coordinates relative to the Drawing window). The pen location becomes this new location.

Parameters:
h - the horizontal coordinate of the new location
v - the vertical coordinate of the new location
See Also:
penMode(int), penSize(int, int), foreColor(java.awt.Color)

LineTo

public static void LineTo(int h,
                          int v)
See Also:
lineTo(int, int)

drawLine

public static void drawLine(int x1,
                            int y1,
                            int x2,
                            int y2)
Draws a line from the location that is specified by x1 and y1 to the location that is specified by x2 and y2 (in coordinates relative to the Drawing window). The pen location becomes the second location.

Parameters:
x1 - the horizontal coordinate of the first location
y1 - the vertical coordinate of the first location
x2 - the horizontal coordinate of the second location
y2 - the vertical coordinate of the second location
See Also:
penMode(int), penSize(int, int), foreColor(java.awt.Color)

DrawLine

public static void DrawLine(int x1,
                            int y1,
                            int x2,
                            int y2)
See Also:
drawLine(int, int, int, int)

frameRect

public static void frameRect(Rect r)
Draws an outline just inside the specified rectangle. The pen location is not changed.

Parameters:
r - a Rect object that specifies the rectangle to be framed
See Also:
penMode(int), penSize(int, int), foreColor(java.awt.Color)

FrameRect

public static void FrameRect(Rect r)
See Also:
frameRect(Rect)

paintRect

public static void paintRect(Rect r)
Paints inside the specified rectangle.

Parameters:
r - a Rect object that specifies the rectangle to be painted
See Also:
penMode(int), foreColor(java.awt.Color)

PaintRect

public static void PaintRect(Rect r)
See Also:
paintRect(Rect)

eraseRect

public static void eraseRect(Rect r)
Paints inside the specified rectangle, using the background color.

Parameters:
r - a Rect object that specifies the rectangle to be erased
See Also:
backColor(java.awt.Color)

EraseRect

public static void EraseRect(Rect r)
See Also:
eraseRect(Rect)

invertRect

public static void invertRect(Rect r)
Inverts pixels inside the specified rectangle. Every white pixel becomes black and reciprocally. Pixels of other colors are changed in an undefined but reversible manner.

Parameters:
r - a Rect object that specifies the rectangle to be inverted

InvertRect

public static void InvertRect(Rect r)
See Also:
invertRect(Rect)

frameOval

public static void frameOval(Rect r)
Draws an outline just inside the oval that fits inside the specified rectangle. The pen location is not changed.

Parameters:
r - a Rect object that specifies the oval to be framed
See Also:
penMode(int), penSize(int, int), foreColor(java.awt.Color)

FrameOval

public static void FrameOval(Rect r)
See Also:
frameOval(Rect)

paintOval

public static void paintOval(Rect r)
Paints inside the oval that fits inside the specified rectangle.

Parameters:
r - a Rect object that specifies the oval to be painted
See Also:
penMode(int), foreColor(java.awt.Color)

PaintOval

public static void PaintOval(Rect r)
See Also:
paintOval(Rect)

eraseOval

public static void eraseOval(Rect r)
Paints inside the oval that fits inside the specified rectangle, using the background color.

Parameters:
r - a Rect object that specifies the oval to be erased
See Also:
backColor(java.awt.Color)

EraseOval

public static void EraseOval(Rect r)
See Also:
eraseOval(Rect)

invertOval

public static void invertOval(Rect r)
Inverts pixels inside the oval that fits inside the specified rectangle. Every white pixel becomes black and reciprocally. Pixels of other colors are changed in an undefined but reversible manner.

Parameters:
r - a Rect object that specifies the oval to be inverted

InvertOval

public static void InvertOval(Rect r)
See Also:
invertOval(Rect)

paintCircle

public static void paintCircle(int x,
                               int y,
                               int r)
Paints inside the specified circle.

Parameters:
x - the x coordinate of the center of the circle
y - the y coordinate of the center of the circle
r - the radius of the circle
See Also:
penMode(int), foreColor(java.awt.Color)

PaintCircle

public static void PaintCircle(int x,
                               int y,
                               int r)
See Also:
paintCircle(int, int, int)

invertCircle

public static void invertCircle(int x,
                                int y,
                                int r)
Inverts pixels inside the specified circle. Every white pixel becomes black and reciprocally. Pixels of other colors are changed in an undefined but reversible manner.

Parameters:
x - the x coordinate of the center of the circle
y - the y coordinate of the center of the circle
r - the radius of the circle

InvertCircle

public static void InvertCircle(int x,
                                int y,
                                int r)
See Also:
invertCircle(int, int, int)

frameRoundRect

public static void frameRoundRect(Rect r,
                                  int arcWidth,
                                  int arcHeight)
Draws an outline just inside the specified rounded-corner rectangle. The pen location is not changed.

Parameters:
r - a Rect object that specifies the shape to be framed
arcWidth - the horizontal diameter of curvature for the corners arcs
arcHeight - the vertical diameter of curvature for the corners arcs
See Also:
penMode(int), penSize(int, int), foreColor(java.awt.Color)

FrameRoundRect

public static void FrameRoundRect(Rect r,
                                  int arcWidth,
                                  int arcHeight)
See Also:
frameRoundRect(Rect, int, int)

paintRoundRect

public static void paintRoundRect(Rect r,
                                  int arcWidth,
                                  int arcHeight)
Paints inside the specified rounded-corner rectangle.

Parameters:
r - a Rect object that specifies the shape to be painted
arcWidth - the horizontal diameter of curvature for the corners arcs
arcHeight - the vertical diameter of curvature for the corners arcs
See Also:
penMode(int), foreColor(java.awt.Color)

PaintRoundRect

public static void PaintRoundRect(Rect r,
                                  int arcWidth,
                                  int arcHeight)
See Also:
paintRoundRect(Rect, int, int)

eraseRoundRect

public static void eraseRoundRect(Rect r,
                                  int arcWidth,
                                  int arcHeight)
Paints inside the specified rounded-corner rectangle, using the background color.

Parameters:
r - a Rect object that specifies the shape to be erased
arcWidth - the horizontal diameter of curvature for the corners arcs
arcHeight - the vertical diameter of curvature for the corners arcs
See Also:
backColor(java.awt.Color)

EraseRoundRect

public static void EraseRoundRect(Rect r,
                                  int arcWidth,
                                  int arcHeight)
See Also:
eraseRoundRect(Rect, int, int)

invertRoundRect

public static void invertRoundRect(Rect r,
                                   int arcWidth,
                                   int arcHeight)
Inverts pixels inside the specified rounded-corner rectangle. Every white pixel becomes black and reciprocally. Pixels of other colors are changed in an undefined but reversible manner.

Parameters:
r - a Rect object that specifies the shape to be inverted
arcWidth - the horizontal diameter of curvature for the corners arcs
arcHeight - the vertical diameter of curvature for the corners arcs

InvertRoundRect

public static void InvertRoundRect(Rect r,
                                   int arcWidth,
                                   int arcHeight)
See Also:
invertRoundRect(Rect, int, int)

frameArc

public static void frameArc(Rect r,
                            int startAngle,
                            int arcAngle)
Draws an arc of outline just inside the oval that fits inside the specified rectangle. The startAngle parameter indicates where the arc begins and is treated mod 360. The arcAngle parameters defines the extent of the arc. The angles are given in degrees. A positive angle goes clockwise. Zero degree is at l2 o'clock. The pen location is not changed.

Parameters:
r - a Rect object that specifies the shape to be framed
startAngle - indicates where the arc begins
arcAngle - defines the extent of the arc
See Also:
penMode(int), penSize(int, int), foreColor(java.awt.Color)

FrameArc

public static void FrameArc(Rect r,
                            int startAngle,
                            int arcAngle)
See Also:
frameArc(Rect, int, int)

paintArc

public static void paintArc(Rect r,
                            int startAngle,
                            int arcAngle)
Paints inside a wedge of the oval that fits inside the specified rectangle. The startAngle parameter indicates where the arc begins and is treated mod 360. The arcAngle parameters defines the extent of the arc. The angles are given in degrees. A positive angle goes clockwise. Zero degree is at l2 o'clock.

Parameters:
r - a Rect object that specifies the shape to be painted
startAngle - indicates where the arc begins
arcAngle - defines the extent of the arc
See Also:
penMode(int), foreColor(java.awt.Color)

PaintArc

public static void PaintArc(Rect r,
                            int startAngle,
                            int arcAngle)
See Also:
paintArc(Rect, int, int)

eraseArc

public static void eraseArc(Rect r,
                            int startAngle,
                            int arcAngle)
Paints inside a wedge of the oval that fits inside the specified rectangle, using the background color. The startAngle parameter indicates where the arc begins and is treated mod 360. The arcAngle parameters defines the extent of the arc. The angles are given in degrees. A positive angle goes clockwise. Zero degree is at l2 o'clock.

Parameters:
r - a Rect object that specifies the shape to be erased
startAngle - indicates where the arc begins
arcAngle - defines the extent of the arc
See Also:
backColor(java.awt.Color)

EraseArc

public static void EraseArc(Rect r,
                            int startAngle,
                            int arcAngle)
See Also:
eraseArc(Rect, int, int)

invertArc

public static void invertArc(Rect r,
                             int startAngle,
                             int arcAngle)
Inverts pixels inside a wedge of the oval that fits inside the specified rectangle. Every white pixel becomes black and reciprocally. Pixels of other colors are changed in an undefined but reversible manner. The startAngle parameter indicates where the arc begins and is treated mod 360. The arcAngle parameters defines the extent of the arc. The angles are given in degrees. A positive angle goes clockwise. Zero degree is at l2 o'clock.

Parameters:
r - a Rect object that specifies the shape to be inverted
startAngle - indicates where the arc begins
arcAngle - defines the extent of the arc

InvertArc

public static void InvertArc(Rect r,
                             int startAngle,
                             int arcAngle)
See Also:
invertArc(Rect, int, int)

framePolygon

public static void framePolygon(Point[] points,
                                int pCount)
Draws an outline of the specified polygon.

Parameters:
points - an array of the Point objects that specify the polygon to be framed
pCount - the number of points
See Also:
newPointArray(int), penMode(int), penSize(int, int), foreColor(java.awt.Color)

FramePolygon

public static void FramePolygon(Point[] points,
                                int pCount)
See Also:
framePolygon(Point[], int)

paintPolygon

public static void paintPolygon(Point[] points,
                                int pCount)
Paints inside the specified polygon. The area inside the polygon is defined using the even-odd fill rule.

Parameters:
points - an array of the Point objects that specify the polygon to be painted
pCount - the number of points
See Also:
newPointArray(int), penMode(int), foreColor(java.awt.Color)

PaintPolygon

public static void PaintPolygon(Point[] points,
                                int pCount)
See Also:
paintPolygon(Point[], int)

erasePolygon

public static void erasePolygon(Point[] points,
                                int pCount)
Paints inside the specified polygon, using the background color. The area inside the polygon is defined using the even-odd fill rule.

Parameters:
points - an array of the Point objects that specify the polygon to be erased
pCount - the number of points
See Also:
newPointArray(int), backColor(java.awt.Color)

ErasePolygon

public static void ErasePolygon(Point[] points,
                                int pCount)
See Also:
erasePolygon(Point[], int)

invertPolygon

public static void invertPolygon(Point[] points,
                                 int pCount)
Inverts pixels inside the specified polygon. The area inside the polygon is defined using the even-odd fill rule. Every white pixel becomes black and reciprocally. Pixels of other colors are changed in an undefined but reversible manner.

Parameters:
points - an array of the Point objects that specify the polygon to be inverted
pCount - the number of points
See Also:
newPointArray(int)

InvertPolygon

public static void InvertPolygon(Point[] points,
                                 int pCount)
See Also:
invertPolygon(Point[], int)

stringWidth

public static int stringWidth(java.lang.String s)
Returns the width in pixels of the given text string. This value is added to the pen horizontal coordinate when the string is drawn.

Parameters:
s - the string to be measured
Returns:
the width of the given string
See Also:
drawString(java.lang.String)

StringWidth

public static int StringWidth(java.lang.String s)
See Also:
stringWidth(java.lang.String)

textWidth

public static int textWidth(char[] textBuf,
                            int firstByte,
                            int byteCount)
Returns the width in pixels of the specified text. This value is added to the pen horizontal coordinate when the specified text is drawn.

Parameters:
textBuf - the array of characters that stores the text
firstByte - indicates where the measured text begins
byteCount - indicates the number of characters to be measured
Returns:
the width of the specified text
See Also:
drawText(char[], int, int)

TextWidth

public static int TextWidth(char[] textBuf,
                            int firstByte,
                            int byteCount)
See Also:
textWidth(char[], int, int)

charWidth

public static int charWidth(char c)
Returns the width in pixels of the given character. This value is added to the pen horizontal coordinate when the char is drawn.

Parameters:
c - the character to be measured
Returns:
the width of the given character
See Also:
drawChar(char)

CharWidth

public static int CharWidth(char c)
See Also:
charWidth(char)

drawString

public static void drawString(java.lang.String s)
Draws the given text string. The string is placed beginning at the current pen location and extending to the right. The pen location ends up to the right of the last character in the string.

Parameters:
s - the string to be drawn
See Also:
moveTo(int, int), foreColor(java.awt.Color), textFont(java.lang.String), textSize(int), textFace(int)

DrawString

public static void DrawString(java.lang.String s)
See Also:
drawString(java.lang.String)

drawText

public static void drawText(char[] textBuf,
                            int firstByte,
                            int byteCount)
Draws the specified text. The text is placed beginning at the current pen location and extending to the right. The pen location ends up to the right of the last character in the string.

Parameters:
textBuf - the array of characters that stores the text
firstByte - indicates where the drawn text begins
byteCount - indicates the number of characters to be drawn
See Also:
moveTo(int, int), foreColor(java.awt.Color), textFont(java.lang.String), textSize(int), textFace(int)

DrawText

public static void DrawText(char[] textBuf,
                            int firstByte,
                            int byteCount)
See Also:
drawText(char[], int, int)

drawChar

public static void drawChar(char c)
Draws the given character. The char is placed beginning at the current pen location and extending to the right. The pen location ends up to the right of the character.

Parameters:
c - the character to be drawn
See Also:
moveTo(int, int), foreColor(java.awt.Color), textFont(java.lang.String), textSize(int), textFace(int)

DrawChar

public static void DrawChar(char c)
See Also:
drawChar(char)

drawImage

public boolean drawImage(java.awt.Image img)
Draws the given image, starting at location (0,0).

Parameters:
img - the Image object to be drawn
Returns:
true if the image has been completely drawn.
See Also:
Graphics.drawImage(Image, int, int, ImageObserver)

tickCount

public static long tickCount()
Returns the current number of ticks (sixtieths of a second) since midnight, January 1, 1970 UTC.

Returns:
the number of ticks

TickCount

public static long TickCount()
See Also:
tickCount()

delay

public static void delay(long numTicks)
Causes the current thread to sleep approximately for the number of ticks (sixtieths of a second) specified by numTicks.

Parameters:
numTicks - the number of ticks to sleep

Delay

public static void Delay(long numTicks)
See Also:
delay(long)

sysBeep

public static void sysBeep(int duration)
Causes the system to beep

Parameters:
duration - actually without any effect

SysBeep

public static void SysBeep(int duration)
See Also:
sysBeep(int)

hiWord

public static short hiWord(int value)
Returns the short integer value corresponding to the 16 most significant bits of the given 32 bits integer.

Parameters:
value - the given 32 bits integer
Returns:
the 16 most significant bits, as a short value
See Also:
loWord(int)

HiWord

public static short HiWord(int value)
See Also:
hiWord(int)

loWord

public static short loWord(int value)
Returns the short integer value corresponding to the 16 least significant bits of the given 32 bits integer.

Parameters:
value - the given 32 bits integer
Returns:
the 16 least significant bits, as a short value
See Also:
hiWord(int)

LoWord

public static short LoWord(int value)
See Also:
loWord(int)

random

public static short random()
Returns a pseudo-random, uniformly distributed, integer value in the range from -32768 through 32767.

The returned value depends on the global variable randSeed. Each call to random() updates this variable.

Returns:
a pseudo-random short value
See Also:
randSeed

Random

public static short Random()
See Also:
random()