title: I'm trying to extend a Java program given to us at Uni, and I can't get the program to use the methods in the new class
body: <p>So, firstly I'm a pretty amateur Java programmer and it's just one module and then it's over.</p>
  
  <p>The criteria is to override the predefined 'about()' command in our TurtleGraphics program.</p>
  
  <p>I can get it to work if I put the override in the GUI class with everything else, but when I try to create an 'ExtendedTurtleGraphics' class and try and call it, it just doesn't do anything, doesn't throw an error, just does nothing.</p>
  
  <p><strong>This is the Extended Class and Content</strong></p>
  
  <pre><code>public class ExtendedTurtleGraphics extends TurtleGraphics {
  TurtleGraphics TG = new TurtleGraphics();
  theTurtle turtle = new theTurtle();
  String Command;
  @Override
  public void about() {
      super.about();
      System.out.print("Testing..."); //Working!
      Command = "backward 100";
      turtle.getCommand(Command, this);
      Command = "penDown";
      turtle.getCommand(Command, this);
      Command = "forward 200";
      turtle.getCommand(Command, this);
      Command = "turnright 120";
      turtle.getCommand(Command, this);
      Command = "forward 50";
      turtle.getCommand(Command, this);
  }
  
  /*@Override
  public void circle(int radius) {
      super.circle(radius);
  
      }*/
  }
  </code></pre>
  
  <p><strong>This is the whole GUI class, the about section follows on</strong>    </p>
  
  <pre><code>public class myGUI extends JPanel{
  
      static JTextField commandbox;
      boolean isSaved = false;
      TurtleGraphics TG = new TurtleGraphics();
      theTurtle turtle = new theTurtle();
      TurtleGraphics ETG = new ExtendedTurtleGraphics();
      public myGUI()
      {
          JFrame MFrame = new JFrame();
          setLayout(new BorderLayout());
          setBackground(Color.white);
          commandbox = new JTextField(5);
          MenuBr mb = new MenuBr();
          MFrame.setJMenuBar(mb);
          MFrame.add(commandbox, BorderLayout.SOUTH);
          commandbox.addActionListener(new MyActionListener());
          MFrame.add(TG);
          MFrame.setSize(640, 480);
          MFrame.setVisible(true);
          MFrame.validate();
          MFrame.repaint();
          ExtendedTurtleGraphics ETG;
  
      }
      public static void infoBox(String infoMessage, String titleBar)
      {
          JOptionPane.showMessageDialog(null, infoMessage, titleBar, JOptionPane.INFORMATION_MESSAGE);
      }
      class MenuBr extends JMenuBar implements ActionListener {
          JMenu fileMnu = new JMenu("File");
          JMenuItem newMnuI = new JMenuItem("New");
          JMenuItem openMnuI = new JMenuItem("Load");
          JMenuItem saveMnuI = new JMenuItem("Save");
          JMenuItem closeMnuI = new JMenuItem("Exit");
          JMenu helpMnu = new JMenu("Help");
          JMenuItem aboutMnuI = new JMenuItem("About");
  
  
          MenuBr() {
              add(fileMnu);
              fileMnu.add(newMnuI);
              fileMnu.add(openMnuI);
              fileMnu.add(saveMnuI);
              fileMnu.add(closeMnuI);
              newMnuI.addActionListener(this);
              openMnuI.addActionListener(this);
              saveMnuI.addActionListener(this);
              closeMnuI.addActionListener(this);
              add(helpMnu);
              helpMnu.add(aboutMnuI);
              aboutMnuI.addActionListener(this);
          }
  
          public void actionPerformed(ActionEvent e) {
              if (e.getSource() == newMnuI) {
                  TG.reset();
                  TG.turnLeft(90);
                  TG.clear();
                  TG.penDown();
              }
              if (e.getSource() == openMnuI) {
                  if (isSaved == true) {
                      String loadName = JOptionPane.showInputDialog("Enter Load File Path (Excluding .png) :");
                      loadName = loadName + ".png";
                      try {
                          BufferedImage loadedImage = ImageIO.read(new File(loadName));
                          TG.setBufferedImage(loadedImage);
                      } catch (IOException exception) {
                          System.out.println(exception.getMessage());
                      }
                  } else if (isSaved == false) {
                      int n = JOptionPane.showConfirmDialog(null, "Save before loading?", "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                      System.out.println(n);
                      if (n == 0) {
                          Graphics g = TG.getGraphicsConext();
                          BufferedImage i = TG.getBufferedImage();
                          String fileName = JOptionPane.showInputDialog("Enter Save File Path (Excluding .png): ");
                          fileName = fileName + ".png";
                          File file = new File(fileName);
                          try {
                              ImageIO.write(i, "png", file);
                          } catch (IOException el) {
                              el.printStackTrace();
                          }
                          String loadName = JOptionPane.showInputDialog("Enter Load File Path (Excluding .png) :");
                          loadName = loadName + ".png";
                          try {
                              BufferedImage loadedImage = ImageIO.read(new File(loadName));
                              TG.setBufferedImage(loadedImage);
                          } catch (IOException exception) {
                              System.out.println(exception.getMessage());
                          }
                      } else if (n == 1) {
                          String loadName = JOptionPane.showInputDialog("Enter Load File Path (Excluding .png) :");
                          loadName = loadName + ".png";
                          try {
                              BufferedImage loadedImage = ImageIO.read(new File(loadName));
                              TG.setBufferedImage(loadedImage);
                          } catch (IOException exception) {
                              System.out.println(exception.getMessage());
                          }
                      }
                  }
              }
              if (e.getSource() == saveMnuI) {
                  isSaved = true;
                  Graphics g = TG.getGraphicsConext();
                  BufferedImage i = TG.getBufferedImage();
                  String fileName = JOptionPane.showInputDialog("Enter File Path (Excluding .png): ");
                  fileName = fileName + ".png";
                  File file = new File (fileName);
                  try{
                      ImageIO.write(i, "png", file);
                  } catch (IOException el) {
                      el.printStackTrace();
                  }
              }
              if (e.getSource() == closeMnuI) {
                  if (isSaved == true)
                  {
                      System.exit(0);
                  }
                  else
                  {
                      int n = JOptionPane.showConfirmDialog(null, "Save before quitting?", "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                      System.out.println(n);
                      if (n == 0)
                      {
                          Graphics g = TG.getGraphicsConext();
                          BufferedImage i = TG.getBufferedImage();
                          String fileName = JOptionPane.showInputDialog("Enter File Path (Excluding .png): ");
                          fileName = fileName + ".png";
                          File file = new File (fileName);
                          try{
                              ImageIO.write(i, "png", file);
                          } catch (IOException el) {
                              el.printStackTrace();
                          }
                          System.exit(0);
                      }
                      else if (n == 1)
                      {
                          System.exit(0);
                      }
                  }
              }
  </code></pre>
  
  <p><strong>This is the about section</strong></p>
  
  <pre><code>        if (e.getSource() == aboutMnuI) {
              ETG.clear();
              ETG.about();
              ImageIcon icon = new ImageIcon("FilePath");
              JOptionPane.showMessageDialog(null, "Turtle Graphics\nJoe Bloggs\n4FS1\nOOP Assessment 2020", "About", JOptionPane.INFORMATION_MESSAGE, icon);
              }
          }
      }
      class MyActionListener implements ActionListener {
  
          @Override
          public void actionPerformed(ActionEvent e) {
  
              if (e.getSource() == commandbox) {
  
                  String command = commandbox.getText();
                  isSaved = false;
                  turtle.getCommand(command, TG);
                  commandbox.setText("");
  
              }
          }
      }
  
  }
  </code></pre>
  
  <p><strong>theTurtle Java Class.</strong></p>
  
  <pre><code>public class theTurtle {
      //ArrayList&lt;String&gt; oldCommands = new ArrayList&lt;&gt;();
  
      public void getCommand(String command, TurtleGraphics TG)
      {
          String[]entries = command.split(" ");
          int var = -1;
          String norm = entries[0];
          if (entries.length == 2)
          {
              var = Integer.parseInt(entries[1]);
          }
          getMethod(norm, var, TG);
      }
      private void getMethod(String command, int var, TurtleGraphics TG)
      {
          if (command.toLowerCase().equals("penup"))
          {
              TG.penUp();
          }
          else if (command.toLowerCase().equals("pendown"))
          {
              TG.penDown();
          }
          else if (command.toLowerCase().equals("turnleft"))
          {
              if (var==-1)
              {
                  TG.turnLeft();
              }
              else{
                  TG.turnLeft(var);
              }
          }
          else if (command.toLowerCase().equals("turnright"))
          {
              if (var==-1)
              {
                  TG.turnRight();
              }
              else{
                  TG.turnRight(var);
              }
          }
          else if (command.toLowerCase().equals("forward"))
          {
              if (var == -1 || var &lt;= 0)
              {
                  errorEcho(1);
              }
              else{
                  TG.forward(var);
              }
          }
          else if (command.toLowerCase().equals("backward"))
          {
              if (var == -1 || var &lt;= 0)
              {
                  errorEcho(1);
              }
              else{
                  TG.turnRight(180);
                  TG.forward(var);
                  TG.turnRight(180);
              }
          }
          else if (command.toLowerCase().equals("black"))
          {
              TG.setPenColour(Color.black);
          }
          else if (command.toLowerCase().equals("red"))
          {
              TG.setPenColour(Color.red);
          }
          else if (command.toLowerCase().equals("green"))
          {
              TG.setPenColour(Color.green);
          }
          else if (command.toLowerCase().equals("reset"))
          {
              TG.reset();
              TG.turnLeft(90);
              TG.clear();
              TG.penDown();
          }
          else if (command.toLowerCase().equals("circle"))
          {
              if (var == -1 || var &lt;= 0)
              {
                  errorEcho(1);
              }
              else{
                  TG.circle(var);
              }
          }
          else{
             myGUI.infoBox("Invalid Command", "ERROR!");
          }
  
      }
      private void errorEcho(int errorCode)
      {
  
          myGUI.infoBox("Missing Parameters", "ERROR!");
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/1acic.png" rel="nofollow noreferrer">The variables that are show stepping through about</a></p>