|
查看: 840|回复: 2
|
java applet
[复制链接]
|
|
|
Dear all ,
i get a simple applet program ..hw am i going to deploy it through web browser(IE) ??..can appplet.class keep in WEB-INF ???...
a)
<body>
<applet name="ApptoAppl"
code="ApptoAppl.class"
archive="ApptoAppl.jar"
width="200" height="250">
</applet>
</body>
</html>
these are my html page ..is it correct ??
or ..i dun need create the jar archive ?
b)
<body>
<applet code="ApptoAppl.class"
width="200" height="250">
</applet>
</body>
</html>
the path :
Apache Software Foundation\Tomcat 5.5\webapps\Applet\ApptoAppl.class
Apache Software Foundation\Tomcat 5.5\webapps\Applet\ApptoAppl.html
Apache Software Foundation\Tomcat 5.5\webapps\Applet\WEB-INF\src\ApptoAppl.java
the Appl.java i get it from the applet tutorial here ..
any mistake here ??path any problem?..is it the ApptoAppl.java got problem ??..
besides tat i am sure my browser do support applet browsing and the applet do compile n work through intellij..plz help me figure where is my mistake ....thx a lot
ps: sorry bocz its copy n paste.. its in english |
|
|
|
|
|
|
|
|
|
|
发表于 17-4-2008 09:30 PM
|
显示全部楼层
b)
<body>
<applet code="ApptoAppl.class"
width="200" height="250">
</applet>
</body>
</html>
这是对的!
the path :
Apache Software Foundation\Tomcat 5.5\webapps\Applet\ApptoAppl.class
Apache Software Foundation\Tomcat 5.5\webapps\Applet\ApptoAppl.html
Apache Software Foundation\Tomcat 5.5\webapps\Applet\WEB-INF\src\ApptoAppl.java
*.java 是不需要的!
the Appl.java i get it from the applet tutorial here ..
any mistake here ??path any problem?..is it the ApptoAppl.java got problem ??..
是应该你告诉我们什么问题!
我在此看不到有问题!! |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 18-4-2008 03:03 AM
|
显示全部楼层
对不起。。句子不complete。。请您见量。。
这是ApptoAppl.java :
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.event.*;
import javax.swing.*;
import java.applet.Applet;
public class ApptoAppl extends Applet
implements ActionListener {
JLabel text;
JButton button;
JPanel panel;
private boolean _clickMeMode = true;
public void init(){
setLayout(new BorderLayout(1, 2));
setBackground(Color.white);
text = new JLabel("I'm a Simple Program");
button = new JButton("Click Me");
button.addActionListener(this);
add("Center", text);
add("South", button);
}
public void start(){
System.out.println("Applet starting.");
}
public void stop(){
System.out.println("Applet stopping.");
}
public void destroy(){
System.out.println("Destroy method called.");
}
public void actionPerformed(ActionEvent event){
Object source = event.getSource();
if (_clickMeMode) {
text.setText("Button Clicked");
button.setText("Click Again");
_clickMeMode = false;
} else {
text.setText("I'm a Simple Program");
button.setText("Click Me");
_clickMeMode = true;
}
}
}
问题是browser不能deploy这个applet。。我找不到原因在哪哩。。请您帮个忙。。 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|