JApplet to Web

Hi i have a JApplet created in a class called Black.java. The applet runs grand in eclipse, in the package colour. Colour is in a project named MacVersion so the path reads MacVersion/colour/Black.java. In this package (colour) i have created a html file but the 'applet code' is not correct as i am getting an error in IE saying 'Loading applet failed' it is notinited. Were should i have the html file and what should i have in the 'applet code'?
Thanks.

Done a little reading on this.
You aren't obliged to specify the CODEBASE. If you don't then it defaults to, as I read it, the same directory as the URL loading the applet. I suspect that this may be a folder short, i.e. the folder containing your applet folder. For the effort involved you might as well specify the CODEBASE as the applet folder and put all of your classes in there.
Not sure about your classdef problem. I tend to work with MySQL and so the code I have in the applets HTML document generally looks something like this:
<applet code="HEmPApplet.class"
     archive="classes/HEmPApplet.jar,classes/mysql-connector-java-2.0.14-bin.jar"
     width="680" height="480">
</applet>You'll notice that I haven't included a CODEBASE attribute. That's because I JAR all of my classes. The MySQL file is that standard file that is downloadable from their site. The JAR files are (obviously) in a subfolder called classes.
Hope this helps.

Similar Messages

  • Lots of code, Little problem....

    Does anyone have how to get this program to run this line when the close box is pressed:
    userClosed("Connection Closing.", isC);
    This line sends that message to the other client program connected to it. I can get this line to run when the menu exit selection is called, but when the close box is pushed, nothin?
    This was a possible fix and from what I can tell should have worked. I'm trying to add some lines that say:
              Runtime.getRuntime().addShutdownHook(new Thread()
                   public void run()
                        userClosed("Connection Closing.", isC);
              });But for Some reason it doesn't seem to be working? I know the above code is valid, it works in other programs.
    The other possible fix is:
    When the Admin's default constructor is called, it is called from another program that MUST be kept running. When the Admin's client program shuts down I'm using a dispose() to protect the calling program from being shutdown. If someone can tell me how to shutdown this program without killing the calling program, that might work too.
    Thanks!
    /*  A simple Swing based client that talks to the Switch  */
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TrialClient extends JFrame implements GMReceiver    //-------------
         JTextField userText = new JTextField(40);
         JTextArea log = new JTextArea(24,40);
         JPanel outPanel = new JPanel();
         JScrollPane logScroll = new JScrollPane(log);
         JMenuBar menuBar = new JMenuBar();
         JMenuItem startItem = new JMenuItem("Start");
         JMenuItem hostItem = new JMenuItem("Host");
         JMenuItem aboutItem = new JMenuItem("About");
         JMenuItem exitItem = new JMenuItem("Exit");
         JMenu fileMenu = new JMenu("File");
         JMenu helpMenu = new JMenu("Help");
         Container cp;
         RemoteUser remote;
         String address="genesis.zedxinc.com";
         int port1=8000; int port2 = 8001; int port = 0;
         boolean running;
         int isC; Socket contin; int isApp;
         TrialClient()    //Client Default Constructor-------------------------------
              isC = 0;
              port = port1;
              String userName = JOptionPane.showInputDialog
                        (null, "Please Enter Your Name:", "ZedX Web Messenger", JOptionPane.QUESTION_MESSAGE);
              buildMenu();
              cp = getContentPane();
              log.setEditable(false);
              outPanel.add(new JLabel("Send: "));
              outPanel.add(userText);
              userText.addActionListener(new ActionListener()     {public void actionPerformed(ActionEvent evt){userTyped(evt);}});
              cp.setLayout(new BorderLayout());
              cp.add(outPanel,BorderLayout.NORTH);
              cp.add(logScroll,BorderLayout.CENTER);
              userName = "Client: " + userName;
              setTitle(userName);
              addWindowListener(new WindowAdapter()
                   {public void windowClosing(WindowEvent evt){mnuExit();}});
              toLog("!! use start menu to start");
              toLog("!! host is "+address+":"+port1);
              pack();
         TrialClient(JApplet a)    //Web Client Default Constructor-------------------------------
              isC = 0;
              isApp = 1;
              port = port1;
              String userName = JOptionPane.showInputDialog
                        (null, "Please Enter Your Name:", "ZedX Web Messenger", JOptionPane.QUESTION_MESSAGE);
              buildMenu();
              cp = getContentPane();
              log.setEditable(false);
              outPanel.add(new JLabel("Send: "));
              outPanel.add(userText);
              userText.addActionListener(new ActionListener()     {public void actionPerformed(ActionEvent evt){userTyped(evt);}});
              cp.setLayout(new BorderLayout());
              cp.add(outPanel,BorderLayout.NORTH);
              cp.add(logScroll,BorderLayout.CENTER);
              userName = "Client: " + userName;
              setTitle(userName);
              addWindowListener(new WindowAdapter()
                   {public void windowClosing(WindowEvent evt){mnuExit();}});
              toLog("!! use start menu to start");
              toLog("!! host is "+address+":"+port1);
              pack();
         TrialClient(String s, Socket myServer)    //Admin Default Constructor-------
              isC = 1;
              port = port2;
              String userName = s;
              contin = myServer;
              buildMenu();
              cp = getContentPane();
              log.setEditable(false);
              outPanel.add(new JLabel("Send: "));
              outPanel.add(userText);
              userText.addActionListener(new ActionListener()     {public void actionPerformed(ActionEvent evt){userTyped(evt);}});
              cp.setLayout(new BorderLayout());
              cp.add(outPanel,BorderLayout.NORTH);
              cp.add(logScroll,BorderLayout.CENTER);
              userName = "Admin: " + userName;
              setTitle(userName);
              addWindowListener(new WindowAdapter()
                   {public void windowClosing(WindowEvent evt){mnuExit();}});
              toLog("!! use start menu to start");
              toLog("!! host is "+address);
              pack();
              mnuStart();
         void RunShutdown()
              Runtime.getRuntime().addShutdownHook(new Thread()
                   public void run()
                        userClosed("Connection Closing.", isC);
         void userTyped(ActionEvent evt)    //----------------------------------------
              String txt = evt.getActionCommand();
              userText.setText("");
              toLog(txt, true);
              System.out.println("From user:"+txt);
              if(running)remote.postMessage(txt);
         void userClosed(String evt, int who)    //----------------------------------------
              String txt = evt;
              boolean istf = true;
              userText.setText("");
              toLog(txt, istf);
              System.out.println("From user:"+txt);
              if(running)remote.postMessage(txt);
         void toLog(String txt){toLog (txt,false);}    //-----------------------------
         void toLog(String txt, boolean user)    //-----------------------------------
              log.append((user?"> ":"< ")+txt+"\n");
              log.setCaretPosition(log.getDocument().getLength() );
         // build the standard menu bar
         void buildMenu()    //-------------------------------------------------------
              JMenuItem item;          // file menu
              startItem.addActionListener(new ActionListener()
                   {public void actionPerformed(ActionEvent e){mnuStart();}});
              fileMenu.add(startItem);
              hostItem.addActionListener(new ActionListener()
                   {public void actionPerformed(ActionEvent e){mnuHost();}});
              fileMenu.add(hostItem);
              exitItem.addActionListener(new ActionListener()
                   {public void actionPerformed(ActionEvent e){mnuExit();}});
              fileMenu.add(exitItem);
              menuBar.add(fileMenu);
              helpMenu.add(aboutItem);
              aboutItem.addActionListener(new ActionListener()
                   {public void actionPerformed(ActionEvent e){mnuAbout();}});
              menuBar.add(helpMenu);
              setJMenuBar(menuBar);
         void mnuStart()    //--------------------------------------------------------
              Runtime.getRuntime().addShutdownHook(new Thread()
                   public void run()
                        userClosed("Connection Closing.", isC);
              if(!running)
                   if (isC == 0)
                        remote = new RemoteUser(this, address, port);
                   else
                        remote = new RemoteUser(this, contin, isC);
                   if(remote.start())
                        startItem.setText("Stop");
                        running = true;
                   else remote = null;
              else
                   userClosed("Connection Closing.", isC);
                   remote.stop();
                   remote = null;
                   running = false;
                   startItem.setText("Start");
         void mnuHost()    //----------------------------------------------------------
              String txt = JOptionPane.showInputDialog("Enter host address and port");
              if (txt == null)return;
              int n = txt.indexOf(':');
              if(n == 0)
                   address = "genesis.zedxinc.com";
                   port = toInt(txt.substring(1),8000);
              else if(n < 0)
                   address = txt;
                   port = 8000;
              else
                   address = txt.substring(0,n);
                   port = toInt(txt.substring(n+1),8000);
              toLog("!! host set to "+address+":"+port);
         //     setTitle(userName);
         void mnuAbout()    //---------------------------------------------------------
              new AboutDialog(this).show();
              System.out.println("about called");
         void mnuExit()    //----------------------------------------------------------
              userClosed("Connection Closing.", isC);
    //          toLog("!! use start menu to start");
              if (isC == 1){
                   if(remote != null)remote.close();
                   dispose();
    //               System.exit(0);
              else if (isApp == 1)
                   this.destroy();
                   if(remote != null)remote.close();
                   System.exit(0);
              else
                   if(remote != null)remote.close();
                   System.exit(0);
         public void dispose() {     //------------------------------------------------
           switch (this.getDefaultCloseOperation()) {
              case DISPOSE_ON_CLOSE:
                super.dispose();
                break;
         public void fromHost(String txt){postGMessage(new GUIMessage(this,txt));}    //---------
         public void runGMessage(GUIMessage gm){toLog((String)gm.dat);}    //--------------------
         public void postGMessage(GUIMessage gm){SwingUtilities.invokeLater(gm);}    //----------
         public static int toInt(String s, int er)    //----------------------
              int i;
              try{i = new Integer(s).intValue();}
              catch(NumberFormatException exc){i = er;}
              return i;
    class AboutDialog extends JDialog    //-----------------------------------
         Container contentPane;
         JTextField text = new JTextField("Simple character client");
         AboutDialog(Frame f)
              super(f,"About TrialClient",true);
              contentPane = getContentPane();
              contentPane.add(text);
              pack();
    class RemoteUser    //----------------------------------------------------
         Socket sock;
         BufferedReader in;
         BufferedWriter out;
         TrialClient parent;
         String name ="";
         int state = 0;
         Thread recvThread;
         Thread sendThread;
         LinkedList sendQ = new LinkedList();
         boolean signedOn = false;
         String address;     int port; int isc;
         RemoteUser(TrialClient c, String a, int p)    //----------------------
              parent = c;
              address = a;
              port = p;
         RemoteUser(TrialClient c, Socket s, int isC)    //---------------------
              parent = c;
              sock = s;
              isc = isC;
         boolean start()    //---------------------------------------------------
              try
                   state = 1;
                   if (isc == 0)
                        sock = new Socket(address,port);
                   name = getAddress();
                   in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
                   out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
                   recvThread = new Thread(new Runnable()
                        {public void run(){doRecv();}},"Recv");
                   sendThread = new Thread(new Runnable()
                        {public void run(){doSend();}},"Send" );
                   sendThread.start();
                   recvThread.start();
                   parent.fromHost ("!! Connected to = "+name);
                   state = 2;
              catch(Exception e)
                   parent.fromHost ("!! Connection failed to = "+name);
                   e.printStackTrace();
                   close();
              return state == 2;
         void stop(){close();}    //-----------------------------------------------
         void doSend()    //-------------------------------------------------------
              String msg;
              try
                   while (null != (msg = popMessage()))
                        System.out.println("sending ("+msg+") to user="+name);
                        out.write(msg+"\r\n");
                        out.flush();
              catch(Exception e){e.printStackTrace();}
         synchronized String popMessage()    //---------------------------------------
              String msg = null;
              while (state > 0 && sendQ.size() == 0)
                   try{this.wait();}
                   catch(InterruptedException e){}
              if(state > 0)msg = (String)sendQ.remove(0);
              return msg;
         synchronized void postMessage(String msg)    //------------------------------
              sendQ.add(msg);
              this.notify();
         void doRecv()    //----------------------------------------------------------
              String inbuf;
              while (0 != state)
                   try{inbuf = in.readLine();}
                   catch(Exception e){inbuf = null;}
                   if(inbuf == null)close();
                   else
                        System.out.println("received ("+inbuf+") from user="+name);
                        parent.fromHost(inbuf);
         void close()    //----------------------------------------------------------
              int s = state;
              state = 0;
              if(sock != null)
                   if (sendThread != null && sendThread.isAlive())sendThread.interrupt();
                   if(s == 0)parent.fromHost("!! closed");
                   else{ parent.fromHost("!! closing user "+name); }
                   try{sock.close();}
                   catch(Exception e){e.printStackTrace();}
         String getAddress(){return ""+sock.getInetAddress()+":"+sock.getPort();     }
    interface GMReceiver    //----------------------------------------------------------
         public void runGMessage(GUIMessage gm);
         public void postGMessage(GUIMessage gm);
    class GUIMessage implements Runnable    //------------------------------------------
         GMReceiver gui;
         Object dat;
         GUIMessage(GMReceiver gui, Object dat)
              this.dat = dat;
              this.gui = gui;
         public void run()
              gui.runGMessage(this);
    }

    How about interface java.awt.WindowListener???
    Sure can help you out!
    "windowOpened
    public void windowOpened(WindowEvent e)
    Invoked the first time a window is made visible.
    windowClosing
    public void windowClosing(WindowEvent e)
    Invoked when the user attempts to close the window from the window's system menu. If the program does not explicitly hide or dispose the window while processing this event, the window close operation will be cancelled.
    windowClosed
    public void windowClosed(WindowEvent e)
    Invoked when a window has been closed as the result of calling dispose on the window.
    windowIconified
    public void windowIconified(WindowEvent e)
    Invoked when a window is changed from a normal to a minimized state. For many platforms, a minimized window is displayed as the icon specified in the window's iconImage property.
    See Also:
    Frame.setIconImage(java.awt.Image)
    windowDeiconified
    public void windowDeiconified(WindowEvent e)
    Invoked when a window is changed from a minimized to a normal state.
    windowActivated
    public void windowActivated(WindowEvent e)
    Invoked when the Window is set to be the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
    windowDeactivated
    public void windowDeactivated(WindowEvent e)
    Invoked when a Window is no longer the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
    "

  • How to open web pages from japplet??

    Hi
    Does anybody know how to open web pages from java japplet??
    Any help is apreciated!
    zick

    the getAppletContext() method of the Applet class will get you an AppletContext, with which you can call the ShowDocument(URL url) or ShowDocument(URL url, String target) method...
    check it out at http://java.sun.com/j2se/1.4/docs/api/java/applet/AppletContext.html
    have a good one :)
    Jay

  • Very urgent  !! pls help!! web start for applet vs Japplet..

    this does not work with web start. but if i chnge it to Applet , it works fine..
    Why?
    public class NewJApplet extends javax.swing.JApplet {
       public void paint (java.awt.Graphics g)
         g.drawString ("Hello world!", 45, 30);
         System.out.println ("singhhhHello world!");
    }

    actually it does... there is option you may give in the jnlp that it's not application rather it's an applet. Though it's not highly recommended.
    BTW. i am having another problem .. if anyone know about it...
    In NetBeans IDE 5.5, i have enabled "java Web Start"
    but when ever i tried to run via web start it asks me "please select a main Class" alert.
    what is it.
    thnx

  • Publishing JApplet on the web

    Hi.
    I've got a question.
    I've made a JApplet game and now I want to put it onde the web so anyone can see it.
    My question is : is necessary to the client to have de JDK installed ?
    There is no way to transfer the classes needed to the client machine and the run the JApplet ?
    Tanks

    Maybe you don't really understand my question.Ohhhhh..
    Maybe you dont't really understand my answer.
    On my JApplet i've imported some classes of the
    javax.swing.Which are part of the JRE the user will have to have installed or will be prompted to install if you use the HTMLConverter utility to create the HTML.
    The classes that I need from this package, por
    example, JButton, will be transfered to the client PC
    so that he can see the JApplet completely ?They won't be transferred by your applet, they will be part of the JRE the user will have installed.
    Just to be sure, this is how Java 1.2 and up works. If you're using Java 1.1 then there are other issues so annoying that it would be better to upgrade to 1.4.
    Rafael

  • How to embed JApplet in to web page

    Hello friends,
    I hv the problem in embedding the JApplet into the web page. Can anyone tell me how to do it.

    Do a little more reading
    http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html
    ICE

  • Calling a JApplet from a web page...

    I'm currently having an issue with calling a method in a JApplet from a web page.
    I'm adding a modal JDialog to the Applet, and then displaying it when a user clicks an HTML button.
    Everything works great until another IE window is opened... At that point, the resources being used by IE skyrocket to 99%, and pretty much stays level, and the original window becomes locked, while the new IE window works just fine.
    Here's the html and the java source code.... Hopefully someone can point me into the right direction on this...
    <html>
    <head>
    <title>CACTest</title>
    </head>
    <body>
    <applet id="Test" width="1" height="1" code ="Test.class">
    </applet>
    <script language=Javascript>
         function clicked(){
              document.Test.showDialog();
    </script>
    <input type="button" name="myButton" value="click me" onClick="clicked()">
    </body>
    </html>
    import java.awt.*;
    import javax.swing.*;
    public class Test extends JApplet {
    private Frame findParentFrame(){
    Component c = getParent();
    while(true){
    if(c instanceof Frame)
    return (Frame)c;
    c = c.getParent();
    public void init(){
    public void showDialog(){
    Frame f = findParentFrame();
    JDialog d = new JDialog(f, "modalDialog", true);
    d.getContentPane().add(new JLabel("hello"));
    d.pack();
    d.setLocation(100,100);
    d.show();

    I'm currently having an issue with calling a method in
    a JApplet from a web page.
    I'm adding a modal JDialog to the Applet, and then
    displaying it when a user clicks an HTML button.
    Everything works great until another IE window is
    opened... At that point, the resources being used by
    IE skyrocket to 99%, and pretty much stays level, and
    the original window becomes locked, while the new IE
    window works just fine.
    Here's the html and the java source code.... Hopefully
    someone can point me into the right direction on
    this...
    <html>
    <head>
    <title>CACTest</title>
    </head>
    <body>
    <applet id="Test" width="1" height="1" code
    ="Test.class">
    </applet>
    <script language=Javascript>
    function clicked(){
    document.Test.showDialog();
    </script>
    <input type="button" name="myButton" value="click me"
    onClick="clicked()">
    </body>
    </html>
    import java.awt.*;
    import javax.swing.*;
    public class Test extends JApplet {
    private Frame findParentFrame(){
    Component c = getParent();
    while(true){
    if(c instanceof Frame)
    return (Frame)c;
    c = c.getParent();
    public void init(){
    public void showDialog(){
    Frame f = findParentFrame();
    JDialog d = new JDialog(f, "modalDialog", true);
    d.getContentPane().add(new JLabel("hello"));
    d.pack();
    d.setLocation(100,100);
    d.show();
    The while(true){ } is a busy loop if the (c instanceof Frame) test fails.

  • Defining a classpath - Japplet (web page)

    Hi!
    I need to use the package org.web3d.x3d.sai and I�m having some difficulties defining the classpath to the jars.
    I�m using a Japplet, and running it from a web page.
    I have copy the jar files I needed to the directory of java in my computer:
    C:\j2sdk1.4.2_04\jre\lib\ext
    C:\Programas\Java\j2re1.4.2_07\lib\ext
    I�m using Netbeans to compile my applet and it loads the jars and compiles correctly using the package org.web3d.x3d.sai
    When I try to run the applet, it doesn�t recognize the jars needed (I don�t have defined the classpath)
    Before this, I was using a Java program, and a bat file where I defined the classpath to the jars and execute my java program, but now I�m using a Japplet, and running it from a web page and I don�t know how to define my classpath this way�.
    Can anyone help me??
    Thanks
    Nuno

    1) Never, ever, ever put true 3rd-party libs in your JDK or JRE folder structure - they don't belong there. You should have been explicitly creating a classpath from the beginning, i.e.:
    (compile-time)
    javac -classpath /some/path/some.jar;/another/path/another.jar... ...
    (runtime)
    java -classpath /some/path/some.jar;/another/path/another.jar... ...
    For an applet at runtime, you don't run them via the java command-line of course. Applets declare their 'classpath' via the <applet> tag and subtags that you have coded in the referencing html file. Go research more what that tag structure is supposed to look like.

  • JApplet won't initialize in Web Browser...

    Hi,
    I just started teaching myself Java a few days ago. I've got the JSE JDK, and NetBeans. I've been following the tutorials. I've been programming in C(++) and various other languages for quite a while so the programming aspect of Java has come easily. When I started delving into GUI's I started encountering problems. I'm commencing a project, and basically, I need a Java applet to run in a web browser, and people need to be able to run it in a page that they've downloaded, and stuff. You know. Anyway, so here's what I did:
    In Netbeans:
    New Project > General > Java Class Library
    So now I have a new, empty project.
    Right click Project Node > New > File/Folder...
    Java GUI Forms > JApplet Form
    I put it in it's own package called "hello"
    Add a JLabel from the Palette onto the GUI Designer thing.
    Right-Click Project Node > Build Project:
    init:
    deps-jar:
    Created dir: D:\Adrien Pellerin\Apps\JavaLibrary5\build\classes
    Compiling 1 source file to D:\Adrien Pellerin\Apps\JavaLibrary5\build\classes
    compile:
    Created dir: D:\Adrien Pellerin\Apps\JavaLibrary5\dist
    Building jar: D:\Adrien Pellerin\Apps\JavaLibrary5\dist\JavaLibrary5.jar
    jar:
    BUILD SUCCESSFUL (total time: 0 seconds)Right click NewJApplet.java > Run File: It works fine.
    Go to project folder > build > classes > view NewJApplet.html
    It opens in IE. And it says "Loading Java Applet Failed."
    Here's what it says in the console:
    java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         at java.lang.Class.getConstructor0(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)And here's the code for the original Java file:
    * NewJApplet.java
    * Created on October 11, 2006, 2:38 PM
    package hello;
    * @author  Adrien Pellerin
    public class NewJApplet extends javax.swing.JApplet {
        /** Initializes the applet NewJApplet */
        public void init() {
            try {
                java.awt.EventQueue.invokeAndWait(new Runnable() {
                    public void run() {
                        initComponents();
            } catch (Exception ex) {
                ex.printStackTrace();
        /** This method is called from within the init() method to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jLabel1.setText("jLabel1");
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(163, 163, 163)
                    .add(jLabel1)
                    .addContainerGap(203, Short.MAX_VALUE))
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(129, 129, 129)
                    .add(jLabel1)
                    .addContainerGap(157, Short.MAX_VALUE))
        }// </editor-fold>
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        // End of variables declaration
    }I have the JRE installed. I can view other Applets in my browser, but JApplets don't work. What's going on?
    Thanks

    The error has nothing to do with your applet. The GroupLayout class is used by Matisse, the NetBeans forms editor. NetBeans should have packaged it into a jar file together with your applet class file. The HTML file that launches your applet should specify this jar file.
    Here is a sample APPLET tag:
        <APPLET name="TalkHawk" ARCHIVE="TalkHawkApplet.jar" code="TalkHawkAppletPkg.TalkHawkApplet.class" width="100" height="100">
            <param name="Title" value="Magic Beans Conferencing Center">
            <param name="Logo" value="images/Logo2.jpg">
            <param name="Debug" value="0">Here is the equivalent using jsp:
        <jsp:plugin type="applet"
                    archive="TalkHawkApplet.jar"
                    code="TalkHawkAppletPkg.TalkHawkApplet.class"
                    jreversion="1.4"
                    nspluginurl="http://java.sun.com/j2se/1.4.2/download.html"
                    iepluginurl="http://java.sun.com/j2se/1.4.2/download.html"
                    name="TalkHawk"
                    width="100"
                    height="100">
            <jsp:params>
                <jsp:param name="Title" value="Magic Beans Conferencing Center" />
                <jsp:param name="Logo" value="images/Logo2.jpg" />
                <jsp:param name="Debug" value="0" />
            </jsp:params>
            <jsp:fallback>
                <p>Unable to start plugin.</p>
            </jsp:fallback>
        </jsp:plugin>

  • Communication between JApplet and Applet on the same web page

    Hi Freinds
    I have a JSP page containing two applets as follows :-
    <jsp:plugin type="applet" code="TreePageJavaClass.class" codebase="/MYOA" width="200" height="300" name="Applet1">
    </jsp:plugin>
    <jsp:plugin type="applet" code="TreePageJavaClass2.class" codebase="/MYOA" name="Applet2" width="200" height="300">
    </jsp:plugin>
    First applet extends JApplet class and has a tree constructed using swing.
    Second applet extends Applet class.
    Now I want to call a method in second applet on selecting a particular tree node on first applet. I can call method on second applet from first applet when both extends Applet class (not JApplet)
    So please tell me what's the problem here and how it can be solved.
    Thanks

    There is a Middle Eastern version of Adobe Dreamweaver CS4-ME, with full support
    of Hebrew, Arabic, Farsi and other languages,
    see http://www.fontworld.com/me/dreamweaverme.html

  • Web Service Delay in JApplet

    I am calling web service in Applet,
    When i test applet in a local area network it work fine and its web service invoke response time is within 2 second but
    When i publish applet on web the response of web service is very slow, its take greater than 25 second.
    I publish my web service at Glass fish v2.1 server
    Note; no exception throw
    any useful suggestion?

    Have you tried watching the site using Firefox with the Firebug engaged? It can tell you the response time for specific parts of your webpage. Is this a server farm issue or a programming thing? Where is your hosting located? Decent speed? Are you database intensive on shared server with zillions of our friends using the same server? etc...
    Is there a URL you can share?
    Edited by: zip on Nov 10, 2009 8:27 PM

  • JApplet Form NOT Displayed on Web Page

    It is my JApplet code (that has been solved in this forum; refer to my previous Q) that is being successfully deployed, started, however, does not display the expected GUI (which is being displayed fine if is run as an Applet).
    The error message displayed in "Java Console" is below.
    java.lang.reflect.InvocationTargetException
        at java.awt.EventQueue.invokeAndWait(Unknown Source)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder.init(XMLAnalysisToolBuilder.java:36)
        at sun.applet.AppletPanel.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.shell.Win32ShellFolder2$ComTaskExecutor
        at sun.awt.shell.Win32ShellFolder2$ComTask.execute(Unknown Source)
        at sun.awt.shell.Win32ShellFolder2.getFileSystemPath(Unknown Source)
        at sun.awt.shell.Win32ShellFolder2.composePathForCsidl(Unknown Source)
        at sun.awt.shell.Win32ShellFolder2.<init>(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.getDesktop(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
        at sun.awt.shell.ShellFolder.get(Unknown Source)
        at javax.swing.filechooser.FileSystemView.getRoots(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.updateUseShellFolder(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.installComponents(Unknown Source)
        at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.installUI(Unknown Source)
        at javax.swing.JComponent.setUI(Unknown Source)
        at javax.swing.JFileChooser.updateUI(Unknown Source)
        at javax.swing.JFileChooser.setup(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder.initComponents(XMLAnalysisToolBuilder.java:63)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder.access$000(XMLAnalysisToolBuilder.java:30)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder$1.run(XMLAnalysisToolBuilder.java:38)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
    java.lang.reflect.InvocationTargetException
        at java.awt.EventQueue.invokeAndWait(Unknown Source)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder.init(XMLAnalysisToolBuilder.java:36)
        at sun.applet.AppletPanel.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.shell.Win32ShellFolder2$ComTaskExecutor
        at sun.awt.shell.Win32ShellFolder2$ComTask.execute(Unknown Source)
        at sun.awt.shell.Win32ShellFolder2.getFileSystemPath(Unknown Source)
        at sun.awt.shell.Win32ShellFolder2.composePathForCsidl(Unknown Source)
        at sun.awt.shell.Win32ShellFolder2.<init>(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.getDesktop(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
        at sun.awt.shell.ShellFolder.get(Unknown Source)
        at javax.swing.filechooser.FileSystemView.getRoots(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.updateUseShellFolder(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.installComponents(Unknown Source)
        at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.installUI(Unknown Source)
        at javax.swing.JComponent.setUI(Unknown Source)
        at javax.swing.JFileChooser.updateUI(Unknown Source)
        at javax.swing.JFileChooser.setup(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder.initComponents(XMLAnalysisToolBuilder.java:63)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder.access$000(XMLAnalysisToolBuilder.java:30)
        at xmlAnalyticsPackage.XMLAnalysisToolBuilder$1.run(XMLAnalysisToolBuilder.java:38)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)Please help on this.
    Nilanjan

    May be this bug has to do with you:
    [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6544857]

  • Web pictures through JPanel in JApplet

    Hi there!
    I want to put my Java game (created in JPanel) online through JApplet.
    I have put the images & sounds for that online. (e.g. "http://bla.bla.com/images/image.gif").
    Now if I run the program in JFrame, it is loading and working fine! But in Applet, I am getting security warnings/errors. Can anyone help please?
    Here's the sample code:
    public class Game extends JPanel {
    URL url = null;
    URLConnection con = null;
    //Constructor{
    try{
    url = new URL("http://....../image.gif");
    conn = url.openConnection();
    }catch(Exception e){/Message}
    ImageIcon img = new ImageIcon(url);
    }

    Hi there!
    One more similar problem... :(
    I want to put my Java game (created in JPanel) online through JApplet.
    I have put the images & sounds for that online. (e.g. "http://bla.bla.com/images/image.gif").
    Now if I run the program in JFrame, it is loading and working fine! But in Applet, I am getting security warnings/errors. Can anyone help please?
    Here's the sample code:
    public class Game extends JPanel {
    URL url = null;
    URLConnection con = null;
    //Constructor{
    try{
    url = new URL("http://....../image.gif");
    conn = url.openConnection();
    }catch(Exception e){/Message}
    ImageIcon img = new ImageIcon(url);
    }

  • JApplet & web browsers

    hey all!!!
    i have got a little problem. when i write an applet and embed it in a web page this correctly shows and everything is ok
    but
    when i make change to it and reload the page then the change does not show?? even when i close the tab and then reopen a new one and load the page -> nothing still the same. basically i have to close browser altogether and restart it and then the change takes place???
    i'm using opera 9.20 on slackware 11.0
    but have tried also firefox 1.5.0.7
    and also nothing
    thnks
    v.v.

    This is a long-standing browser cacheing related issue and is unsolvable so don't waste any more time on it.
    To better test your applet use the appletviewer tool.

  • Communication between two JApplets on the same web page

    Hi Freinds
    I have a JSP page containing two applets as follows :-
    <jsp:plugin type="applet" code="TreePageJavaClass.class" codebase="/MYOA" width="200" height="300" name="Applet1">
    </jsp:plugin>
    <jsp:plugin type="applet" code="TreePageJavaClass2.class" codebase="/MYOA" name="Applet2" width="200" height="300">
    </jsp:plugin>
    First applet extends JApplet class and has a tree constructed using swing.
    Second applet extends Applet class.
    Now I want to call a method in second applet on selecting a particular tree node on first applet. I can call method on second applet from first applet when both extends Applet class (not JApplet)
    So please tell me what's the problem here and how it can be solved.
    Thanks

    First Applet :-
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.applet.*;
    public class TreePageJavaClass extends JApplet {
    JTree tree;
    JTextField jtf;
    Container contentPane;
    public void init() {
    contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("MakeYourOwnAds");
    DefaultMutableTreeNode a = new DefaultMutableTreeNode("User1");
    top.add(a);
    DefaultMutableTreeNode a1 = new DefaultMutableTreeNode(getParameter("param1"));
    a.add(a1);
    DefaultMutableTreeNode a2 = new DefaultMutableTreeNode(getParameter("param2"));
    a.add(a2);
    DefaultMutableTreeNode a3 = new DefaultMutableTreeNode(getParameter("param3"));
    a.add(a3);
    DefaultMutableTreeNode a4 = new DefaultMutableTreeNode(getParameter("param4"));
    a.add(a4);
    tree = new JTree(top);
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
    int h =ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    JScrollPane jsp = new JScrollPane(tree, v, h);
    contentPane.add(jsp, BorderLayout.CENTER);
    jtf = new JTextField("", 20);
    contentPane.add(jtf, BorderLayout.SOUTH);
    // Anonymous inner class to handle mouse clicks
    tree.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent me) {doMouseClicked(me);
    void doMouseClicked(MouseEvent me)
    TreePath tp = tree.getPathForLocation(me.getX(), me.getY());
    TreePageJavaClass2 app = (TreePageJavaClass2)getAppletContext().getApplet("Applet2");
    if(tp != null)
         if (tp.toString().equals("[MakeYourOwnAds, User1, Ajay]"))
         jtf.setText(tp.toString());
              if (app == null)
              app.setData("null");
              else
                   app.setData("Ajay");
         else
              jtf.setText(tp.toString());
    else
    jtf.setText("");
    Second Applet :-
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class TreePageJavaClass2 extends Applet
    private Label msg;
    public void init()
    setLayout(new BorderLayout());
    setBackground(Color.LIGHT_GRAY);
    msg = new Label("Applet2 is running...", Label.CENTER);
    add(BorderLayout.CENTER, msg);
    public void setData(String message)
    msg.setText("Selected Node is " + message);
    Hope you guys will help me.
    Thanks

Maybe you are looking for