I posted before but i had to repost to add the code thing. So heres the program.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.awt.Color;
import java.awt.Font;



public class Testknowledge3 extends JPanel implements ActionListener
{
    //Declare objects
    JButton Next;
    JButton Back;
    JLabel label;
    ImageIcon icon;
    JTextArea title;


    JTextArea paragraph;
    JTextArea fill1;
    JTextArea fill2;
    JTextArea fill3;
    JTextArea fill4;
    JTextArea fill5;




    public Testknowledge3 ()
    {
        super (null);

        //set up GUI
        setBackground (Color.blue);


        title = new JTextArea ("Fill In The Blanks");
        title.setFont (new Font ("Serif", Font.BOLD, 30));
        title.setForeground (Color.white);

        paragraph = new JTextArea (" Eubacteria are simple organisms that lack nuclei \n (Therefore called                      ). They can be \n heterotrophs or                      so they either create \n energy by consumption of other organisms, \n                      or chemosynthesis.  The cell wall of \n Eubacteria contain Peptidoglycan, a 3 dimensional \n polymer containing                       & protein subunits. \n There are 3 types of Archaebacteria: Thermophiles \n (Heat), Halophiles, and                      .");
        paragraph.setFont (new Font ("Serif", Font.BOLD, 20));
        paragraph.setForeground (Color.yellow);

        fill1 = new JTextArea ();
        fill2 = new JTextArea ();
        fill3 = new JTextArea ();
        fill4 = new JTextArea ();
        fill5 = new JTextArea ();



        Next = new JButton ("Next to Results!");
        Back = new JButton ("Back To Menu");




        Next.setBounds (320, 330, 150, 20);
        Back.setBounds (20, 330, 120, 20);

        title.setBounds (130, 10, 9999, 9999);
        paragraph.setBounds (30, 50, 9999, 9999);
        fill1.setBounds (190, 83, 100, 20);
        fill2.setBounds (172, 110, 100, 20);
        fill3.setBounds (30, 165, 105, 20);
        fill4.setBounds (203, 217, 100, 20);
        fill5.setBounds (238, 270, 100, 20);



        Back.addActionListener (this);
        Next.addActionListener (this);


        Next.setActionCommand ("Results");
        Back.setActionCommand ("BacktoMenu");


        add (fill5);
        add (fill4);
        add (fill3);
        add (fill2);
        add (fill1);
        add (Next);
        add (Back);
        add (paragraph);
        add (title);




        label = new JLabel (); //create a JLabel1
        label.setBounds (0, 0, 500, 400);
        icon = new ImageIcon ("greenbac.jpg");
        label.setIcon (icon); //add icon to JLabel
        add (label);

        paragraph.setEditable (false);
        paragraph.setOpaque (false);
        title.setEditable (false);
        title.setOpaque (false);


    } //end public UIProgram ()


    public void actionPerformed (ActionEvent e)
    {

        String Action;
        Action = e.getActionCommand (); //gets the setActionCommand()
                            //[B]THIS IS WHERE THE CODE DOESNT ADD[/B]
        if (Action.equals ("Results"))
        {
            Results ();
            if (fill1.getText().equalsIgnoreCase ("Prokaryotic"))
            {
                science.sum [science.counter] += 1;
            }
            if (fill2.getText().equalsIgnoreCase ("Autotrophs"))
            {
                science.sum [science.counter] += 1;
            }
            if (fill3.getText().equalsIgnoreCase ("Photosynthesis"))
            {
                science.sum [science.counter] += 1;
            }
            if (fill4.getText().equalsIgnoreCase ("Peptidoglycan"))
            {
                science.sum [science.counter] += 1;
            }
            if (fill5.getText().equalsIgnoreCase ("Methanogens"))
            {
                science.sum [science.counter] = 1;
            }

            science.avg [science.counter] = science.averagesingle (science.sum [science.counter]);
            science.sum [3] += science.sum [science.counter];
            science.avg [3] += science.average (science.sum [3]);
            science.counter++;
                                 //[B]FROM THERE TO HERE[/B]
        }
        else if (Action.equals ("BacktoMenu"))
        {
            MainMenu ();
        }
    }



    public void Results ()
    {

        science.Results.getContentPane ().add (new Results ()); //adds your Jpanel to the frame
        science.Results.setSize (new Dimension (500, 400));  // sets the dimensions of the window
        science.Results.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); //closes the program if the X(close window) is clicked
        science.Results.show (); //show the frame
        science.Testknowledge3.hide ();
    }



    public void MainMenu ()
    {

        science.science.getContentPane ().add (new science ()); //adds your Jpanel to the frame
        science.science.setSize (new Dimension (500, 400));  // sets the dimensions of the window
        science.science.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); //closes the program if the X(close window) is clicked
        science.science.show (); //show the frame
        science.Testknowledge3.hide ();


    }


    public static void main (String[] arg)
    {


        science.Testknowledge3.getContentPane ().add (new Testknowledge3 ()); //adds your Jpanel to the frame
        science.Testknowledge3.setSize (new Dimension (500, 400));  // sets the dimensions of the window
        science.Testknowledge3.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); //closes the program if the X(close window) is clicked
        science.Testknowledge3.show (); //show the frame



    }
} //end class
This article has been dead for over six months. Start a new discussion instead.