View Full Version : please help

04-08-2004, 06:06 AM
i have this applet:

import java.awt.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.*;
import javax.swing.border.*;

public class MultiplyApplet extends JApplet implements ActionListener {

private JTextField jtxtResult = new JTextField(10);
private JTextField jtxtFirst = new JTextField(10);
private JTextField jtxtSecond = new JTextField(10);

public void init() {
JLabel jlbFirst = new JLabel("Enter the first number:");
JLabel jlbSecond = new JLabel("Enter the second number:");
JLabel jlbResult = new JLabel("The result is:");

//TitledBorder titleBorder = new Border("Enter two numbers to be multiplied");
JPanel jpMultiply = new JPanel();
jpMultiply.setLayout(new GridLayout(3, 2));

getContentPane().setLayout(new BorderLayout());
getContentPane().add(jpMultiply, BorderLayout.NORTH);

JButton jbMultiply = new JButton("Multiply");
getContentPane().add(jbMultiply, BorderLayout.SOUTH);

public void actionPerformed(ActionEvent e) {
int f, s, r;
f = Integer.parseInt(jtxtFirst.getText());
s = Integer.parseInt(jtxtSecond.getText());
r = f * s;

and i have this htm file:

<BODY BGCOLOR="000000">
code = "MultiplyApplet.class"
width = "500"
height = "300"
alt="You must have a Java 2-enabled browser to view the applet"

in the same directory when i try to open the htm file it tells me on the status bar of the internet explorer that the class MultiplyApplet not found.
i have JCreator, and as you know the JCreator creates the class file and the htm file in the same directory automatically. so it makes me confused, which file i must put it in the same directory? is it the .class file or the .java file?

04-09-2004, 12:32 AM
if it says not found make sure the names are spelled right. When you say

code = "MultiplyApplet.class"

make sure that that is the exact name of the class file and not the name of the class you create in the file. You also might try a google on this, Im sure Ive seen it somewhere...


04-10-2004, 05:17 AM
You also might try a google on this, Im sure Ive seen it somewhere...
what do u mean???
i'm sure that the name is spelled correctly, and it is the name of the file, coz the JCreator do it automatically, it creats a class file and htm file and put it in the same directory.
any one know what is the problem? :confused: