|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
HogwartsGui
public class HogwartsGui
Field Summary | |
---|---|
static int |
ERRORREADINGFILE
Error reading the file. |
static int |
FILEOPEN
A file is currently opened. |
static int |
FILEOPENERROR
An error occurred opening a file. |
static int |
NOFILECHOSEN
User aborted the file open operation. |
static int |
SUCCESS
File was successfully input. |
Fields inherited from class javax.swing.JFrame |
---|
EXIT_ON_CLOSE |
Fields inherited from class java.awt.Frame |
---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
HogwartsGui(java.lang.String title)
Defines the layout and action listeners for the GUI. |
Method Summary | |
---|---|
void |
append(java.lang.Object s)
Append text to the display. |
void |
clearFile()
Clear buffers so that a new file can be opened. |
void |
enableButton1(boolean b)
Enable or disable Button1. |
void |
enableButton2(boolean b)
Enable or disable Button2. |
void |
enableButton3(boolean b)
Enable or disable Button3. |
void |
enableButton4(boolean b)
Enable or disable Button4. |
void |
enableE(boolean b)
Enable or disable the East button |
void |
enableN(boolean b)
Enable or disable the North button |
void |
enableS(boolean b)
Enable or disable the South button |
void |
enableW(boolean b)
Enable or disable the West button |
java.lang.String |
getFilename()
|
java.lang.String |
getInputText()
Get the user's input from the text input line. |
java.lang.String |
getKey()
Indicates which key was last pressed. |
java.lang.String |
getNextLine()
Get the next line of text from the input file. |
java.lang.String |
getText()
Get the text currently displayed. |
boolean |
keyInputReady()
Indicates whether the user has pressed a key. |
static void |
main(java.lang.String[] args)
|
int |
processFile()
Invokes a JFileChooser. |
void |
resetInputBuffer()
Resets getNextLine() so that it begins at the first line of the input. |
void |
setButton1Text(java.lang.Object s)
Redefines Button1's text. |
void |
setButton2Text(java.lang.Object s)
Redefines Button2's text. |
void |
setButton3Text(java.lang.Object s)
Redefines Button3's text. |
void |
setButton4Text(java.lang.Object s)
Redefines Button4's text. |
void |
setEText(java.lang.Object s)
Redefines E's text. |
void |
setMonospaceFont(boolean b)
Sets the monospace attribute for the output text area. |
void |
setNText(java.lang.Object s)
Redefines N's text. |
void |
setSText(java.lang.Object s)
Redefines S's text. |
void |
setText(java.lang.Object s)
Display text in the display. |
void |
setVisibleButton1(boolean b)
Make Button1 visible/invisible. |
void |
setVisibleButton2(boolean b)
Make Button2 visible/invisible. |
void |
setVisibleButton3(boolean b)
Make Button3 visible/invisible. |
void |
setVisibleButton4(boolean b)
Make Button4 visible/invisible. |
void |
setVisibleCommandButtons(boolean b)
Make the panel containing command buttons visible/invisible. |
void |
setVisibleCursorButtons(boolean b)
Make the panel containing cursor buttons visible/invisible. |
void |
setVisibleE(boolean b)
Make the east button visible/invisible. |
void |
setVisibleN(boolean b)
Make the north button visible/invisible. |
void |
setVisibleS(boolean b)
Make the south button visible/invisible. |
void |
setVisibleW(boolean b)
Make the west button visible/invisible. |
void |
setWText(java.lang.Object s)
Redefines W's text. |
boolean |
textInputReady()
Indicates whether the user has entered text. |
Methods inherited from class javax.swing.JFrame |
---|
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update |
Methods inherited from class java.awt.Frame |
---|
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
public static final int SUCCESS
public static final int FILEOPEN
public static final int FILEOPENERROR
public static final int ERRORREADINGFILE
public static final int NOFILECHOSEN
Constructor Detail |
---|
public HogwartsGui(java.lang.String title)
title
- the window title.Method Detail |
---|
public void setMonospaceFont(boolean b)
b
- true sets to monotype, false sets to default font.public void setNText(java.lang.Object s)
s
- Text to replace the default 'N'.public void setEText(java.lang.Object s)
s
- Text to replace the default 'E'.public void setWText(java.lang.Object s)
s
- Text to replace the default 'W'.public void setSText(java.lang.Object s)
s
- Text to replace the default 'S'.public void setButton1Text(java.lang.Object s)
s
- Text to replace the default "Button1".public void setButton2Text(java.lang.Object s)
s
- Text to replace the default "Button2".public void setButton3Text(java.lang.Object s)
s
- Text to replace the default "Button3".public void setButton4Text(java.lang.Object s)
s
- Text to replace the default "Button4".public void enableN(boolean b)
b
- true = enable, false=disablepublic void enableE(boolean b)
b
- true = enable, false=disablepublic void enableS(boolean b)
b
- true = enable, false=disablepublic void enableW(boolean b)
b
- true = enable, false=disablepublic void enableButton1(boolean b)
b
- true = enable, false=disablepublic void enableButton2(boolean b)
b
- true = enable, false=disablepublic void enableButton3(boolean b)
b
- true = enable, false=disablepublic void enableButton4(boolean b)
b
- true = enable, false=disablepublic void setVisibleN(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleE(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleS(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleW(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleCursorButtons(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleCommandButtons(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleButton1(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleButton2(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleButton3(boolean b)
b
- true=make visible, false=make invisiblepublic void setVisibleButton4(boolean b)
b
- true=make visible, false=make invisiblepublic boolean keyInputReady()
public boolean textInputReady()
public java.lang.String getKey()
public void setText(java.lang.Object s)
s
- Text to display in the text area.public void append(java.lang.Object s)
s
- Text to append to the text area.public java.lang.String getText()
public java.lang.String getInputText()
public int processFile()
public void clearFile()
public java.lang.String getNextLine()
public void resetInputBuffer()
public java.lang.String getFilename()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |