this is the problem i'm having:
the code is all fine both throught the compiler and applet viewer, no errors reported.
as soon as i view it from the IE broswer the prompt boxes won't go away and i have to kill IE.
the same thing when my friend tried it and checked hte code for me.
you can view the applet Here
and here's the source code(yea, i'm taking Java101)
Thanks in advance for you computer gods who's willing to help
// This Java Applet will find the largest of the 10 numbers entered by user
// Import the libraries needed:
import java.applet.*;
import java.awt.*;
import javax.swing.*;
//---------------------------------Lab 3 program codes begin here-------------------------//
public class FindLargeNum extends JApplet {
public void paint(Graphics g) {
int Input[] = new int[10]; //Declare ARRAY for 10 input numbers
int Large = 0, Entry = 0; //Dummy integer to get/store largest number and its position
for ( int i = 0; i < 10; i++) {
Input = Integer.parseInt(JOptionPane.showInputDialog("Enter A Number " +
"Between 1 and 1000 (Entry " + (i+1) + ")")); //Get and Parse inputs
if (Input > Large) //Get the most recent entry # for the largest input
Entry = i+1;
Large = Math.max(Large, Input); //Compare with previously largest input
//Write inputs to applet screen
g.drawString("Entry " + (i+1) + " was: \"" + Input + " \"", 10, 20*i+20);
}
//Prompt Results
JOptionPane.showMessageDialog(null, "Largest Number Entered was Entry "
+ Entry + ": \"" +Large + "\"");
}
}
the code is all fine both throught the compiler and applet viewer, no errors reported.
as soon as i view it from the IE broswer the prompt boxes won't go away and i have to kill IE.
the same thing when my friend tried it and checked hte code for me.
you can view the applet Here
and here's the source code(yea, i'm taking Java101)
Thanks in advance for you computer gods who's willing to help
// This Java Applet will find the largest of the 10 numbers entered by user
// Import the libraries needed:
import java.applet.*;
import java.awt.*;
import javax.swing.*;
//---------------------------------Lab 3 program codes begin here-------------------------//
public class FindLargeNum extends JApplet {
public void paint(Graphics g) {
int Input[] = new int[10]; //Declare ARRAY for 10 input numbers
int Large = 0, Entry = 0; //Dummy integer to get/store largest number and its position
for ( int i = 0; i < 10; i++) {
Input = Integer.parseInt(JOptionPane.showInputDialog("Enter A Number " +
"Between 1 and 1000 (Entry " + (i+1) + ")")); //Get and Parse inputs
if (Input > Large) //Get the most recent entry # for the largest input
Entry = i+1;
Large = Math.max(Large, Input); //Compare with previously largest input
//Write inputs to applet screen
g.drawString("Entry " + (i+1) + " was: \"" + Input + " \"", 10, 20*i+20);
}
//Prompt Results
JOptionPane.showMessageDialog(null, "Largest Number Entered was Entry "
+ Entry + ": \"" +Large + "\"");
}
}