package com.ebay.game.gui;


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
 * Created with IntelliJ IDEA.
 * User: tjunghans
 * Date: 14.11.2013
 * Time: 8:39 PM
 * To change this template use File | Settings | File Templates.
 */
public class SimpleGui1B {

    JLabel labelTitle;
    JFrame frame;
    JPanel panelStart;
    JPanel panelShowShapeMenu;
    Container pane;

    JButton buttonGameType1;
    JButton buttonGameType2;

    // panelShowShapeMenu Buttons
    JButton buttonRock;
    JButton buttonPaper;
    JButton buttonScissors;

    public static void main (String[] args) {
        SimpleGui1B gui = new SimpleGui1B();
    }

    public SimpleGui1B() {
        frame = new JFrame("Rock, Paper, Scissors");
        frame.setResizable(false);
        pane = frame.getContentPane();
        this.go();
    }

    public void showShapeMenu() {
        panelShowShapeMenu = new JPanel();

        // Declare components
        JLabel panelLabel = new JLabel("Choose shape");
        buttonRock = new JButton("Rock");
        buttonPaper = new JButton("Paper");
        buttonScissors = new JButton("Scissors");

        // Add listeners
        buttonRock.addActionListener(new ButtonRockListener());
        buttonPaper.addActionListener(new ButtonPaperListener());
        buttonScissors.addActionListener(new ButtonScissorsListener());

        // Add components to panel
        panelShowShapeMenu.add(BorderLayout.NORTH, panelLabel);

        panelShowShapeMenu.setLayout(new BoxLayout(panelShowShapeMenu, BoxLayout.Y_AXIS));
        panelShowShapeMenu.add(BorderLayout.CENTER, buttonRock);
        panelShowShapeMenu.add(BorderLayout.CENTER, buttonPaper);
        panelShowShapeMenu.add(BorderLayout.CENTER, buttonScissors);

        // Add panel to frame
        pane.add(BorderLayout.CENTER, panelShowShapeMenu);
    }

    public void go() {

        panelStart = new JPanel();

        buttonGameType1 = new JButton("PC vs PC");

        buttonGameType2 = new JButton("Human vs PC");

        labelTitle = new JLabel("Choose game type");

        buttonGameType1.addActionListener(new GameType1Listener());
        buttonGameType2.addActionListener(new GameType2Listener());

        panelStart.add(BorderLayout.NORTH, labelTitle);

        panelStart.setLayout(new BoxLayout(panelStart, BoxLayout.Y_AXIS));
        panelStart.add(BorderLayout.CENTER, buttonGameType1);
        panelStart.add(BorderLayout.CENTER, buttonGameType2);

        pane.add(BorderLayout.CENTER, panelStart);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.setSize(300, 300);

        frame.setVisible(true);

    }

    class GameType1Listener implements ActionListener {
        public void actionPerformed(ActionEvent event) {
            System.out.println("PC vs PC");
            panelStart.setVisible(false);
            frame.repaint();
        }
    }

    class GameType2Listener implements ActionListener {
        public void actionPerformed(ActionEvent event) {
            System.out.println("Human vs PC");
            panelStart.setVisible(false);
            SimpleGui1B.this.showShapeMenu();
            frame.repaint();
        }
    }

    class ButtonRockListener implements ActionListener {
        public void actionPerformed(ActionEvent event) {
            System.out.println("Human chose rock");
        }
    }

    class ButtonPaperListener implements ActionListener {
        public void actionPerformed(ActionEvent event) {
            System.out.println("Human chose paper");
        }
    }

    class ButtonScissorsListener implements ActionListener {
        public void actionPerformed(ActionEvent event) {
            System.out.println("Human chose scissors");
        }
    }




}

@@ -769,32 +769,160 @@
 sizable(false);%0A
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0A        frame.setSize(400, 300);%0A        frame.setVisible(true);%0A%0A
         pane = f
@@ -957,18 +957,32 @@
    this.
-go
+showGameTypeMenu
 ();%0A    
@@ -1993,16 +1993,68 @@
 peMenu);
+%0A%0A        pane.revalidate();%0A        pane.repaint();
 %0A    %7D%0A%0A
@@ -2073,10 +2073,24 @@
 oid 
-go
+showGameTypeMenu
 () %7B
@@ -2119,32 +2119,62 @@
  new JPanel();%0A%0A
+        // Declare components%0A
         buttonGa
@@ -2200,33 +2200,32 @@
 on(%22PC vs PC%22);%0A
-%0A
         buttonGa
@@ -2258,25 +2258,24 @@
 an vs PC%22);%0A
-%0A
         labe
@@ -2312,24 +2312,49 @@
 me type%22);%0A%0A
+        // Add listeners%0A
         butt
@@ -2470,32 +2470,67 @@
 e2Listener());%0A%0A
+        // Add components to panel%0A
         panelSta
@@ -2565,25 +2565,24 @@
 abelTitle);%0A
-%0A
         pane
@@ -2765,24 +2765,54 @@
 ameType2);%0A%0A
+        // Add panel to frame%0A
         pane
@@ -2863,105 +2863,35 @@
     
-frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0A%0A        frame.setSize(300, 300
+pane.revalidate(
 );%0A
-%0A
         
 fram
@@ -2886,37 +2886,29 @@
         
-frame.setVisible(true
+pane.repaint(
 );%0A%0A    

Add showShapeMenu