🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19152

Re: Printing from an Java Application.

#19152
From: Richard Merdinger
Date: Wed, 11 Mar 1998 00:00
72 lines
3099 bytes
Bas,

I too have been experiencing this Null Pointer Exception during event
dispatching.  I have spent literally 8+ days looking at it.  The only
way I have found to alleviate the problem is to increase the amount of
memory available to the application.

I found a very loose correlation between this exception and garbage
collection taking place during the printing process.  I don't know if
something is getting reclaimed that the printing subsystem still
needs, or what.

There is every possibility that I have been going down the wrong path
with this, but, like I said, I was able to get the problem to go away
90% of the time by increasing the *initial* memory available to the
app to about 3mb.

Hopefully Rich from Borland will help out on this one.

Please share with me any experiences you have thist might shed light
on this critical problem.

Richard Merdinger
Jomax Technologies Inc.
rmerdinger@jomax.net


On Mon, 09 Mar 1998 15:46:49 +0100, Bas Passon <basp@sci.kun.nl>
wrote:

>Hi,
>
>I'm curently working on a project for the KUN and I am having problems
>with printing from the apllication. I have the following source.
>
>void print_item_actionPerformed(ActionEvent e) {
>    Frame printframe = new Frame();
>    Properties prop = new Properties();
>    PrintJob message;
>    Graphics myGraphics;
>    String msg_text = "A Java Print test by Bas Passon.";
>
>    message =
>Toolkit.getDefaultToolkit().getPrintJob(printframe,"test1",prop);
>    myGraphics = message.getGraphics();     //(LINE 184!)
>    myGraphics.drawString(msg_text,50,100);
>    myGraphics.dispose();
>    message.end();
>  }
>
>When I compile and try to print the Execution log says the following:
>
>AppAccelerator(tm) 1.1.2.018 for Java (JDK 1.1), x86 version.
>Copyright (c) 1997 Borland International. All Rights Reserved.
>Exception occurred during event dispatching:
>java.lang.NullPointerException
>	at sun.awt.windows.WGraphics.drawChars(Compiled Code)
>	at sun.awt.windows.WGraphics.drawString(Compiled Code)
>	at MessageView.print_item_actionPerformed(MessageView.java:184)
>	at
>MessageView_print_item_actionAdapter.actionPerformed(MessageView.java:222)
>	at java.awt.MenuItem.processActionEvent(MenuItem.java:336)
>	at java.awt.MenuItem.processEvent(MenuItem.java:307)
>	at java.awt.MenuComponent.dispatchEventImpl(Compiled Code)
>	at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:138)
>	at java.awt.EventDispatchThread.run(EventDispatchThread.java:65)
>
>I just want to printout some text. What am I doing wrong?
>
>Greetings Bas Passon.
>basp@sci.kun.nl
Technical Details
Message-ID: <3506e325.88757286@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <350400D9.936971A1@sci.kun.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,4bff4117d72011c8
X-Google-Attributes: gidf74b3,public
From: rmerdinger@jomax.net (Richard Merdinger)
Subject: Re: Printing from an Java Application.
Date: 1998/03/11
Message-ID: <3506e325.88757286@forums.borland.com>
X-Deja-AN: 333068983
References: <350400D9.936971A1@sci.kun.nl>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language