Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: please help

  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    please help

    i have this applet:
    Code:
    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:"); 
    		
    		jtxtResult.setEditable(false); 
    		//TitledBorder titleBorder = new Border("Enter two numbers to be multiplied"); 
    		JPanel jpMultiply = new JPanel(); 
    		jpMultiply.setLayout(new GridLayout(3, 2)); 
    		jpMultiply.add(jlbFirst); 
    		jpMultiply.add(jtxtFirst); 
    		jpMultiply.add(jlbSecond); 
    		jpMultiply.add(jtxtSecond); 
    		jpMultiply.add(jlbResult); 
    		jpMultiply.add(jtxtResult); 
    		//jpMultiply.setBorder(titleBorder); 
    		
    		getContentPane().setLayout(new BorderLayout());
    		getContentPane().add(jpMultiply, BorderLayout.NORTH);  
    		
    		JButton jbMultiply = new JButton("Multiply"); 
    		getContentPane().add(jbMultiply, BorderLayout.SOUTH); 
    		jbMultiply.addActionListener(this); 
    	}
    	
    	public void actionPerformed(ActionEvent e) {
    		int f, s, r; 
    		f = Integer.parseInt(jtxtFirst.getText()); 
    		s = Integer.parseInt(jtxtSecond.getText()); 
    		r = f * s; 
    		jtxtResult.setText(Integer.toString(r)); 
    	}
    }
    and i have this htm file:
    Code:
    <HTML>
    <HEAD>
    </HEAD>
    <BODY BGCOLOR="000000">
    <CENTER>
    <APPLET
    	code	= "MultiplyApplet.class"
    	width	= "500"
    	height	= "300"
    	alt="You must have a Java 2-enabled browser to view the applet"
    	>
    </APPLET>
    </CENTER>
    </BODY>
    </HTML>
    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?

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Location
    California
    Posts
    925
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if it says not found make sure the names are spelled right. When you say
    Code:
    	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...


    Jason

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •