Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Need to see my Applet in Netscape4.x and IE4.x

Posted on 1998-11-19
7
279 Views
Last Modified: 2013-11-23
I use JBuilder 2 client/server on WinNT4, Win95.
JBuilder 2 use JDK 1.1.6 and Swing 1.0.1, by default.

I build some Applet, in JBuilder everything work 100% ok.
But now when I try to test my Applet with Netscape4.x and IE4.x, Netscape I cann't have my applet and in IE4 I see a gray applet but nothing in.

In my test I just use one button and one label (in java.awt)on the applet, so nothing very exciting.

I need to know step by step how I can see my Applet in
Netscape 4.0x and 4.5.  And the same in Internet Explorer 4.x.

BTW how I use JRE like a plug-ins ?

Please be explicit....
Thanks, Zeric
0
Comment
Question by:Zeric
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227888
if you use only standard java classes you should see your applet in both browsers ... so maybe there is some Borland specific class that your applet needs ...

post here the sourse code and the erro message that you receive when you try to open the applet in both browsers (for NN chose Communicator/Java console) and maybe we can help ...
  heyhey
0
 

Author Comment

by:Zeric
ID: 1227889
When I use Visual Cafe or JDK directly everything work well.  

But now I have a project with JBuilder so when I'm in environment every is OK, but when I try the HTML page that JBUILDER give to me I always receive in Netscape 4.5
Applet HelloApplet.MyApplet class HelloApplet.MyApplet could not be loaded

and in IE4 I don't receive any error, just gray applet I don't see nothing in my applet.


I test with JBUILDER 1.0 too and I have the same problem.... here the structure in JBuilder 1.0

h:\JBuilder\myprojects\MyApplet.html
h:\JBuilder\myprojects\MyApplet.java
h:\JBuilder\myprojects\HelloApplet.jpr    <=== project file

the compiles files are in an other directory
h:\JBuilder\myclasses\MyApplet.class
h:\JBuilder\myclasses\MyApplet_button1_actionAdapter.class

==============================================

<HTML>
<TITLE>
My Applet HTML test
</TITLE>
<BODY>
MyApplet will appear below in a Java enabled browser.<BR>
<APPLET
  CODEBASE = "."
  CODE     = "HelloApplet.MyApplet.class"
  NAME     = "MyApplet"
  WIDTH    = 400
  HEIGHT   = 300
  HSPACE   = 0
  VSPACE   = 0
  ALIGN    = Middle
>
</APPLET>
</BODY>
</HTML>
================================================
Here my java code source in h:\JBuilder\myprojects\MyApplet.java

package HelloApplet;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;

public class MyApplet extends Applet {
  XYLayout xYLayout1 = new XYLayout();
  boolean isStandalone = false;
  Label label1 = new Label();
  Button button1 = new Button();

  //Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  }

  //Construct the applet
  public MyApplet() {
  }

  //Initialize the applet
  public void init() {
    try { jbInit(); } catch (Exception e) { e.printStackTrace(); }
  }

  //Component initialization
  public void jbInit() throws Exception{
    xYLayout1.setWidth(400);
    xYLayout1.setHeight(300);
    label1.setText("Bienvenue");
    button1.setLabel("Bonjour");
    button1.addActionListener(new MyApplet_button1_actionAdapter(this));
    this.setLayout(xYLayout1);
    this.add(label1, new XYConstraints(38, 39, 111, 42));
    this.add(button1, new XYConstraints(26, 110, 117, 50));
  }

  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }

  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }

  void button1_actionPerformed(ActionEvent e) {
    label1.setText("Bonjour");
  }
}

class MyApplet_button1_actionAdapter implements java.awt.event.ActionListener {
  MyApplet adaptee;

  MyApplet_button1_actionAdapter(MyApplet adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.button1_actionPerformed(e);
  }
}


Thanks
Zeric
0
 

Author Comment

by:Zeric
ID: 1227890
I forgot, in my other test in JBuilder 2.0 I use Swing...
Thanx
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 16

Expert Comment

by:heyhey_
ID: 1227891
I don't see any 'not pure' java code except these lines

>> import borland.jbcl.layout.*;
>> import borland.jbcl.control.*;
(and maybe the XYLayout)

so if you take them away the applet will probably work
if you use some specific Borland classes in your applet, you should distribute them with the applet ...
read Borland documentation for more information ...
if you use Swing in your applet, you should check the article "Make your browser Swing" at Javasoft's Swing Connection

hope this helps
  heyhey
0
 

Author Comment

by:Zeric
ID: 1227892
It'sn't solve my problem.
JBW, I remove import borland.jbcl.layout.*; reference and it's always not load my applet (or japplet for my other swing exemple).  So the problem it's somewhere in the organisation directory and in my html code, but I don't see.

I put the plug-ins java-1.1.1 in my Netscape browser, the problem persited....

I made many other Java application and applet with Visual Cafe or directly with JDK, and it was always working.... and know just because I change for JBuilder it'sn't working in Netscape, but it's work very well in the appletviewer in JBuilder...

Thanks.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227893
in Netscape go to the menu
"Communicator / Java Console"

open the console.
load your applet
check the console to see what's the error message - and post it here

most probably your applet uses some BOrland specific classes that can't be found from Netscape.

0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 200 total points
ID: 1227894
so
1.)
modify your code, so that it use only standard Java classes
(at the moment you use XYLayout that is Borland extension)

---- start

package HelloApplet;
      import java.awt.*;
      import java.awt.event.*;
      import java.applet.*;

      public class MyApplet extends Applet {
//        XYLayout xYLayout1 = new XYLayout();
        LayoutManager xYLayout1 = new GridLayout(2,1);
        boolean isStandalone = false;
        Label label1 = new Label();
        Button button1 = new Button();

        //Get a parameter value
        public String getParameter(String key, String def) {
          return isStandalone ? System.getProperty(key, def) :
            (getParameter(key) != null ? getParameter(key) : def);
        }

        //Construct the applet
        public MyApplet() {
        }

        //Initialize the applet
        public void init() {
          try { jbInit(); } catch (Exception e) { e.printStackTrace(); }
        }

        //Component initialization
        public void jbInit() throws Exception{
//          xYLayout1.setWidth(400);
//          xYLayout1.setHeight(300);
          label1.setText("Bienvenue");
          button1.setLabel("Bonjour");
          button1.addActionListener(new MyApplet_button1_actionAdapter(this));
          this.setLayout(xYLayout1);
//          this.add(label1, new XYConstraints(38, 39, 111, 42));
//          this.add(button1, new XYConstraints(26, 110, 117, 50));
          this.add(label1);
          this.add(button1);
        }

        //Get Applet information
        public String getAppletInfo() {
          return "Applet Information";
        }

        //Get parameter info
        public String[][] getParameterInfo() {
          return null;
        }

        void button1_actionPerformed(ActionEvent e) {
          label1.setText("Bonjour");
        }
      }

      class MyApplet_button1_actionAdapter implements java.awt.event.ActionListener {
        MyApplet adaptee;

        MyApplet_button1_actionAdapter(MyApplet adaptee) {
          this.adaptee = adaptee;
        }

        public void actionPerformed(ActionEvent e) {
          adaptee.button1_actionPerformed(e);
        }
      }

---- end

since you use packeges put the applet classes one direrectory deeper than the HTML file

so if the html is here
      h:\JBuilder\myprojects\MyApplet.html

put the class files here
      h:\JBuilder\myclasses\HelloApplet\MyApplet.class
      h:\JBuilder\myclasses\HelloApplet\MyApplet_button1_actionAdapter.class

I've TESTED this and i can see the apllet with AppletViewer NC and IE.
the applet uses only standard java clases so it will work everywhere ...

(Note:
If you need to use some specific Borland classes in your applet, you should distribute these classes with the applet ...
Please, Read Borland documentation for more information on how to do this ...
If you need to use Swing in your applet, this applet can be viewd only with browsers the Support Swing, Please Read the article "Make your browser Swing" at Javasoft's Swing Connection
)

so now it is PureJava and it works.
More problems ?
 
  heyhey
P.S.
>> JBW, I remove import borland.jbcl.layout.*; reference and it's always not load my applet
if you have remove import borland.* lines you  won't be able even to compile the applet since XYLayout is borlad class.
>> but it's work very well in the appletviewer in JBuilder...
it do, of course, but i know how to use all the Borland specific clases, and Swing classes ... and NC does not.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
netstat -ano | find "8000" and taskkill /f /pid 2984 3 81
diffSum example 4 50
table example 4 32
spring jars download 1 35
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question