Okay this is what were suppose to be doing for are next project in class, So far I kind of got it set up and have been working at it all damn day. I'm almost done but can not figure out what I am doing wrong
please please can someone give me a hand thanks.
Take your code from Assignment 7 Prime Numbers and convert it to a Java Swing JFrame class. The focus of this assignment will be to design the screen and place the code that you already developed into a JButton click event.
You will need to create a JFrame object screen layout similar to the what we have covered in the class.
The caption of the window should be Prime Numbers Swing.
You will need the following screen components:
A JLabel that contains the caption: Maximum Number to Test
JTextField to accept the maximum number to test
JTextArea that is scrollable to show the numbers from 1 to the Maximum Number to Test that are prime.
Three JButton objects:
An Exit JButton to stop the program
A Clear JButton to clear the maximum number to test JTextField object.
A Prime Numbers JButton to find the prime numbers from 1 to the user supplied maximum number to test.
Perform data validation on the user supplied JTextField Maximum Number value:
If no value is supplied, show a JOptionPane.showMessageDialog message indicating a value is required.
If invalid integer entered, show a JOptionPane.showMessageDialog message indicating a valid integer must be supplied.
Output the determined prime numbers to the scrollable JTextArea object.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*; // added so we can use the event handlers
public class PrimeNumberGUI
{
{
//Declare variables
boolean bIsPrime = true; //use boolean to check if number is prime
String sOutput = ""; //output string
for(int iCounter = 1; iCounter < 100; iCounter++)
{
//make sure boolean is set to true
bIsPrime = true;
for(int iCount = 1; iCount < iCounter; iCount++)
{
//check to see if the remainder is 0 and make sure that the number dividing isn't 1
if(iCounter % iCount == 0 && iCount != 1)
{
bIsPrime = false;
break;
}//end if
}//end for
//if bIsPrime is true add iCounter to the Output string
if(bIsPrime)
{
sOutput += iCounter + "\n";
}//end if
}
}
public class RandomNumberScrolling extends JFrame
{
public static final int WIDTH=400;
public static final int HEIGHT=300;
// Declare JFrame components:
public JLabel jlblMaxNumber;
public JTextField jtfMaxNumber;
public JTextArea jtaHistory;
public JScrollPane scrollingResult;
public JButton jbutExit;
// Set the title and Size:
setTitle("Area and Perimeter of a Rectangle");
setSize(WIDTH, HEIGHT);
// Instantiate the JLabel components:
jlblMaxNumber = new JLabel("Enter the Maximum Number: ", SwingConstants.LEFT);
// Instantiate the JTextFields:
jtfMaxNumber = new JTextField(10);
// Make the JTextArea scrollable:
jtaHistory = new JTextArea(10,1);
scrollingResult = new JScrollPane(jtaHistory);
// Instantiate and register the Exit button for clicks events:
jbutExit = new JButton("Exit");
ebHandler = new ExitButtonHandler();
jbutExit.addActionListener(ebHandler);
// Start to add the components to the JFrame:
Container pane = getContentPane();
pane.setLayout(new GridLayout(3, 2));
pane.add(jlblMaxNumber);
pane.add(jtfMaxNumber);
pane.add(scrollingResult);
pane.add(jbutExit);
// Show the JFrame and set code to respond to the user clicking on the X:
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
} // end constructor
public void actionPerformed(ActionEvent e)
{
} // end CalculatorButtonHandler
public void actionPerformed(ActionEvent e)
{
System.exit(0);
} // end actionPerformed
} // end ExitgButtonHandler
public static void main(String args[])
{
} // end main method
} // end GuessNumber Class

Take your code from Assignment 7 Prime Numbers and convert it to a Java Swing JFrame class. The focus of this assignment will be to design the screen and place the code that you already developed into a JButton click event.
You will need to create a JFrame object screen layout similar to the what we have covered in the class.
The caption of the window should be Prime Numbers Swing.
You will need the following screen components:
A JLabel that contains the caption: Maximum Number to Test
JTextField to accept the maximum number to test
JTextArea that is scrollable to show the numbers from 1 to the Maximum Number to Test that are prime.
Three JButton objects:
An Exit JButton to stop the program
A Clear JButton to clear the maximum number to test JTextField object.
A Prime Numbers JButton to find the prime numbers from 1 to the user supplied maximum number to test.
Perform data validation on the user supplied JTextField Maximum Number value:
If no value is supplied, show a JOptionPane.showMessageDialog message indicating a value is required.
If invalid integer entered, show a JOptionPane.showMessageDialog message indicating a valid integer must be supplied.
Output the determined prime numbers to the scrollable JTextArea object.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*; // added so we can use the event handlers
public class PrimeNumberGUI
{
{
//Declare variables
boolean bIsPrime = true; //use boolean to check if number is prime
String sOutput = ""; //output string
for(int iCounter = 1; iCounter < 100; iCounter++)
{
//make sure boolean is set to true
bIsPrime = true;
for(int iCount = 1; iCount < iCounter; iCount++)
{
//check to see if the remainder is 0 and make sure that the number dividing isn't 1
if(iCounter % iCount == 0 && iCount != 1)
{
bIsPrime = false;
break;
}//end if
}//end for
//if bIsPrime is true add iCounter to the Output string
if(bIsPrime)
{
sOutput += iCounter + "\n";
}//end if
}
}
public class RandomNumberScrolling extends JFrame
{
public static final int WIDTH=400;
public static final int HEIGHT=300;
// Declare JFrame components:
public JLabel jlblMaxNumber;
public JTextField jtfMaxNumber;
public JTextArea jtaHistory;
public JScrollPane scrollingResult;
public JButton jbutExit;
// Set the title and Size:
setTitle("Area and Perimeter of a Rectangle");
setSize(WIDTH, HEIGHT);
// Instantiate the JLabel components:
jlblMaxNumber = new JLabel("Enter the Maximum Number: ", SwingConstants.LEFT);
// Instantiate the JTextFields:
jtfMaxNumber = new JTextField(10);
// Make the JTextArea scrollable:
jtaHistory = new JTextArea(10,1);
scrollingResult = new JScrollPane(jtaHistory);
// Instantiate and register the Exit button for clicks events:
jbutExit = new JButton("Exit");
ebHandler = new ExitButtonHandler();
jbutExit.addActionListener(ebHandler);
// Start to add the components to the JFrame:
Container pane = getContentPane();
pane.setLayout(new GridLayout(3, 2));
pane.add(jlblMaxNumber);
pane.add(jtfMaxNumber);
pane.add(scrollingResult);
pane.add(jbutExit);
// Show the JFrame and set code to respond to the user clicking on the X:
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
} // end constructor
public void actionPerformed(ActionEvent e)
{
} // end CalculatorButtonHandler
public void actionPerformed(ActionEvent e)
{
System.exit(0);
} // end actionPerformed
} // end ExitgButtonHandler
public static void main(String args[])
{
} // end main method
} // end GuessNumber Class