Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

applet problem:(

i will say hi because this my first post

i know this:

--------------------
//applet.java

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class applet extends JApplet {
JTextArea ta = new JTextArea(10,30);
public applet() {
}
public void init() {
Container p = getContentPane();
p.setLayout(new FlowLayout());
p.add(ta);
}
public void start() {
}
public void stop() {
}
public void destroy() {
}

}
--------------------
//manifest.txt
Main-Class: applet
--------------------
//applet.html
<HTML>
<HEAD>
<TITLE>Applet Test Page</TITLE>
</HEAD>
<BODY>
<APPLET CODE = "applet.class" ARCHIVE = "applet.jar" NAME = "%s" WIDTH = 400 HEIGHT = 300 ALIGN = middle>
</APPLET>
</BODY>
</HTML>
------------------

now:
javac applet.java
jar cfm applet.jar manifest.txt *.class
HTMLconverter applet.html

and it works:)
but i got problem with packages:( (true applet code is bigger but idea the same)

i make 2 java file:
--------------------
//applet.java
package pack;

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class applet extends JApplet {
JTextArea ta = new JTextArea(10,30);
public applet() {
}
public void init() {
Container p = getContentPane();
be b=new be();
p.setLayout(new FlowLayout());
p.add(ta);
}
public void start() {
}
public void stop() {
}
public void destroy() {
}

}
--------------------
//be.java
package pack;

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class be{
public be(){
}
}
--------------
//manifest.txt
Main-Class: pack.applet
--------------------
//applet.html
<HTML>
<HEAD>
<TITLE>Applet Test Page</TITLE>
</HEAD>
<BODY>
<APPLET CODE = "applet.class" ARCHIVE = "applet.jar" NAME = "%s" WIDTH = 400 HEIGHT = 300 ALIGN = middle>
</APPLET>
</BODY>
</HTML>
------------------

now:
javac *.java
jar cfm applet.jar manifest.txt *.class
HTMLconverter applet.html

and it dont work pls help me
[2654 byte] By [wojtek] at [2007-11-11 8:19:29]
# 1 Re: applet problem:(
I don't know how much this might relate to your project, but you may have a naming conflict. Java already has a package "applet", and a class "Applet".

Try changing the names of your package and class and run things again. Any difference?
nspils at 2007-11-11 22:35:48 >