public class TextBoard
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
private static char |
DEFAULT_CHAR
The character used to initialize the textMatrix and the screen.
|
private static int |
DEFAULT_FONT_SIZE
The default font size.
|
private static java.lang.String |
DEFAULT_TITLE
The default title on the JFrame
|
private int |
fontSize
The font size for the textMatrix.
|
private javax.swing.JFrame |
frame
The frame used for the user interface
|
private javax.swing.JTextArea |
textArea
The textMatrix pane used to display the textMatrix.
|
private char[][] |
textMatrix
Contains the characters to be placed on the screen.
|
Constructor and Description |
---|
TextBoard(int rows,
int columns,
int fontSize)
Create the TextBoard.
|
Modifier and Type | Method and Description |
---|---|
void |
addKeyListener(java.awt.event.KeyListener keyListener)
Adds a KeyListener to the textBoard.
|
private void |
convertText(char[][] textMatrix)
Converts a char into something displayable.
|
private java.lang.String |
createText(char[][] textMatrix)
Converts the textMatrix into a string.
|
char[][] |
getText()
Gets the characters to be displayed on the screen.
|
private void |
initComponents()
Initializes the graphical interface.
|
void |
repaint()
Repaints the text board with the most recent textMatrix.
|
void |
run()
Used to display the board and run the thread.
|
void |
setText(char[][] textMatrix,
char c)
Initializes the textMatrix matrix to the given character.
|
void |
setTitle(java.lang.String title)
Sets the title of the TextBoard.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private static final java.lang.String DEFAULT_TITLE
private static final char DEFAULT_CHAR
private static final int DEFAULT_FONT_SIZE
private javax.swing.JFrame frame
private javax.swing.JTextArea textArea
private char[][] textMatrix
private int fontSize
public TextBoard(int rows, int columns, int fontSize)
rows
- The number of rows of textMatrix.columns
- The number of columns of textMatrix.fontSize
- The font size for the textMatrix.public void addKeyListener(java.awt.event.KeyListener keyListener)
keyListener
- Listener for key events on the TextBoardprivate void convertText(char[][] textMatrix)
textMatrix
- The matrix of characters.private java.lang.String createText(char[][] textMatrix)
textMatrix
- The matrix of characters.public char[][] getText()
private void initComponents()
public void repaint()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void setText(char[][] textMatrix, char c)
textMatrix
- The matrix of text to initialize.c
- The character used to initialize the matrix.public void setTitle(java.lang.String title)
title
- The title to displayed in the frame's boarder.