Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Netscape 6.2 and Swing Applets (is swing dead?)

0 views
Skip to first unread message

Jeff Sexton

unread,
May 1, 2002, 11:54:32 AM5/1/02
to
Is anyone using Swing JApplets in Netscape 6.x with the java plug-in
1.4? For that matter is anyone using JApplet at all??

Whenever a Swing applet, even a very trivial one, is repainted in
Netscape 6.2, with the latest plug-in, an exception is thrown. This
happens for example when "back" and "forward" are pressed on the
browser. It all works fine in Netscape 4.7 by downloading the Swing
jar. But it's hard to believe that after all this time there still
isn't a plug-in that can do Swing. Is anyone using Swing at all?

Writing *all* the paint code in the japplet's paint(), and not ever
calling super.paint(), avoids the exception, but then it's impossible to
use components (since you can't call their paint()).

I have some good sized web apps and I went to Swing some time ago
because it is so much more powerful. Now I seem to be stuck with
Netscape 4.7 forever and I'm started to wish I'd stayed with AWT. :-(

Exception follows...

java.lang.NullPointerException
at sun.java2d.SunGraphics2D.<init>(Unknown Source)
at sun.awt.image.OffScreenImage.getGraphics(Unknown Source)
at com.sun.java.swing.JComponent.paint(JComponent.java:497)
at ods.forte.providers.ProvSearch2.paint(ProvSearch2.java)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)


Paul Lutus

unread,
May 1, 2002, 1:00:31 PM5/1/02
to
Jeff Sexton wrote:

> Is anyone using Swing JApplets in Netscape 6.x with the java plug-in
> 1.4? For that matter is anyone using JApplet at all??
>
> Whenever a Swing applet, even a very trivial one, is repainted in
> Netscape 6.2, with the latest plug-in, an exception is thrown.

Have you tried a different browser, even a different Netscape version? If
the outcome is the same, the problem is the applet or the plugin. If the
outcome is different, the problem is the browser.

Might as well do some preliminary detective work.

--
Paul Lutus
www.arachnoid.com

Jeff Sexton

unread,
May 1, 2002, 1:09:13 PM5/1/02
to
In article <PaVz8.13284$Ii2.1...@bin2.nnrp.aus1.giganews.com>,
Paul Lutus <nos...@nosite.zzz> wrote:

>Jeff Sexton wrote:
>> Whenever a Swing applet, even a very trivial one, is repainted in
>> Netscape 6.2, with the latest plug-in, an exception is thrown.
>
>Have you tried a different browser, even a different Netscape version? If
>the outcome is the same, the problem is the applet or the plugin. If the
>outcome is different, the problem is the browser.
>
>Might as well do some preliminary detective work.

We use Netscape 4.7 (and some other 4.x versions) in production for such
JApplets. For these versions, the Swing jar file is downloaded, but
they work perfectly. I've been deploying apps that way for over a
year.

Once in awhile, since Netscape 6 came out, I give it a try along with
the latest plug-in from Sun. The current versions work better than
ever before, but they still have this paint() problem on a page
reload (a start() call in other words).

I have not tried any version of IE as it does not meet our needs in
other ways.

If anyone is using *any* combination of JApplets with Netscape 6.x and
a plug-in, I'd sure like to hear about it. It looks to me like this
stuff just isn't being used. At least I don't see how it could be.

Here is a trivial Swing JApplet, generated by Visual Age Java, that
throws the exception on a refresh/paint():

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

public class TestJApplet extends com.sun.java.swing.JApplet implements KeyListener, MouseListener {
Font font = new Font("Dialog", Font.BOLD, 24);
String str = "Welcome to VisualAge";
int xPos = 5;

public void destroy() {
super.destroy();
}

public String getAppletInfo() {
return "TestJApplet\n" +
"\n" +
"Insert the type's description here.\n" +
"Creation date: (5/1/02 8:04:39 AM)\n" +
"@author: Administrator\n" +
"";
}

public void init() {
super.init();
addKeyListener(this);
addMouseListener(this);
}

public void keyPressed(KeyEvent e) {
System.out.println("keyPressed");
}

public void keyReleased(KeyEvent e) {
System.out.println("keyReleased");
}

public void keyTyped(KeyEvent e) {
System.out.println("keyTyped");
}

public void mouseClicked(MouseEvent e) {
System.out.println("mouseClicked");
}

public void mouseEntered(MouseEvent e) {
System.out.println("mouseEntered");
}

public void mouseExited(MouseEvent e) {
System.out.println("mouseExited");
}

public void mousePressed(MouseEvent e) {
System.out.println("mousePressed");
}

public void mouseReleased(MouseEvent e) {
System.out.println("mouseReleased");
}

public void paint(Graphics g) {
// Commenting out this super.paint() will allow it to
// reload correcly without an exception
super.paint(g);
g.setFont(font);
g.setColor(Color.black);
g.drawString(str, xPos, 50);
}

public void start() {
super.start();
}

public void stop() {
super.stop();
}
}

--
jse...@agora.rdrop.com
http://www.rdrop.com/~jsexton/


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----

Paul Lutus

unread,
May 1, 2002, 1:38:33 PM5/1/02
to
Jeff Sexton wrote:

> In article <PaVz8.13284$Ii2.1...@bin2.nnrp.aus1.giganews.com>,
> Paul Lutus <nos...@nosite.zzz> wrote:
>>Jeff Sexton wrote:
>>> Whenever a Swing applet, even a very trivial one, is repainted in
>>> Netscape 6.2, with the latest plug-in, an exception is thrown.
>>
>>Have you tried a different browser, even a different Netscape version? If
>>the outcome is the same, the problem is the applet or the plugin. If the
>>outcome is different, the problem is the browser.
>>
>>Might as well do some preliminary detective work.
>
> We use Netscape 4.7 (and some other 4.x versions) in production for such
> JApplets. For these versions, the Swing jar file is downloaded, but
> they work perfectly. I've been deploying apps that way for over a
> year.
>
> Once in awhile, since Netscape 6 came out, I give it a try along with
> the latest plug-in from Sun. The current versions work better than
> ever before, but they still have this paint() problem on a page
> reload (a start() call in other words).

Okay, based on that, the problem is Netscape 6.2, and this is not really a
Java issue.

--
Paul Lutus
www.arachnoid.com

PJ

unread,
May 7, 2002, 9:27:47 AM5/7/02
to
It works fine in Mozilla(the open source browser Netscape 6.x is based on)
with the latest plug-in, but I had to make the following changes to get it
to compile:

...
import javax.swing.*;

public class TestJApplet extends JApplet implements KeyListener,
MouseListener {
...

It could be a bug in Netscape 6.2, Mozilla 0.9.9 is newer. Is
com.sun.java.swing.JApplet identical to javax.swing.JApplet?

Babu Kalakrishnan

unread,
May 7, 2002, 10:10:41 AM5/7/02
to
On Tue, 07 May 2002 13:27:47 GMT, PJ <pj6...@excite.com> wrote:
>It works fine in Mozilla(the open source browser Netscape 6.x is based on)
>with the latest plug-in, but I had to make the following changes to get it
>to compile:
>
>...
>import javax.swing.*;
>
>public class TestJApplet extends JApplet implements KeyListener,
>MouseListener {
>...
>
>It could be a bug in Netscape 6.2, Mozilla 0.9.9 is newer. Is
>com.sun.java.swing.JApplet identical to javax.swing.JApplet?
>

The com.sun.java.swing package was abandoned about 3-4 years ago IIRC.
Were you using JDK 1.1.x + swing 1.0.3 earlier ? In which case your
problem was probably due to bugs in the swing library (there were many
in those days).

Using Java2 with the plugin should solve a lot of issues.

BK

0 new messages