Article View: borland.public.jbuilder.java.swing
Article #12238Problem using Applet with swing classes
From: Manoj
Date: Tue, 02 Feb 1999 00:00
Date: Tue, 02 Feb 1999 00:00
107 lines
3697 bytes
3697 bytes
In a effort to reduce applet size I am trying to use swing classes,
however I am getting errors listed below. What am i missing ..
The applet takes a long time to load because the jar file is 500KB
The applet uses JBCL Classes ( using Jbuilder 1.0) like tabPanel &
GridControl
We are trying to use swing classes.
So I upgraded my Jbuilder2.01 and applied the beta patch which "allows
the Designer in JBuilder 2.01 to work with Java Foundation Classes(JFC
1.1) and to support development work with the version of JFC that comes
with JDK1.2."
Now I am trying to use JTabbedPane & JTable and using applet that
extends JApplet.
I wrote a simple java program using JTabbedPane & JTable.
// Java Program
package untitled6;
import java.awt.*;
import java.awt.event.*;
//import java.applet.*;
import javax.swing.*;
//import com.sun.java.swing.UIManager;
public class Applet3 extends JApplet {
boolean isStandalone = false;
javax.swing.JTabbedPane jTabbedPane1 = new javax.swing.JTabbedPane();
javax.swing.JTable jTable = new javax.swing.JTable();
//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 Applet3() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
//static {
// try {
// //UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.metal.MetalLookAndFeel());
// //UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.motif.MotifLookAndFeel());
// UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
// }
// catch (Exception e) {}
//}
//Component initialization
private void jbInit() throws Exception {
this.setSize(400,300);
this.getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
jTabbedPane1.add(jTable, "Tab1");
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
}
// Java Program ends
Deploying as a jar file , the applet gives the following error when
deployed :
( I set the Java Plug-in Property as
: c:\Program Files\JavaSoft\JRE\1.2
For Proxy I am using browser setting.
# Applet exception: error: java.lang.NoClassDefFoundError:
javax/swing/JApplet
java.lang.NoClassDefFoundError: javax/swing/JApplet
at java.lang.ClassLoader.defineClass(Compiled Code)
at netscape.applet.AppletClassLoader.findClass(Compiled Code)
at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
* at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
at
netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(Compiled
Code)
at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled
Code)
at java.awt.EventDispatchThread.run(Compiled Code)
at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
Code
Technical Details
Message-ID:
<36B76A2E.21F08D97@lawson.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e954bb68c2b50687,start X-Google-Attributes: gid111d45,public From: Manoj <manoj.prasad@lawson.com> Subject: Problem using Applet with swing classes Date: 1999/02/02 Message-ID: <36B76A2E.21F08D97@lawson.com> X-Deja-AN: 439907897 Content-Transfer-Encoding: 7bit Organization: lawson Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing