|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uwcse.graphics.GWindow | +--InfiniteCanvas | +--BorderedInfiniteCanvas
A BorderedInfiniteCanvas
provides an infinitely
extending X Canvas
that includes borders on the left and bottom.
Unknowing clients of this see a GWindow that occupies only part of
an actual GWindow (bordered space), and paint in infinite canvas
coordinates (unlimited x).
Knowing clients can paint items into the border
if they like (unbordered space) and do so in GWindow space (limited x).
Constructor Summary | |
BorderedInfiniteCanvas(java.lang.String name,
int width,
int height)
Constructs using default left and bottom border size. |
|
BorderedInfiniteCanvas(java.lang.String name,
int width,
int height,
int leftBorderSz,
int bottomBorderSz)
Constructs as above, but also using specified border sizes. |
Method Summary | |
boolean |
add(uwcse.graphics.Shape s)
Adds the specified into the bordered space |
protected boolean |
addToBorderedSpace(uwcse.graphics.Shape s)
Adds given shape to enclosed bordered space. |
boolean |
addToUnborderedSpace(uwcse.graphics.Shape s)
Adds the given shape to the set of shapes drawn in the borders. |
void |
cleanBorders()
Wipes clean anything in the borders and refills with current color. |
protected void |
clearBorders()
Wipes clean anything in the borders. |
uwcse.graphics.Line |
drawBottomBorder()
Draws the bottom border on the screen. |
uwcse.graphics.Line |
drawLeftBorder()
Draws the left border on the screen. |
protected void |
fillBorders()
Fills the borders according to the current border color. |
protected void |
fillBorders(java.awt.Color c)
Fills the borders according to the given color. |
int |
getBottomBorderWidth()
Gets the size of the bottom border. |
int |
getLeftBorderWidth()
Gets the size of the left border. |
protected int |
getOriginX()
Computes the x position of the logical origin of the GWindow along x. |
protected int |
getUnborderedWindowHeight()
Finds the true window height, accounting for borders. |
protected int |
getUnborderedWindowWidth()
Finds the true window width, accounting for borders. |
int |
getWindowHeight()
Gets the window height not counting the bottom bordered space. |
int |
getWindowWidth()
Gets the window width not counting the left bordered space. |
protected boolean |
insideBottomBorder(int y)
Determines if a given y value is in the bottom border |
protected boolean |
insideLeftBorder(int x)
Determines if a given x value is in the left hand border |
void |
moveAllBy(int x,
int y)
Moves to a position in bordered infinite /** Moves all of the items in bordered space while leaving unbordered space untouched. |
protected void |
moveBordersBy(int x,
int y)
Adjusts the position of the borders and their contents. |
protected boolean |
outsideBorderedSpace(int x,
int y)
Determines if a given position is beyond the borders. |
boolean |
remove(uwcse.graphics.Shape s)
|
boolean |
removeFromUnborderedSpace(uwcse.graphics.Shape s)
Removes a given shape which has been draw in the borders. |
Methods inherited from class InfiniteCanvas |
addToWindow, fixLabel, getLeftHandX, setLeftHandX, useColumnarLayout |
Methods inherited from class uwcse.graphics.GWindow |
addEventHandler, display, dispose, doRepaint, erase, getEventHandler, getImage, getImage, getImageFromFilename, getImageFromURL, intersects, main, print, resumeRepaints, setExitOnClose, showColorTable, startTimerEvents, stopTimerEvents, suspendRepaints, toString, version |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BorderedInfiniteCanvas(java.lang.String name, int width, int height)
name
- canvas namewidth
- width of canvas in pixelsheight
- of canvas in pixelspublic BorderedInfiniteCanvas(java.lang.String name, int width, int height, int leftBorderSz, int bottomBorderSz)
name
- canvas namewidth
- width of canvas in pixelsheight
- of canvas in pixelsleftBorderSz
- size of left borderbottomBorderSz
- size of right borderMethod Detail |
public boolean add(uwcse.graphics.Shape s)
add
in class InfiniteCanvas
s
- shape to be added (in infinite canvas coordinates)
true
if successful, false
otherwise.public void moveAllBy(int x, int y)
moveAllBy
in class uwcse.graphics.GWindow
public boolean remove(uwcse.graphics.Shape s)
remove
in class uwcse.graphics.GWindow
public int getWindowWidth()
getWindowWidth
in class uwcse.graphics.GWindow
public int getWindowHeight()
getWindowHeight
in class uwcse.graphics.GWindow
protected int getUnborderedWindowWidth()
protected int getUnborderedWindowHeight()
public int getLeftBorderWidth()
protected int getOriginX()
InfiniteCanvas
getOriginX
in class InfiniteCanvas
public int getBottomBorderWidth()
protected boolean outsideBorderedSpace(int x, int y)
x
- position (in infinite coordinates)y
- position
true
if beyond the bordersprotected boolean insideLeftBorder(int x)
x
- position (in infinite coordinates)
true
if in left border.protected boolean insideBottomBorder(int y)
y
- position (in infinite coordinates)
true
if in bottom border.public uwcse.graphics.Line drawLeftBorder()
public uwcse.graphics.Line drawBottomBorder()
public boolean addToUnborderedSpace(uwcse.graphics.Shape s)
s
- the shape
true
if the shape could be added.public boolean removeFromUnborderedSpace(uwcse.graphics.Shape s)
s
- shape
true
if the shape could be removed.protected boolean addToBorderedSpace(uwcse.graphics.Shape s)
s
- shape to be added, expressed in infinite coordinates.
true
if successful.protected void fillBorders()
protected void fillBorders(java.awt.Color c)
c
- color to fill with, becomes default color for next fill.public void cleanBorders()
protected void clearBorders()
protected void moveBordersBy(int x, int y)
x
- amount to move in the x directiony
- amount to move in the y direction
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |