run Java applet with <param> from HTML

A

Andrew Neiderer

This is simple HTML, Java but I am really confused. I include the code since
it is so small -

----------------------------------------------------------------------------

-- test.html --

<html>
<head>
<title>
run Java applet
</title>
</head>

<body>
<applet code="ContentExtractionApplet.class" width="580" height="25">
<param name="fontName" value="Arial"/>
<param name="fontSize" value="12"/>
<param name="msg" value="http://english.pravda.ru/news/world/25-04-2007"/>
</applet>
</body>
</html>

-- ContentExtractionApplet.java --

import java.applet.Applet;
import java.awt.*;

public class ContentExtractionApplet extends Applet {
// private representation

Label msgLabel;
Font msgFont;

/* this is called by the browsers JVM when applet is instantiated */

public void init()
{
// setting the applet Layout
setLayout(new BorderLayout());

msgFont = new Font(getParameter("fontName"),Font.BOLD,
Integer.parseInt(getParameter("fontSize")));


msgLabel = new Label(getParameter("msg"));
msgLabel.setFont(msgFont);

add(BorderLayout.CENTER,msgLabel);
}
}
--------------------------------------------------------------------------

The Java translates fine, and the applet runs when loaded in Mozilla Ff.

But if I replace "msg" with "message" in <param> and "msgLabel = ..." above
nothing shows up in my Ff browser :-(
Note a total of only 2 substitutions.

Any ideas what I am missing?

Thank you.

- Andrew M. Neiderer
US Army Research Laboratory
 
M

Matt Humphrey

|
| This is simple HTML, Java but I am really confused. I include the code
since
| it is so small -

<snip HTML>

|
| The Java translates fine, and the applet runs when loaded in Mozilla Ff.
|
| But if I replace "msg" with "message" in <param> and "msgLabel = ..."
above
| nothing shows up in my Ff browser :-(
| Note a total of only 2 substitutions.
|
| Any ideas what I am missing?

Your code looks fine. Are you sure you're clearing the browser's cache? It
may just be running the old applet.
 
?

=?ISO-8859-1?Q?G=E9rard_Talbot?=

Followup-to set: comp.infosystems.www.authoring.html

Andrew Neiderer wrote :
This is simple HTML, Java but I am really confused. I include the code since
it is so small -

Whenever you have a problem with a webpage, the very first things to do is
1- Validate the markup code of the page: if you find errors with that
webpage, then they have to be fixed. There is no other first steps to
perform. Removing markup errors may not fix the webpage issues or
problems but it might and it will definitely remove that source as
possible cause of the webpage's problems.

2- Validate the CSS code for the same reasons.

Most of the time (I'd say well above 75%), the layout problems can be
found and fixed with these 2 validation steps/process.

Why we won't help you by Mark Pilgrim
http://diveintomark.org/archives/2003/05/05/why_we_wont_help_you

----------------------------------------------------------------------------

-- test.html --

<html>

No doctype declaration. Your absence of doctype declaration will trigger
visual browsers into backward compatible mode (or quirks mode): in that
rendering mode, different browsers (and different versions of the same
browsers) will render webpage more differently. Instead, by declaring a
strict DTD in a doctype declaration, you would force browsers to conform
more closely to W3C web standards recommendations.
<head>
<title>
run Java applet
</title>
</head>

<body>
<applet code="ContentExtractionApplet.class" width="580" height="25">
<param name="fontName" value="Arial"/>

Have you checked your code with the HTML 4.01 recommendation? Where do
you see that an <applet> can have nested <param>

http://www.w3.org/TR/html4/struct/objects.html#edef-APPLET

<param name="fontSize" value="12"/>
<param name="msg" value="http://english.pravda.ru/news/world/25-04-2007"/>
</applet>
</body>
</html>
- Andrew M. Neiderer
US Army Research Laboratory

Andrew,

please visit section
Using Web Standards in your Web Pages
2 Making your page using web standards: how to
Section 2.2.4.2 What if I use <applet>?
http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_Pages

Followup-to set: comp.infosystems.www.authoring.html

Gérard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top