Click here to get back home

run Java applet with from HTML

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
run Java applet with from HTML Andrew Neiderer 04-27-2007
Posted by Andrew Neiderer on April 27, 2007, 8:37 am
Please log in for more thread options



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

Posted by Matt Humphrey on April 27, 2007, 9:32 am
Please log in for more thread options



|
| 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.



Posted by =?ISO-8859-1?Q?G=E9rard_Talbot on April 27, 2007, 6:51 pm
Please log in for more thread options


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
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_Pages

Similar ThreadsPosted
java applet alternate text March 2, 2007, 11:34 am
Java applet building tool - new version January 18, 2005, 8:06 am
Loading picture before the using java applet / progress bar or waiting message ? October 8, 2004, 12:05 am
open a java window from html October 8, 2004, 11:46 am
applet vs. object. vs embed? August 14, 2006, 11:08 am
preserve line breaks in applet parameters January 27, 2007, 10:10 pm
java apploet problem with mozilla and firefox February 22, 2005, 9:42 pm
Does the following java programming architecture make sense? April 20, 2005, 11:30 am
JSTE (Javascript Templating Engine for Java) available July 7, 2007, 3:09 pm
Detecting if the client browser disabled/allows java applets ? November 1, 2004, 9:30 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap