Link to home
Start Free TrialLog in
Avatar of need_help_pls
need_help_pls

asked on

How do I turn my existing Java code into an applet?

I have a number of Java classes that run a GUI from one main class.  How do i go about turning my application into an applet???

what classes do I need to change and how should I go about changing them?  any advice would be great?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of need_help_pls
need_help_pls

ASKER

my application does open files...  will that cause major problems??? just read access to the files though...??
how can I go about running the application as an applet though??  if all was well?
You'll have to recode the way it does that. They will have to be in the applet's codebase too, i.e. you can't wander outside that applet's own location in the directory tree.
(that is without signing or modification to the security policy)
>>how can I go about running the application as an applet though??  

In a browser or appletviewer
>>how can I go about running the application as an applet though??  

In a browser or appletviewer


---- but is there some modification that I need to make to my existing code for this to be feasible?? when I view some exsiting applet code that i have seen, they all seem to run this init() method - what is this about?
Yes, broadly speaking, you can see init() as being equivalent to your application's constructor and main() to the applet's start() method.
ok im not having much success with this... i have created my applet and running it from a basic html page but this is what i get:
my gui appears but opens as a separate application, i.e. as if i had run it independently... it is not part of the html page?!? - i assumed it would be

also, my application no longer works... for example i have a textfield that when input is entered and the user hits return, the text is supposed to be processed by the application and changes made to them gui but nothing happens and i do not get any errors either?!?!??!  HELP
i have probably gone wrong, but i basically just wrote my main method again within the init()
eg:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/** A class that allows testing of interpreter, its GUI and the GUIs controller
 * (listener).
 * @author
 */

public class InterpreterMain extends JApplet
{
     public void init(){
          Interpreter interpreter = new Interpreter();
          InterpreterController controller = new InterpreterController();
          InterpreterGUI gui = new InterpreterGUI(controller);
          controller.setInterpreter(interpreter);
          controller.setGUI(gui);


        /* GUIs are simply subclasses of JPanel, so we add the GUI
           to a JFrame and make the JFrame visible.
        */

          JFrame frm = new JFrame("JIN - Java Interpreter for Novice Programmers");
          Container contentPane = frm.getContentPane();
          contentPane.add(gui);

          JMenuBar menuBar = new JMenuBar();
          JMenu fileMenu = gui.makeMenu();
          menuBar.add(fileMenu);
          frm.setJMenuBar(menuBar);

          frm.addWindowListener(new WindowAdapter()
               {  public void windowClosing(WindowEvent we)
                  {  System.exit(0);
                  }
               });

          frm.pack();
          frm.setSize(700, 550);
          //frm.setSize(900, 600);
          frm.setVisible(true);

     }
     public static void main(String[] args)
     {
          /* Create interpreter, interpreter GUI and controller
          */

          Interpreter interpreter = new Interpreter();
          InterpreterController controller = new InterpreterController();
          InterpreterGUI gui = new InterpreterGUI(controller);
          controller.setInterpreter(interpreter);
          controller.setGUI(gui);


        /* GUIs are simply subclasses of JPanel, so we add the GUI
           to a JFrame and make the JFrame visible.
        */

          JFrame frm = new JFrame("JIN - Java Interpreter for Novice Programmers");
          Container contentPane = frm.getContentPane();
          contentPane.add(gui);

          JMenuBar menuBar = new JMenuBar();
          JMenu fileMenu = gui.makeMenu();
          menuBar.add(fileMenu);
          frm.setJMenuBar(menuBar);

          frm.addWindowListener(new WindowAdapter()
               {  public void windowClosing(WindowEvent we)
                  {  System.exit(0);
                  }
               });

          frm.pack();
          frm.setSize(700, 550);
          //frm.setSize(900, 600);
          frm.setVisible(true);

     }
}
>>opens as a separate application, i.e. as if i had run it independently... it is not part of the html page?!? - i assumed it would be


No. You use a frame, so it'll look like an application.

As far as the operation of the GUI is concerned, i can't comment on the problems there as the processing code doesn't appear in your post.
so to make the application just appear on the webpage i should not create a JFrame just add the components to the applet??  should this be done in init() or my main method of InterpreterMain??

The operation of the GUI works perfectly when run as a standard Java application that is why I didnt post the code... when I run it in a browser it doesnt work at all - when i run it in an applet viewwer it works perfectly also... its just that i need it to be able to be displayed in a browser window, i assume the problem stems from the fact that i open files for reading in my application and have not made any allowances for this when using the browser but i am not sure what allowances i need to make?
so to make the application just appear on the webpage i should not create a JFrame just add the components to the applet??  should this be done in init() or my main method of InterpreterMain??

The operation of the GUI works perfectly when run as a standard Java application that is why I didnt post the code... when I run it in a browser it doesnt work at all - when i run it in an applet viewwer it works perfectly also... its just that i need it to be able to be displayed in a browser window, i assume the problem stems from the fact that i open files for reading in my application and have not made any allowances for this when using the browser but i am not sure what allowances i need to make?
>>just add the components to the applet??  should this be done in init()

Yes and yes. AFAIK JApplet uses a BorderLayout by default so just treat your applet like the JFrame

>>
i assume the problem stems from the fact that i open files for reading in my application and have not made any allowances for this when using the browser
>>

Exactly what i would have guessed. The workaround here is
a. Instead of File, create a URL to the resoruce you want to read and get an input stream on it to read it.
b. Make sure the resource is in your applet's codebase
Sorry - yet another problem:

what do i do for the following...  i need to open a html file, which again works fine in the application, but not in the applet???

here is the code i am using currently:

     /**
      * Creates the help Panel
      *
      * @return thePanel ... the panel to be created
      */
     public JPanel createHelp()
     {
          JPanel thePanel = new JPanel();
          thePanel.setBorder(BorderFactory.createTitledBorder("Help"));

          ImageIcon back = new ImageIcon("back.jpg");
          JButton backBtn = new JButton(back);
          helpLbl = new JLabel(HELP_SELECT);

          try
          {
               ep = new JEditorPane("http://student.cs.ucc.ie/03/ekc1/projectHelp/test.html");
               ep.setPreferredSize(new Dimension(375,350));
               //ep.setPage(FILENAME);
          }
          catch (IOException ioe)
          {
               System.out.println(ioe.getMessage());
          }
          ep.setEditable(false);
          ep.addHyperlinkListener(new HyperlinkListener()
               {
                  public void hyperlinkUpdate(HyperlinkEvent he)
                  {
                       if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
                       {
                            JEditorPane pane = (JEditorPane) he.getSource();
                            try
                            {
                                 pane.setPage(he.getURL());
                            }
                            catch (IOException ioe)
                            {
                                 System.out.println(ioe.getMessage());
                            }
                       }
                  }
               });
         
         
          backBtn.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {
                    try
                    {
                         ep = new JEditorPane("http://student.cs.ucc.ie/03/ekc1/projectHelp/test.html#index");
                    }
                    catch (IOException ioe)
                    {
                         System.out.println(ioe.getMessage());
                    }
            }
        });

         
          JScrollPane viewer = new JScrollPane(ep);

          GridBagLayout gbl = new GridBagLayout();
          GridBagConstraints gbc = new GridBagConstraints();
          thePanel.setLayout(gbl);
          gbc.fill = GridBagConstraints.BOTH;
          gbc.anchor = GridBagConstraints.CENTER;
          gbc.insets = new Insets(4, 4, 4, 4);
          addComp(helpLbl, thePanel, gbl, gbc, 0, 0, 1, 150, 0, 0);
          //addComp(backBtn, thePanel, gbl, gbc, 0, 150, 1, 1, 0, 0);
          addComp(viewer, thePanel, gbl, gbc, 1, 0, 400, 400, 0, 0);

          return thePanel;
     }
Is your applet being served from http://student.cs.ucc.ie?
yeah.. applet is served from student.cs.ucc.ie
Comment out the ImageIcon bit and let me know what happens
the same - makes no difference...
when i hit the help btn in the gui my controller calls the above method create help, when i hit the help btn i get errors along the lines of :

java.security.AccessControlException: access denied (java.net.SocketPermission s
tudent.cs.ucc.ie resolve)
        at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:270)
        at java.security.AccessController.checkPermission(AccessController.java:
401)
OK. I think you'll have to eliminate the potential problems one at a time, so comment out one thing at a time.
Try empty constructor and getStream on the editor pane
ok:

sorry bout this its just that this is part of my final year project that is due to present on thursday so im kind of scared now:

my applet still doesnt work in the browser i have made the following changes below, and still all that happens is that it loads but wont work...

also, i still cannot get the help button to work in the applet viewer, however when i run it in the browser the panel will display but none of the links work????

im really confused!?!?!  any help would be great? emergency...

     public InputStream getData(String filename) throws Exception
     {
          InputStream is = null;
          try
          {
               //The applet is being run locally
               is = new FileInputStream(filename);
          }
          catch (SecurityException se)
          {
               //The applet is being run across the internet
               //getDocumentBase();
               //URL current = getDocumentBase();
               URL current = new URL("http://student.cs.ucc.ie/03/ekc1/project/GUIstuff/run.html");
               URL cgi = new URL(current.getProtocol(),
               current.getHost(), current.getPort(),

               current.getPath()+"/cgiread.cgi?filename="+filename);
               URLConnection con = cgi.openConnection();
               con.setDoOutput(true);
               con.setDoInput(true);
               con.setUseCaches(false);
               con.setRequestProperty("Content-type","text/plain");

               PrintStream out = new PrintStream(con.getOutputStream());
               out.print(filename);
               out.flush();
               out.close();
               
               is = con.getInputStream();
          }
          return is;
     }

     
     /**
      * Checks that the variable name supplied is valid
      * @return boolean
      */
     public boolean checkName(String theText)
     {
          try
          {
               BufferedReader validName = new BufferedReader(new InputStreamReader(getData("validChar.txt")));
               
               String letter = new String();
               
               while(validName.ready())
               {
                    StringTokenizer letterStk = new StringTokenizer(validName.readLine(), "\n");
                    letter = (String)letterStk.nextToken();
                   
                    if(theText.startsWith(letter))
                    {
                         return true;
                    }
               }
               if(!validName.ready())
               {
                    validName.close();
                    validName = new BufferedReader(new InputStreamReader(getData("validChar.txt")));
               }

               validName.close();
               return false;

          }
          catch(Exception ioe)
          {
               System.out.println("File not found");
               ioe.printStackTrace();
               return false;
          }
         
     }


where cgiread.cgi is:
#!/usr/bin/perl

@values = split(/&/,$ENV{'QUERY_STRING'});
foreach $i (@values) {
    ($varname, $mydata) = split(/=/,$i);
    if ($varname == "filename")
    {
        $filename = $mydata;
    }
}

open(INFO, $filename);
@array=<INFO>;
close (INFO);
print "Content-type: text/plain\n\n";
foreach $line (@array)
{
print $line;
}
exit;
OK. The first thing you must do is to pay very close attention to the stack trace of any Exceptions. Check the plugin console
im so sorry this is going to soud like a very silly question, it is just that i have never written/used any applet before, but how do i check the console when i am running the applet from a browser?
so not sure how to check what the problem is when i run it in the browser??

but, when i run it in the appletviewer i dont get any errors when running it until i hit the help button which gives: (i dont understand this error really - )

java.security.AccessControlException: access denied (java.net.SocketPermission s
tudent.cs.ucc.ie resolve)
        at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:270)
        at java.security.AccessController.checkPermission(AccessController.java:
401)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
        at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
        at java.net.InetAddress.getAllByName0(InetAddress.java:909)
        at java.net.InetAddress.getAllByName0(InetAddress.java:890)
        at java.net.InetAddress.getAllByName(InetAddress.java:884)
        at java.net.InetAddress.getByName(InetAddress.java:814)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:282)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:253)
        at sun.net.www.http.HttpClient.New(HttpClient.java:321)
        at sun.net.www.http.HttpClient.New(HttpClient.java:306)
        at sun.net.www.http.HttpClient.New(HttpClient.java:301)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:469)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:460)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:562)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:237
)
        at javax.swing.JEditorPane.getStream(JEditorPane.java:674)
        at javax.swing.JEditorPane.setPage(JEditorPane.java:392)
        at javax.swing.JEditorPane.setPage(JEditorPane.java:775)
        at javax.swing.JEditorPane.<init>(JEditorPane.java:249)
        at InterpreterGUI.createHelp(InterpreterGUI.java:362)
        at InterpreterGUI.helpFrame(InterpreterGUI.java:337)
        at InterpreterController.actionPerformed(InterpreterController.java:64)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
67)
        at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1820)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:419)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257
)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:258)
        at java.awt.Component.processMouseEvent(Component.java:5021)
        at java.awt.Component.processEvent(Component.java:4818)
        at java.awt.Container.processEvent(Container.java:1525)
        at java.awt.Component.dispatchEventImpl(Component.java:3526)
        at java.awt.Container.dispatchEventImpl(Container.java:1582)
        at java.awt.Component.dispatchEvent(Component.java:3367)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359
)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3074)

        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
        at java.awt.Container.dispatchEventImpl(Container.java:1568)
        at java.awt.Component.dispatchEvent(Component.java:3367)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:191)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:144)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

OK, you can test it in appletviewer at first and then move to the browser later. Are you connecting outside your codebase in InterpreterGUI.createHelp(InterpreterGUI.java:362)?
(InterpreterGUI.java:362)
ep = new JEditorPane("http://student.cs.ucc.ie/03/ekc1/projectHelp/test.html");


I run this code when using an appletviwer from my home directory on ocean(student.cs.ucc.ie), then a copy of this folder is uploaded to /csweb/03/ekc1/project/ which is ocean's web repository.  projectHelp/test.html is just another directory within that web repository.  All the code is identical to what is in my home directory.  When I run the code in my home directory, it does, as you can see above access the on-line version of test.html.

When i run in using an appletviewer from my home directory the aforementioned result of clicking the help btn occurs.  The java application works.
(InterpreterGUI.java:362)
ep = new JEditorPane("http://student.cs.ucc.ie/03/ekc1/projectHelp/test.html");


I run this code when using an appletviwer from my home directory on ocean(student.cs.ucc.ie), then a copy of this folder is uploaded to /csweb/03/ekc1/project/ which is ocean's web repository.  projectHelp/test.html is just another directory within that web repository.  All the code is identical to what is in my home directory.  When I run the code in my home directory, it does, as you can see above access the on-line version of test.html.

When i run in using an appletviewer from my home directory the aforementioned result of clicking the help btn occurs.  The java application works.
In that case, you haven't followed my suggestion from earlier:

>>Try empty constructor and getStream on the editor pane
You should construct the URL argument to that function as follows:

URL url = new URL(getCodeBase(), "somefile");

Find out what getCodeBase() returns so you can form the URL properly.
sorry im not sure that i understand?  Im just looking at the apis for getStream and not sure how you mean me to use it..??
you mean the constructor for the EditorPane should be
ep = new JEditorPane();
but how do i go about setting the page then? using getStream?
URL url = new URL(getCodeBase(), "somefile");
ep.getStream(url);

i think!
Z:\Project\GUIstuff>javac *.java
InterpreterGUI.java:365: cannot resolve symbol
symbol  : method getCodeBase  ()
location: class InterpreterGUI
                        URL url = new URL(getCodeBase(), "test.html");
                                          ^
InterpreterGUI.java:366: getStream(java.net.URL) has protected access in javax.s
wing.JEditorPane
                        ep.getStream(url);
                          ^
2 errors
getCodeBase() needs to be in applet's scope.

Sorry - try setPage with that code instead of getStream
uh-oh!  this code is all in my GUI class - I am not creating the applet here.  I have a separate class InterpreterMain that orignally invoked the GUI, that now creates the applet....  is there anyway around this??
Pass the applet as a parameter to an appropriate constructor.
I will try and explain that better.  my applet opens fine in the appletviewer and runs ok - the only problem i have with it in the applet viewer is when i hit the help button.  What should happen is that my actionlistener is my controller class will call gui.createHelp() which is the method pasted above that the code snipets are from.  this works fine in the applcation but not in the appletviwer.  (in the browser the editorpane loads but the link dont work - if that sheds any light on the matter)

ps:  I realise this must be very annoying, but i cant say how much i appreciate you taking the time for this - cant ask any class mates as they are all very busy too - so on my own and really stressed now - 1 day to go - arrrrggghhh!!! (maybe i should rethink my career choice!!!?!?!)   : )
this is where i create the applet - how else should i do it if i need to pass it as a param to the gui class (if i picked up what you said correctly??)

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/** A class that allows testing of interpreter, its GUI and the GUIs controller
 * (listener).
 * @author Katie Crowley 99037190 ekc1@student.cs.ucc.ie
 */

public class InterpreterMain extends JApplet
{
     public void init(){
          Interpreter interpreter = new Interpreter();
          InterpreterController controller = new InterpreterController();
          InterpreterGUI gui = new InterpreterGUI(controller);
          controller.setInterpreter(interpreter);
          controller.setGUI(gui);


        /* GUIs are simply subclasses of JPanel, so we add the GUI
           to a JFrame and make the JFrame visible.
        */

          //JFrame frm = new JFrame("JIN - Java Interpreter for Novice Programmers");
          Container contentPane = this.getContentPane();
          contentPane.add(gui);

          JMenuBar menuBar = new JMenuBar();
          JMenu fileMenu = gui.makeMenu();
          menuBar.add(fileMenu);
          this.setJMenuBar(menuBar);

          /*this.addWindowListener(new WindowAdapter()
               {  public void windowClosing(WindowEvent we)
                  {  System.exit(0);
                  }
               });

          this.pack();*/
          this.setSize(700, 550);
          //frm.setSize(900, 600);
          this.setVisible(true);

     }
     public static void main(String[] args)
     {
          /* Create interpreter, interpreter GUI and controller
          */

          Interpreter interpreter = new Interpreter();
          InterpreterController controller = new InterpreterController();
          InterpreterGUI gui = new InterpreterGUI(controller);
          controller.setInterpreter(interpreter);
          controller.setGUI(gui);


        /* GUIs are simply subclasses of JPanel, so we add the GUI
           to a JFrame and make the JFrame visible.
        */

          JFrame frm = new JFrame("JIN - Java Interpreter for Novice Programmers");
          Container contentPane = frm.getContentPane();
          contentPane.add(gui);

          JMenuBar menuBar = new JMenuBar();
          JMenu fileMenu = gui.makeMenu();
          menuBar.add(fileMenu);
          frm.setJMenuBar(menuBar);

          frm.addWindowListener(new WindowAdapter()
               {  public void windowClosing(WindowEvent we)
                  {  System.exit(0);
                  }
               });

          frm.pack();
          frm.setSize(700, 550);
          //frm.setSize(900, 600);
          frm.setVisible(true);

     }
}
Don't worry - these security constrictions are a pain!

>>the only problem i have with it in the applet viewer is when i hit the help button.  

My guess is it's down to the way the url is created, a suggested solution to which i've just given
Maybe here?

>>InterpreterGUI gui = new InterpreterGUI(controller);

as

>>InterpreterGUI gui = new InterpreterGUI(controller, this);

but the applet is created in InterpreterMain??
sorry the confusion is probably due to the fact that i have been looking at this code everyday for the past few months and now im just all over the place!?!?
my labs are closing now, so I will check the site again in the morning.  hopefully things will be a bit clearer for me then also - thanks again, (goodnight/day whatever part of globe!!!)
>>but the applet is created in InterpreterMain??

The applet reference is in scope here, so you should have no problem:

>>InterpreterGUI gui = new InterpreterGUI(controller, this);
ok, so i changed the constructor for interpreterGUI to take it the applet and then ran it in the appletviewer with the following results:

java.lang.NullPointerException
        at InterpreterGUI.createHelp(InterpreterGUI.java:367)
        at InterpreterGUI.helpFrame(InterpreterGUI.java:339)
        at InterpreterController.actionPerformed(InterpreterController.java:64)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
67)
        at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1820)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:419)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257
)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:258)
        at java.awt.Component.processMouseEvent(Component.java:5021)
        at java.awt.Component.processEvent(Component.java:4818)
        at java.awt.Container.processEvent(Container.java:1525)
        at java.awt.Component.dispatchEventImpl(Component.java:3526)
        at java.awt.Container.dispatchEventImpl(Container.java:1582)
        at java.awt.Component.dispatchEvent(Component.java:3367)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359
)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3074)

        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
        at java.awt.Container.dispatchEventImpl(Container.java:1568)
        at java.awt.Component.dispatchEvent(Component.java:3367)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:191)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:144)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
Then you probably haven't passed the reference on properly to the InterpreterGUI.
in InterpreterMain i have changed to :
public class InterpreterMain extends JApplet
{
     public void init()
     {
          Interpreter interpreter = new Interpreter();
          InterpreterController controller = new InterpreterController();
          InterpreterGUI gui = new InterpreterGUI(controller,this);
.... etc etc
}}

and in InterpreterGUI:

public InterpreterGUI(InterpreterController theController, JApplet j)
   {
      super();
       
       myApplet = j;
       
      /* Store the interpreter controller */
      controller = theController;
etc etc...
}

and in InterpreterGUI.createHelp()
               URL url = new URL(myApplet.getCodeBase(), "test.html");
               ep.setPage(url);
Is this line 367?

>>URL url = new URL(myApplet.getCodeBase(), "test.html");
line 367 = ep.setPage(url);
1. Is ep valid?
2. Did you make sure that getCodeBase() returns what you think it does as i suggested before?
code base returns :  file:/Z:/Project/GUIstuff/

ep should be valid... i have it declared as
private JEditorPane ep;
1. I mean is the refence null, obviously
2. Is this url valid?
file:/Z:/Project/GUIstuff/test.html
IT WORKS NOW!!!!!! not sure why but am so happy that it does!!!!!!   maybe i should just leave it run in the appletviewer???  would it be very difficult to get it working in the browser??? thank you sooooo much - im so grateful!!!!!!!!!
>>not sure why

Why not? Surely you know what you've changed!?
need_help_pls:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to CEHJ

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer