Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Yet more swing applet web browser problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Yet more swing applet web browser problems" Watch "Yet more swing applet web browser problems" New topic

Yet more swing applet web browser problems

emmett carter

Joined: Jun 19, 2001
Posts: 2
I've got what seems to be a fairly common problem on this message board - I can't get my swing applet to work in my ie 5 web browser - I've followed all the advice given so far, downloaded and enabled the java plugin, used the html converter and the applet seems to run without error! but none of the components appear - I can't even make one button appear - neeedless to say it works fine with the applet viewer! When I run the mouse over the applet in the browser 'Applet Started' appears in the status bar - does anyone know what's going on, any help would be appreciated.
San Su
Ranch Hand

Joined: Jul 06, 2001
Posts: 313

Do you get any errors in the console window ? Please
write a small JApplet ( with only one component it ) and
try to open it in the browser. If you get any error
please post the error with your sourcecode.
Harry Pfohl

Joined: Apr 21, 2001
Posts: 17
There is a big applet on the web in that runs with the PlugIN. Try to run the applet JEasy Repository. If it works it is something wrong in your source or html.
You may download JEasy and look at the Example source. There is an Example.html that works well.
I had the same problem before. Seeing nothing on the screen but the applet runs.
Here are some important lines:
public class Example extends JApplet {
// extends from JApplet not Applet
If your main window is a panel don't forget that you have to add
a child to its contentPane:
getContentPane().setLayout(new BorderLayout());
// first set the Layout of the panel
getContentPane().add( yourPanel, BorderLayout.CENTER);
// then add your panel to the Applets contentPane
Good luck

[This message has been edited by Harry Pfohl (edited July 09, 2001).]
emmett carter

Joined: Jun 19, 2001
Posts: 2
Ok still no joy - I've stipped everything out, just one label left but still nothing - the applet appears to run fine with no errors, it just doesn't display anything, I've tries setting visible, repainting etc.Other applets work fine with my browser. Here's the html and java - can anyone see what's wrong - it works fine with the applet viewer btw.
<title>Card and Network Element Reconciliation</title>
Card and Network Element Reconciliation
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"<br /> WIDTH = "500" HEIGHT = "400"<br /> codebase=",3,0,0">
<PARAM NAME = CODE VALUE = "reconciliation/ReconciliationApplet.class" >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
<PARAM NAME = CODE VALUE = "reconciliation/ReconciliationApplet.class" >
<PARAM NAME = "type" VALUE ="application/x-java-applet;version=1.1.2">
<EMBED type="application/x-java-applet;version=1.1" java_CODE = "reconciliation/ReconciliationApplet.class" WIDTH = "500" HEIGHT = "300" CODE = "reconciliation/ReconciliationApplet.class" type = "application/x-java-applet;version=1.1.2" databaseID = "DIM8" databasePassword = "DIMENSION" pluginspage=""><NOEMBED></COMMENT>
< !--<br /> <APPLET CODE = "reconciliation/ReconciliationApplet.class" WIDTH = "500" HEIGHT = "300" ><br /> <PARAM NAME = CODE VALUE = "reconciliation/ReconciliationApplet.class" ><br /> <PARAM NAME = "type" VALUE ="application/x-java-applet;version=1.1.2"><br /> </XMP><br /> </APPLET><br /> -->
package reconciliation;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import oracle.jdeveloper.layout.*;
import oracle.dacf.layout.*;
import java.util.*;
* Applet

* @author Emmett Carter
public class ReconciliationApplet extends JApplet

public ReconciliationApplet()
* Initializes the state of this instance.
* init
public void init()
JLabel label = new JLabel();
getContentPane().setLayout(new BorderLayout());
label.setText("This is a label");
getContentPane().add(label, BorderLayout.CENTER);

I agree. Here's the link:
subject: Yet more swing applet web browser problems
It's not a secret anymore!