fourwin
Class FourGUI
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
fourwin.FourGUI
- All Implemented Interfaces:
- MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
public class FourGUI
- extends JFrame
- implements MouseListener
This class controls all actions and reactions of the Visualization used to
play the fourwin game.
- Author:
- Konstantin
- See Also:
- Serialized Form
Nested Class Summary |
private class |
FourGUI.ButtonListener
This private class is a standard ButtonListener which reacts on button-events,
as we have in this case three standard buttons and two CheckBoxes. |
(package private) class |
FourGUI.RadioListener
This private class is a standard RadioListener which reacts on radiobutton-events,
as we have in this case four standard radiobuttons to decide which player is allowed
to begin. |
(package private) class |
FourGUI.SliderListener
|
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 |
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, 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, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
gamemodus
JCheckBox gamemodus
calculate
JCheckBox calculate
start
JButton start
reset
JButton reset
connect
JButton connect
humanstart
JRadioButton humanstart
comstart
JRadioButton comstart
loser
JRadioButton loser
alternate
JRadioButton alternate
radiogroup
ButtonGroup radiogroup
listener
FourGUI.ButtonListener listener
radioListener
FourGUI.RadioListener radioListener
sliderListener
ChangeListener sliderListener
textarea1
JTextArea textarea1
panel1
JPanel panel1
panel2
JPanel panel2
panel21
JPanel panel21
panel22
JPanel panel22
panel23
JPanel panel23
panel24
JPanel panel24
panel3
JPanel panel3
label1
JLabel label1
label2
JLabel label2
label3
JLabel label3
label4
JLabel label4
evalslider
JSlider evalslider
levelslider
JSlider levelslider
picture
Image picture
offscreen
Image offscreen
gamemanager
FourGameManager gamemanager
gameover
boolean gameover
isActive
boolean isActive
turndone
boolean turndone
playmode
boolean playmode
starter
boolean starter
resets
boolean resets
column
int column
beginners
int beginners
yellowred
int yellowred
losernumber
int losernumber
counter
int counter
humanwins
int humanwins
rowBotwins
int rowBotwins
numberOfRounds
int numberOfRounds
FourGUI
public FourGUI()
setStarterLabel
@Deprecated
public void setStarterLabel()
- Deprecated.
paint
public void paint(Graphics g)
- Typical paint-method, combined with an "offpaint"-method and another GUI-class ( "PlayingFieldGUI" )
against flickering while klicking with the mouse on the Visualization. This method draws the
typical fourwin-board and also draws the chips in the specific color if they are in the allowed
range. Also the "game over"-font is painted here.
- Overrides:
paint
in class Container
- Parameters:
g
-
offpaint
public void offpaint(Graphics g)
mousePressed
public void mousePressed(MouseEvent e)
- This Method reacts on pressing the mouse button of the user of this software.
It recognized whether the user action was valid ( user clicked on a circle or line
to throw a chip in the line ) or invalid. If the action was valid, this method sets
the specific column value and activates the paint()-method to draw a chip in the specific
field.
- Specified by:
mousePressed
in interface MouseListener
- Parameters:
e
-
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClicked
in interface MouseListener
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleased
in interface MouseListener
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEntered
in interface MouseListener
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExited
in interface MouseListener
givePointToWinner
public void givePointToWinner(int numberOfWinner)
- This method controls the game statistics about the number of Wins at the
right side on the Visualization. The parameter, which inherits the winner
of the played round, is gotten by the GameManager.
- Parameters:
numberOfWinner
-
setNumOfRound
public void setNumOfRound()
- This method sets the number of Rounds shown on the Visualization at the ride
side. The parameter, which inherits the number
of the played round, is gotten by the GameManager.
- Parameters:
NumOfRound
-
setEvalSlider
public void setEvalSlider(int value)
getLevelSlider
public int getLevelSlider()
setGameOver
public void setGameOver(boolean gameover)
setFourGameManager
public void setFourGameManager(FourGameManager player)
getTurndone
public boolean getTurndone()
setTurndone
public void setTurndone(boolean turndone)
getColumn
public int getColumn()
setActive
public void setActive(boolean isActive)
getReset
public boolean getReset()
setReset
public void setReset(boolean resets)
getPlaymode
public boolean getPlaymode()
getStarter
public boolean getStarter()
setStarter
public void setStarter(boolean starter)
getBeginners
public int getBeginners()
setLoser
public void setLoser(int loser)
setRadioButtonStart
public void setRadioButtonStart()
setCounter
public void setCounter(int counter)
resetNumbersOfRounds
public void resetNumbersOfRounds()