🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #5

Re: NullPointer Exception in applets (Swing 1.0.3 or 1.1beta)

#5
From: Brian Reid
Date: Sun, 20 Sep 1998 00:00
200 lines
6062 bytes
yan


I am also getting these errors using Netscape 4.06
Did you solve this problem ?

Thanks
Brian Reid


yan zhou wrote in message <35E19FC5.366B8FC5@mtu.edu>...
>Hi,
>
>  I employed the new Swing release: 1.0.3 or 1.1beta in
>applet development.
>
>  But, whenever GridControl is used, the applet keeps
>throwing exceptions, which is fine in using with swing1.0.1.
>
>  I am wondering if anybody has solutions or explanations
>to this problem. The exceptions and code are attached.
>
>  Thanks in advance.
>
> Yan Zhou
> yzhou@mtu.edu
>
>
>Netscape Communications Corporation -- Java 1.1.5
>
>Type '?' for options.
>
>Symantec Java! ByteCode Compiler Version 210.065
>Copyright (C) 1996-97 Symantec Corporation
># Applet exception: exception: java.lang.NullPointerException
>
>java.lang.NullPointerException
>
>  at borland.jbcl.view.GridView.addFocusListener(Compiled Code)
>
>  at com.sun.java.swing.JComponent.enableSerialization(Compiled Code)
>
>  at com.sun.java.swing.JComponent.<init>(Compiled Code)
>
>  at com.sun.java.swing.JScrollPane.<init>(Compiled Code)
>
>  at com.sun.java.swing.JScrollPane.<init>(Compiled Code)
>
>  at borland.jbcl.view.GridView.<init>(Compiled Code)
>
>* at borland.jbcl.control.GridControl.<init>(Compiled Code)
>
>  at testGrid.Applet1.<init>(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)
>
># Applet exception: exception: java.lang.NullPointerException
>
>java.lang.NullPointerException
>
>  at borland.jbcl.view.GridView.addFocusListener(Compiled Code)
>
>  at com.sun.java.swing.JComponent.enableSerialization(Compiled Code)
>
>  at com.sun.java.swing.JComponent.<init>(Compiled Code)
>
>  at com.sun.java.swing.JScrollPane.<init>(Compiled Code)
>
>  at com.sun.java.swing.JScrollPane.<init>(Compiled Code)
>
>  at borland.jbcl.view.GridView.<init>(Compiled Code)
>
>* at borland.jbcl.control.GridControl.<init>(Compiled Code)
>
>  at testGrid.Applet1.<init>(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)
>
>
>
>The following code does nothing but add a grid into applet.
>It works fine with swing 1.0.1, but not with swing 1.0.3 or
>swing 1.1beta.
>
>
>import java.awt.*;
>import java.awt.event.*;
>import com.sun.java.swing.*;
>import borland.jbcl.layout.*;
>import borland.jbcl.control.*;
>
>//import com.sun.java.swing.UIManager;
>public class Applet1 extends JApplet {
>  boolean isStandalone = false;
>  BorderLayout borderLayout1 = new BorderLayout();
>  BevelPanel bevelPanel1 = new BevelPanel();
>  GridControl gridControl1 = new GridControl();
>  BorderLayout borderLayout2 = new BorderLayout();
>//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 Applet1() {
>  }
>//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.getContentPane().setLayout(borderLayout1);
>    bevelPanel1.setLayout(borderLayout2);
>    gridControl1.addFocusListener(new java.awt.event.FocusAdapter() {
>      public void focusGained(FocusEvent e) {
>        gridControl1_focusGained(e);
>      }
>    });
>    gridControl1.addKeyListener(new java.awt.event.KeyAdapter() {
>      public void keyPressed(KeyEvent e) {
>        gridControl1_keyPressed(e);
>      }
>    });
>    gridControl1.addMouseListener(new java.awt.event.MouseAdapter() {
>      public void mouseClicked(MouseEvent e) {
>        gridControl1_mouseClicked(e);
>      }
>    });
>    this.getContentPane().add(bevelPanel1, BorderLayout.CENTER);
>    bevelPanel1.add(gridControl1, BorderLayout.CENTER);
>  }
>//Get Applet information
>
>  public String getAppletInfo() {
>    return "Applet Information";
>  }
>//Get parameter info
>
>  public String[][] getParameterInfo() {
>    return null;
>  }
>
>  void gridControl1_focusGained(FocusEvent e) {
>
>  }
>
>  void gridControl1_keyPressed(KeyEvent e) {
>
>  }
>
>  void gridControl1_mouseClicked(MouseEvent e) {
>
>  }
>}
Technical Details
Message-ID: <ORbN1.348$X3.1435945@newsr2.u-net.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35E19FC5.366B8FC5@mtu.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,72ede45acf0b93e
X-Google-Attributes: gid111d45,public
X-Google-Thread: ff01d,72ede45acf0b93e
X-Google-Attributes: gidff01d,public
From: "Brian Reid" <bgreid@suenosoft.u-net.com>
Subject: Re: NullPointer Exception in applets (Swing 1.0.3 or 1.1beta)
Date: 1998/09/20
Message-ID: <ORbN1.348$X3.1435945@newsr2.u-net.net>
X-Deja-AN: 393043577
References: <35E19FC5.366B8FC5@mtu.edu>
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
X-Complaints-To: news@u-net.net
X-Trace: newsr2.u-net.net 906316270 194.119.133.245 (Sun, 20 Sep 1998 19:31:10 BST)
Organization: (Posted via) U-NET Internet Ltd.
NNTP-Posting-Date: Sun, 20 Sep 1998 19:31:10 BST
Newsgroups: borland.public.jbuilder.java.swing,borland.public.jbuilder.applet-issues