• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Yet more swing applet web browser problems

 
emmett carter
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Cheers,
e
 
San Su
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a big applet on the web in http://www.jeasy.de 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
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>Card and Network Element Reconciliation</title>
</head>
<h2>
Card and Network Element Reconciliation
</h2>
<blockquote>
< !--"CONVERTED_APPLET"-->
< !-- CONVERTER VERSION 1.0 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"<br /> WIDTH = "500" HEIGHT = "400"<br /> codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,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">
<COMMENT>
<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="http://java.sun.com/products/plugin/1.1.1/plugin-install.html"><NOEMBED></COMMENT>
</XMP>
</NOEMBED></EMBED>
</OBJECT>
< !--<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 /> -->
< !--"END_CONVERTED_APPLET"-->
</body>
</html>
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);
}

}
Cheers,
e
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic