|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaclib.MacLib
public class MacLib
The class MacLib
implements QuickDraw-like drawing and
event routines.
It is mostly a static wrapper around a GrafPort
object.
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 Point Point 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 |
---|
public static final int patCopy
penMode(int)
,
Constant Field Valuespublic static final int patXor
penMode(int)
,
Constant Field Valuespublic static final int blackColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final int whiteColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final int redColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final int greenColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final int blueColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final int cyanColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final int magentaColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final int yellowColor
foreColor(int)
,
backColor(int)
,
Constant Field Valuespublic static final java.lang.String dialog
textFont(String)
,
Constant Field Valuespublic static final java.lang.String dialogInput
textFont(String)
,
Constant Field Valuespublic static final java.lang.String sansSerif
textFont(String)
,
Constant Field Valuespublic static final java.lang.String serif
textFont(String)
,
Constant Field Valuespublic static final java.lang.String monospaced
textFont(String)
,
Constant Field Valuespublic static final int plain
textFace(int)
,
Constant Field Valuespublic static final int bold
textFace(int)
,
Constant Field Valuespublic static final int italic
textFace(int)
,
Constant Field Valuespublic static final int none
buttonState()
,
Constant Field Valuespublic static final int shift
buttonState()
,
Constant Field Valuespublic static final int control
buttonState()
,
Constant Field Valuespublic static final int meta
buttonState()
,
Constant Field Valuespublic static int randSeed
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.
random()
,
initQuickDraw()
Method Detail |
---|
public static void setPt(Point p, int h, int v)
p
- the Point
object to be modifiedh
- the h coordinate of the new locationv
- the v coordinate of the new locationpublic static void SetPt(Point p, int h, int v)
setPt(Point, int, int)
public static void addPt(Point src, Point dst)
src
to the coordinates of point dst
.
src
- the Point
object used as a vector to
specify the displacementdst
- the Point
object to be modifiedpublic static void AddPt(Point src, Point dst)
addPt(Point, Point)
public static void subPt(Point src, Point dst)
src
from the coordinates of point dst
.
src
- the Point
object used as a vector to
specify the displacementdst
- the Point
object to be modifiedpublic static void SubPt(Point src, Point dst)
subPt(Point, Point)
public static boolean equalPt(Point p1, Point p2)
p1
- the first Point
objectp2
- the second Point
object to compare with
true
if both points have same coordinates;
false
otherwisepublic static boolean EqualPt(Point p1, Point p2)
equalPt(Point, Point)
public static Point[] newPointArray(int pCount)
pCount
- the number of wanted Point
objects
pCount
new Point
objectsframePolygon(Point[], int)
,
paintPolygon(Point[], int)
,
erasePolygon(Point[], int)
,
invertPolygon(Point[], int)
public static void setRect(Rect r, int left, int top, int right, int bottom)
r
- the Rect
object to be modifiedleft
- the new left coordinatetop
- the new top coordinateright
- the new right coordinatebottom
- the new bottom coordinatepublic static void SetRect(Rect r, int left, int top, int right, int bottom)
setRect(Rect, int, int, int, int)
public static void pt2Rect(Point p1, Point p2, Rect dst)
p1
- the first Point
object used to specify
the coordinatesp2
- the second Point
object used to specify
the coordinatesdst
- the Rect
object to be modifiedpublic static void Pt2Rect(Point p1, Point p2, Rect dst)
pt2Rect(Point, Point, Rect)
public static void offsetRect(Rect r, int dh, int dv)
dh
to each horizontal coordinate and dv
to each vertical coordinate.
r
- the Rect
object to be modifieddh
- the horizontal displacementdv
- the vertical displacementpublic static void OffsetRect(Rect r, int dh, int dv)
offsetRect(Rect, int, int)
public static void insetRect(Rect r, int dh, int dv)
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.
r
- the Rect
object to be modifieddh
- the horizontal displacementdv
- the vertical displacementpublic static void InsetRect(Rect r, int dh, int dv)
insetRect(Rect, int, int)
public static void unionRect(Rect src1, Rect src2, Rect dst)
src1
- the first Rect
object used to specify the
coordinatessrc2
- the second Rect
object used to specify the
coordinatesdst
- the Rect
object to be modifiedpublic static void UnionRect(Rect src1, Rect src2, Rect dst)
unionRect(Rect, Rect, Rect)
public static boolean equalRect(Rect r1, Rect r2)
r1
- the first Rect
objectr2
- the second Rect
object to compare with
true
if both rectangles have same coordinates;
false
otherwisepublic static boolean EqualRect(Rect r1, Rect r2)
equalRect(Rect, Rect)
public static boolean sectRect(Rect src1, Rect src2, Rect dst)
(0,0,0,0)
.
src1
- the first Rect
object used to specify the
coordinatessrc2
- the second Rect
object used to specify the
coordinatesdst
- the Rect
object to be modified
true
if the two rectangles really intersect;
false
otherwisepublic static boolean SectRect(Rect src1, Rect src2, Rect dst)
sectRect(Rect, Rect, Rect)
public static boolean ptInRect(Point pt, Rect r)
pt
- the Point
objectr
- the Rect
object to check with
true
if so; false
otherwisepublic static boolean PtInRect(Point pt, Rect r)
ptInRect(Point, Rect)
public static boolean emptyRect(Rect r)
r
- the Rect
object
true
if so; false
otherwisepublic static boolean EmptyRect(Rect r)
emptyRect(Rect)
public static void initQuickDraw()
initQuickDraw(GrafPort)
public static void InitQuickDraw()
initQuickDraw()
public static void initQuickDraw(GrafPort port)
port
- a GrafPort
objectinitQuickDraw()
public static void dispose()
GrafPort
and associated objects.
public static void setPort(GrafPort port)
GrafPort
as the current Drawing window,
but doesn't reset it.
port
- a GrafPort
objectinitQuickDraw(GrafPort)
,
getPort()
public static void SetPort(GrafPort port)
setPort(GrafPort)
public static GrafPort getPort()
GrafPort
for the current Drawing window.
GrafPort
objectsetPort(GrafPort)
public static GrafPort GetPort()
getPort()
public static void setText(java.awt.Frame frame)
frame
- a Frame objectpublic static void setDrawingRect(Rect r)
r
- a Rect
object that specifies the new
screen coordinatespublic static void SetDrawingRect(Rect r)
setDrawingRect(Rect)
public static void setTextRect(Rect r)
r
- a Rect
object that specifies the new
screen coordinatespublic static void SetTextRect(Rect r)
setTextRect(Rect)
public static void getDrawingRect(Rect r)
r
- a Rect
object filled with the screen
coordinatespublic static void GetDrawingRect(Rect r)
getDrawingRect(Rect)
public static void getTextRect(Rect r)
r
- a Rect
object filled with the screen
coordinatespublic static void GetTextRect(Rect r)
getTextRect(Rect)
public static void showDrawing()
public static void ShowDrawing()
showDrawing()
public static void showText()
public static void ShowText()
showText()
public static void hideAll()
public static void HideAll()
hideAll()
public static boolean button()
true
if the button is currently down after
being pressed in the Drawing window;
false
otherwisepublic static boolean Button()
button()
public static void waitClickDown()
public static void WaitClickDown()
waitClickDown()
public static void waitClickUp()
public static void WaitClickUp()
waitClickUp()
public static void getMouse(Point p)
Point
Point object.
p
- the Point
object to be modifiedpublic static void GetMouse(Point p)
getMouse(Point)
public static void getClick(Point p)
p
- the Point
object to be modifiedpublic static void GetClick(Point p)
getClick(Point)
public static boolean trackMouse(Point p)
p
- the Point
object to be modifiedpublic static boolean TrackMouse(Point p)
trackMouse(Point)
public static int buttonState()
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.
int
valuenone
,
shift
,
control
,
meta
public static int ButtonState()
buttonState()
public static boolean keyPressed()
true
if any char available;
false
otherwisepublic static boolean KeyPressed()
keyPressed()
public static char getKey()
public static char GetKey()
getKey()
public static void penMode(int mode)
patCopy
or patXor
.
The initial pen mode is patCopy
.
mode
- the specified painting modepatCopy
,
patXor
public static void PenMode(int mode)
penMode(int)
public static void penSize(int width, int height)
The initial pen size is 1x1
.
width
- the new width for the penheight
- the new height for the penpublic static void PenSize(int width, int height)
penSize(int, int)
public static void penNormal()
penMode(int)
,
penSize(int, int)
public static void PenNormal()
penNormal()
public static void foreColor(java.awt.Color color)
java.awt.Color
object.
The initial pen color is as specified by
java.awt.Color.black
.
color
- the Color
objectpublic static void foreColor(int color)
blackColor
,
whiteColor
,
redColor
,
greenColor
,
blueColor
,
cyanColor
,
magentaColor
or
yellowColor
.
The initial pen color is as specified by blackColor
.
color
- the specified color flagblackColor
,
whiteColor
,
redColor
,
greenColor
,
blueColor
,
cyanColor
,
magentaColor
,
yellowColor
public static void ForeColor(int color)
foreColor(int)
public static void RGBForeColor(RGBColor color)
RGBColor
object.
The initial pen color is as specified by
new RGBColor(0,0,0)
.
color
- the RGBColor
objectforeColor(java.awt.Color)
public static void backColor(java.awt.Color color)
java.awt.Color
object.
The initial background color is as specified by
java.awt.Color.white
.
color
- the Color
objectpublic static void backColor(int color)
blackColor
,
whiteColor
,
redColor
,
greenColor
,
blueColor
,
cyanColor
,
magentaColor
or
yellowColor
.
The initial background color is as specified by
whiteColor
.
color
- the specified color flagblackColor
,
whiteColor
,
redColor
,
greenColor
,
blueColor
,
cyanColor
,
magentaColor
,
yellowColor
public static void BackColor(int color)
backColor(int)
public static void RGBBackColor(RGBColor color)
RGBColor
object.
The initial background color is as specified by
new RGBColor(255,255,255)
.
color
- the RGBColor
objectbackColor(java.awt.Color)
public static void getPen(Point p)
p
- the Point
object to be modifiedpublic static void GetPen(Point p)
getPen(Point)
public static void moveTo(int h, int v)
No drawing is performed.
h
- the horizontal coordinate of the new locationv
- the vertical coordinate of the new locationpublic static void MoveTo(int h, int v)
moveTo(int, int)
public static void move(int dh, int dv)
No drawing is performed.
dh
- the horizontal displacementdv
- the vertical displacementpublic static void Move(int dh, int dv)
move(int, int)
public void textFont(java.lang.String name)
dialog
,
dialogInput
,
sansSerif
,
serif
or
monospaced
.
The initial text font is as specified by serif
.
the
- name of the new font used for drawing textdialog
,
dialogInput
,
sansSerif
,
serif
,
monospaced
public void TextFont(java.lang.String name)
textFont(java.lang.String)
public void textSize(int size)
The initial text size is 12
.
the
- new size for drawing textpublic void TextSize(int size)
textSize(int)
public void textFace(int face)
plain
,
bold
,
italic
or
bold+italic
.
The initial text style is as specified by plain
.
the
- code of the new style for drawing textplain
,
bold
,
italic
public void TextFace(int face)
textFace(int)
public FontInfo getFontInfo()
FontInfo
object.
FontInfo
objectpublic FontInfo GetFontInfo()
getFontInfo()
public static void line(int dh, int dv)
dh
- the horizontal displacementdv
- the vertical displacementpenMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void Line(int dh, int dv)
line(int, int)
public static void lineTo(int h, int v)
h
- the horizontal coordinate of the new locationv
- the vertical coordinate of the new locationpenMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void LineTo(int h, int v)
lineTo(int, int)
public static void drawLine(int x1, int y1, int x2, int y2)
x1
- the horizontal coordinate of the first locationy1
- the vertical coordinate of the first locationx2
- the horizontal coordinate of the second locationy2
- the vertical coordinate of the second locationpenMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void DrawLine(int x1, int y1, int x2, int y2)
drawLine(int, int, int, int)
public static void frameRect(Rect r)
r
- a Rect
object that specifies
the rectangle to be framedpenMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void FrameRect(Rect r)
frameRect(Rect)
public static void paintRect(Rect r)
r
- a Rect
object that specifies
the rectangle to be paintedpenMode(int)
,
foreColor(java.awt.Color)
public static void PaintRect(Rect r)
paintRect(Rect)
public static void eraseRect(Rect r)
r
- a Rect
object that specifies
the rectangle to be erasedbackColor(java.awt.Color)
public static void EraseRect(Rect r)
eraseRect(Rect)
public static void invertRect(Rect r)
r
- a Rect
object that specifies
the rectangle to be invertedpublic static void InvertRect(Rect r)
invertRect(Rect)
public static void frameOval(Rect r)
r
- a Rect
object that specifies
the oval to be framedpenMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void FrameOval(Rect r)
frameOval(Rect)
public static void paintOval(Rect r)
r
- a Rect
object that specifies
the oval to be paintedpenMode(int)
,
foreColor(java.awt.Color)
public static void PaintOval(Rect r)
paintOval(Rect)
public static void eraseOval(Rect r)
r
- a Rect
object that specifies
the oval to be erasedbackColor(java.awt.Color)
public static void EraseOval(Rect r)
eraseOval(Rect)
public static void invertOval(Rect r)
r
- a Rect
object that specifies
the oval to be invertedpublic static void InvertOval(Rect r)
invertOval(Rect)
public static void paintCircle(int x, int y, int r)
x
- the x coordinate of the center of the circley
- the y coordinate of the center of the circler
- the radius of the circlepenMode(int)
,
foreColor(java.awt.Color)
public static void PaintCircle(int x, int y, int r)
paintCircle(int, int, int)
public static void invertCircle(int x, int y, int r)
x
- the x coordinate of the center of the circley
- the y coordinate of the center of the circler
- the radius of the circlepublic static void InvertCircle(int x, int y, int r)
invertCircle(int, int, int)
public static void frameRoundRect(Rect r, int arcWidth, int arcHeight)
r
- a Rect
object that specifies
the shape to be framedarcWidth
- the horizontal diameter of curvature for the
corners arcsarcHeight
- the vertical diameter of curvature for the
corners arcspenMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void FrameRoundRect(Rect r, int arcWidth, int arcHeight)
frameRoundRect(Rect, int, int)
public static void paintRoundRect(Rect r, int arcWidth, int arcHeight)
r
- a Rect
object that specifies
the shape to be paintedarcWidth
- the horizontal diameter of curvature for the
corners arcsarcHeight
- the vertical diameter of curvature for the
corners arcspenMode(int)
,
foreColor(java.awt.Color)
public static void PaintRoundRect(Rect r, int arcWidth, int arcHeight)
paintRoundRect(Rect, int, int)
public static void eraseRoundRect(Rect r, int arcWidth, int arcHeight)
r
- a Rect
object that specifies
the shape to be erasedarcWidth
- the horizontal diameter of curvature for the
corners arcsarcHeight
- the vertical diameter of curvature for the
corners arcsbackColor(java.awt.Color)
public static void EraseRoundRect(Rect r, int arcWidth, int arcHeight)
eraseRoundRect(Rect, int, int)
public static void invertRoundRect(Rect r, int arcWidth, int arcHeight)
r
- a Rect
object that specifies
the shape to be invertedarcWidth
- the horizontal diameter of curvature for the
corners arcsarcHeight
- the vertical diameter of curvature for the
corners arcspublic static void InvertRoundRect(Rect r, int arcWidth, int arcHeight)
invertRoundRect(Rect, int, int)
public static void frameArc(Rect r, int startAngle, int arcAngle)
r
- a Rect
object that specifies
the shape to be framedstartAngle
- indicates where the arc beginsarcAngle
- defines the extent of the arcpenMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void FrameArc(Rect r, int startAngle, int arcAngle)
frameArc(Rect, int, int)
public static void paintArc(Rect r, int startAngle, int arcAngle)
r
- a Rect
object that specifies
the shape to be paintedstartAngle
- indicates where the arc beginsarcAngle
- defines the extent of the arcpenMode(int)
,
foreColor(java.awt.Color)
public static void PaintArc(Rect r, int startAngle, int arcAngle)
paintArc(Rect, int, int)
public static void eraseArc(Rect r, int startAngle, int arcAngle)
r
- a Rect
object that specifies
the shape to be erasedstartAngle
- indicates where the arc beginsarcAngle
- defines the extent of the arcbackColor(java.awt.Color)
public static void EraseArc(Rect r, int startAngle, int arcAngle)
eraseArc(Rect, int, int)
public static void invertArc(Rect r, int startAngle, int arcAngle)
r
- a Rect
object that specifies
the shape to be invertedstartAngle
- indicates where the arc beginsarcAngle
- defines the extent of the arcpublic static void InvertArc(Rect r, int startAngle, int arcAngle)
invertArc(Rect, int, int)
public static void framePolygon(Point[] points, int pCount)
points
- an array of the Point
objects that
specify the polygon to be framedpCount
- the number of pointsnewPointArray(int)
,
penMode(int)
,
penSize(int, int)
,
foreColor(java.awt.Color)
public static void FramePolygon(Point[] points, int pCount)
framePolygon(Point[], int)
public static void paintPolygon(Point[] points, int pCount)
points
- an array of the Point
objects that
specify the polygon to be paintedpCount
- the number of pointsnewPointArray(int)
,
penMode(int)
,
foreColor(java.awt.Color)
public static void PaintPolygon(Point[] points, int pCount)
paintPolygon(Point[], int)
public static void erasePolygon(Point[] points, int pCount)
points
- an array of the Point
objects that
specify the polygon to be erasedpCount
- the number of pointsnewPointArray(int)
,
backColor(java.awt.Color)
public static void ErasePolygon(Point[] points, int pCount)
erasePolygon(Point[], int)
public static void invertPolygon(Point[] points, int pCount)
points
- an array of the Point
objects that
specify the polygon to be invertedpCount
- the number of pointsnewPointArray(int)
public static void InvertPolygon(Point[] points, int pCount)
invertPolygon(Point[], int)
public static int stringWidth(java.lang.String s)
s
- the string to be measured
drawString(java.lang.String)
public static int StringWidth(java.lang.String s)
stringWidth(java.lang.String)
public static int textWidth(char[] textBuf, int firstByte, int byteCount)
textBuf
- the array of characters that stores the textfirstByte
- indicates where the measured text beginsbyteCount
- indicates the number of characters to be measured
drawText(char[], int, int)
public static int TextWidth(char[] textBuf, int firstByte, int byteCount)
textWidth(char[], int, int)
public static int charWidth(char c)
c
- the character to be measured
drawChar(char)
public static int CharWidth(char c)
charWidth(char)
public static void drawString(java.lang.String s)
s
- the string to be drawnmoveTo(int, int)
,
foreColor(java.awt.Color)
,
textFont(java.lang.String)
,
textSize(int)
,
textFace(int)
public static void DrawString(java.lang.String s)
drawString(java.lang.String)
public static void drawText(char[] textBuf, int firstByte, int byteCount)
textBuf
- the array of characters that stores the textfirstByte
- indicates where the drawn text beginsbyteCount
- indicates the number of characters to be drawnmoveTo(int, int)
,
foreColor(java.awt.Color)
,
textFont(java.lang.String)
,
textSize(int)
,
textFace(int)
public static void DrawText(char[] textBuf, int firstByte, int byteCount)
drawText(char[], int, int)
public static void drawChar(char c)
c
- the character to be drawnmoveTo(int, int)
,
foreColor(java.awt.Color)
,
textFont(java.lang.String)
,
textSize(int)
,
textFace(int)
public static void DrawChar(char c)
drawChar(char)
public boolean drawImage(java.awt.Image img)
(0,0)
.
img
- the Image
object to be drawn
true
if the image has been completely drawn.Graphics.drawImage(Image, int, int, ImageObserver)
public static long tickCount()
public static long TickCount()
tickCount()
public static void delay(long numTicks)
numTicks
- the number of ticks to sleeppublic static void Delay(long numTicks)
delay(long)
public static void sysBeep(int duration)
duration
- actually without any effectpublic static void SysBeep(int duration)
sysBeep(int)
public static short hiWord(int value)
short
integer value corresponding to the
16 most significant bits of the given 32 bits integer.
value
- the given 32 bits integer
short
valueloWord(int)
public static short HiWord(int value)
hiWord(int)
public static short loWord(int value)
short
integer value corresponding to the
16 least significant bits of the given 32 bits integer.
value
- the given 32 bits integer
short
valuehiWord(int)
public static short LoWord(int value)
loWord(int)
public static short random()
-32768
through 32767
.
The returned value depends on the global variable
randSeed
. Each call to random()
updates
this variable.
short
valuerandSeed
public static short Random()
random()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |