fourwin
Class FourGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by 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
           
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
(package private)  JRadioButton alternate
           
(package private)  int beginners
           
(package private)  JCheckBox calculate
           
(package private)  int column
           
(package private)  JRadioButton comstart
           
(package private)  JButton connect
           
(package private)  int counter
           
(package private)  JSlider evalslider
           
(package private)  FourGameManager gamemanager
           
(package private)  JCheckBox gamemodus
           
(package private)  boolean gameover
           
(package private)  JRadioButton humanstart
           
(package private)  int humanwins
           
(package private)  boolean isActive
           
(package private)  JLabel label1
           
(package private)  JLabel label2
           
(package private)  JLabel label3
           
(package private)  JLabel label4
           
(package private)  JSlider levelslider
           
(package private)  FourGUI.ButtonListener listener
           
(package private)  JRadioButton loser
           
(package private)  int losernumber
           
(package private)  int numberOfRounds
           
(package private)  Image offscreen
           
(package private)  JPanel panel1
           
(package private)  JPanel panel2
           
(package private)  JPanel panel21
           
(package private)  JPanel panel22
           
(package private)  JPanel panel23
           
(package private)  JPanel panel24
           
(package private)  JPanel panel3
           
(package private)  Image picture
           
(package private)  boolean playmode
           
(package private)  ButtonGroup radiogroup
           
(package private)  FourGUI.RadioListener radioListener
           
(package private)  JButton reset
           
(package private)  boolean resets
           
(package private)  int rowBotwins
           
(package private)  ChangeListener sliderListener
           
(package private)  JButton start
           
(package private)  boolean starter
           
(package private)  JTextArea textarea1
           
(package private)  boolean turndone
           
(package private)  int yellowred
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
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
FourGUI()
           
 
Method Summary
 int getBeginners()
           
 int getColumn()
           
 int getLevelSlider()
           
 boolean getPlaymode()
           
 boolean getReset()
           
 boolean getStarter()
           
 boolean getTurndone()
           
 void givePointToWinner(int numberOfWinner)
          This method controls the game statistics about the number of Wins at the right side on the Visualization.
 void mouseClicked(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
          This Method reacts on pressing the mouse button of the user of this software.
 void mouseReleased(MouseEvent e)
           
 void offpaint(Graphics g)
           
 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.
 void resetNumbersOfRounds()
           
 void setActive(boolean isActive)
           
 void setCounter(int counter)
           
 void setEvalSlider(int value)
           
 void setFourGameManager(FourGameManager player)
           
 void setGameOver(boolean gameover)
           
 void setLoser(int loser)
           
 void setNumOfRound()
          This method sets the number of Rounds shown on the Visualization at the ride side.
 void setRadioButtonStart()
           
 void setReset(boolean resets)
           
 void setStarter(boolean starter)
           
 void setStarterLabel()
          Deprecated. 
 void setTurndone(boolean turndone)
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

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
Constructor Detail

FourGUI

public FourGUI()
Method Detail

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()