public class TextGrid extends AbstractBox implements Cloneable, Resizable, ActionListener
AbstractBox
that displays a grid
of single characters. It is used in activities like crosswords and scrambled letters.Rectangle2D.Double, Rectangle2D.Float
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CELL_SIZE |
static int |
HIDDEN |
static int |
INVERTED |
static int |
LOCKED |
static int |
MARKED |
static int |
MIN_CELL_SIZE |
static int |
MIN_INTERNAL_MARGIN |
static int |
NORMAL |
static int |
TRANSPARENT |
char |
wild |
border, shape, specialShape
height, width, x, y
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
TextGrid(AbstractBox parent,
JComponent container,
double setX,
double setY,
int setNcw,
int setNch,
double setCellW,
double setCellH,
BoxBase boxBase,
boolean setBorder)
Creates new TextGridBox
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent ev) |
protected void |
blink(int status) |
Object |
clone() |
int |
countCharsLike(char ch) |
int |
countCoincidences(boolean checkCase) |
static TextGrid |
createEmptyGrid(AbstractBox parent,
JComponent container,
double setX,
double setY,
TextGridContent tgc,
boolean wildTransparent) |
void |
end() |
void |
finalize() |
Point |
findFreeCell(Point from,
int dx,
int dy) |
Point |
findNextCellWithAttr(int startX,
int startY,
int attr,
int dx,
int dy,
boolean attrState) |
boolean |
getCellAttribute(int px,
int py,
int attribute) |
Rectangle |
getCellBorderBounds(int px,
int py) |
Rectangle2D |
getCellRect(int px,
int py) |
char |
getCharAt(int px,
int py) |
Point |
getCursor() |
Point |
getItemFor(int rx,
int ry) |
Point |
getLogicalCoords(Point2D devicePoint) |
Dimension |
getMinimumSize() |
int |
getNumCells() |
Dimension |
getPreferredSize() |
Dimension |
getScaledSize(double scale) |
String |
getStringBetween(int x0,
int y0,
int x1,
int y1) |
boolean |
isCellOk(int px,
int py,
boolean checkCase) |
boolean |
isIntoBlacks(Point pt,
boolean checkHorizontal) |
boolean |
isIntoWhites(Point pt,
boolean checkHorizontal) |
boolean |
isValidCell(int px,
int py) |
void |
moveCursor(int dx,
int dy,
boolean skipLocked) |
void |
randomize() |
void |
repaintCell(int px,
int py) |
void |
setAllCellsAttribute(int attribute,
boolean state) |
void |
setAttribute(int px,
int py,
int attribute,
boolean state) |
void |
setAttributeBetween(int x0,
int y0,
int x1,
int y1,
int attribute,
boolean value) |
void |
setBounds(Rectangle2D r) |
void |
setCellAttributes(boolean lockWild,
boolean clearChars) |
void |
setCellLocked(int px,
int py,
boolean locked) |
void |
setCharAt(int px,
int py,
char ch) |
void |
setChars(String[] text) |
void |
setCursorAt(int px,
int py,
boolean skipLocked) |
void |
setCursorEnabled(boolean status) |
void |
setUseCursor(boolean value) |
void |
startCursorBlink() |
void |
stopCursorBlink() |
boolean |
update(Graphics2D g2,
Rectangle dirtyRegion,
ImageObserver io) |
boolean |
updateContent(Graphics2D g2,
Rectangle dirtyRegion,
ImageObserver io) |
checkHostedComponent, contains, drawBorder, getAbsoluteLocation, getAbsoulteMiddleLocation, getBorderBounds, getBoxBaseResolve, getBoxBaseX, getContainerResolve, getContainerX, getHostedComponent, getLocation, getParent, getShape, hasBorder, isAlternative, isFocused, isInactive, isInverted, isMarked, isTemporaryHidden, isVisible, repaint, setAlternative, setBorder, setBounds, setBoxBase, setContainer, setFocused, setHostedComponent, setInactive, setInverted, setLocation, setLocation, setMarked, setParent, setShape, setSize, setSize, setTemporaryHidden, setVisible, translate
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect, toString
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
getBounds, getBounds2D, setBounds
public char wild
public static final int MIN_CELL_SIZE
public static final int DEFAULT_CELL_SIZE
public static final int MIN_INTERNAL_MARGIN
public static final int NORMAL
public static final int INVERTED
public static final int HIDDEN
public static final int LOCKED
public static final int MARKED
public static final int TRANSPARENT
public TextGrid(AbstractBox parent, JComponent container, double setX, double setY, int setNcw, int setNch, double setCellW, double setCellH, BoxBase boxBase, boolean setBorder)
public static TextGrid createEmptyGrid(AbstractBox parent, JComponent container, double setX, double setY, TextGridContent tgc, boolean wildTransparent)
public void setChars(String[] text)
public void randomize()
public void setCellAttributes(boolean lockWild, boolean clearChars)
public void setCellLocked(int px, int py, boolean locked)
public Point getItemFor(int rx, int ry)
public void setCursorEnabled(boolean status)
public void startCursorBlink()
public void stopCursorBlink()
public void moveCursor(int dx, int dy, boolean skipLocked)
public boolean isIntoBlacks(Point pt, boolean checkHorizontal)
public boolean isIntoWhites(Point pt, boolean checkHorizontal)
public Point findNextCellWithAttr(int startX, int startY, int attr, int dx, int dy, boolean attrState)
public void setCursorAt(int px, int py, boolean skipLocked)
public void setUseCursor(boolean value)
public Point getCursor()
public int countCharsLike(char ch)
public int getNumCells()
public int countCoincidences(boolean checkCase)
public boolean isCellOk(int px, int py, boolean checkCase)
public boolean isValidCell(int px, int py)
public void setCharAt(int px, int py, char ch)
public char getCharAt(int px, int py)
public String getStringBetween(int x0, int y0, int x1, int y1)
public void setAttributeBetween(int x0, int y0, int x1, int y1, int attribute, boolean value)
public void setAttribute(int px, int py, int attribute, boolean state)
public void setAllCellsAttribute(int attribute, boolean state)
public boolean getCellAttribute(int px, int py, int attribute)
public Rectangle2D getCellRect(int px, int py)
public Rectangle getCellBorderBounds(int px, int py)
public void repaintCell(int px, int py)
public Object clone()
clone
in class AbstractBox
public Dimension getPreferredSize()
getPreferredSize
in interface Resizable
public Dimension getMinimumSize()
getMinimumSize
in interface Resizable
public Dimension getScaledSize(double scale)
getScaledSize
in interface Resizable
public void setBounds(Rectangle2D r)
setBounds
in interface Resizable
setBounds
in class AbstractBox
public boolean update(Graphics2D g2, Rectangle dirtyRegion, ImageObserver io)
update
in class AbstractBox
public boolean updateContent(Graphics2D g2, Rectangle dirtyRegion, ImageObserver io)
updateContent
in class AbstractBox
public void actionPerformed(ActionEvent ev)
actionPerformed
in interface ActionListener
protected void blink(int status)
public void end()
end
in class AbstractBox
public void finalize() throws Throwable
finalize
in class AbstractBox
Throwable
Copyright © 2004-15 Francesc Busquets (fbusquets@xtec.cat) & Departament d'Educació de la Generalitat de Catalunya (info@xtec.cat)
Licensed under the terms of the GNU General Public License.