Article View: borland.public.jbuilder.java.language
Article #16138Re: How do I print?
From: Adrian Ugray
Date: Tue, 30 Mar 1999 00:00
Date: Tue, 30 Mar 1999 00:00
72 lines
2723 bytes
2723 bytes
Hi Dan,
I'm having similar problems, I think....
I used the Designer in JBuilder to create a form which represents a report
that we need to print. I can use the standard print idea (with PrintJobs etc
- see a standard Java book - or base on what I have below) to print the page
with no problems if I display the form first (ie call setVisible( true ) on
it.
But of course, I don't actually want to display the form on the screen -
it's a hard copy only form.
So, if you find out anything, please post it to the group, as I'm interested
to see what the outcome is, also!
Regards,
Adrian.
BTW This operation is consuming my life as well!
Here's some code from a class that extends a Form:
public void printForm()
{
Toolkit toolkit = getToolkit();
PrintJob printJob = toolkit.getPrintJob( this, "PrintTest", null );
// The user may click cancel - printJob will return null
if ( printJob != null )
{
Graphics graphics = printJob.getGraphics();
// Print this component and all components it contains to the
// graphics object
// Wrap the printAll with setVisible method calls to actually
// get it to print -
// causes a quick flash on the screen of the form (which I never
// wanted to display
// on screen in the first place!)
setVisible( true );
printAll(g);
setVisible( false );
graphics.dispose();
printJob.end();
} // if
} // printForm
----------
In article <36FF6ED4.2A39DBFE@concentric.net>, DReese
<DReese@concentric.net> wrote:
>I am new to java/JBulder and am trying to 1) send text from a textArea
>to a printer, and 2) send both text and an image to a printer and have
>both print on the same page.
>
>I would like to be able to display a Windows 95/98 print dialog first,
>then send the print job.
>
>I have purchased a couple of mile-high books because they had printing
>routines, but their routines do not work. This simple (?) operation is
>starting to consume my life. Please help.
>
>Dan
>
Technical Details
Message-ID:
<7dqinn$2vo$1@ghostgum.hunterlink.net.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,6ec99c38f39466b0 X-Google-Attributes: gidf74b3,public From: "Adrian Ugray" <adrian@hunterlink.net.au> Subject: Re: How do I print? Date: 1999/03/30 Message-ID: <7dqinn$2vo$1@ghostgum.hunterlink.net.au> X-Deja-AN: 460741682 Content-Transfer-Encoding: 7bit Organization: HunterLink - An Australian Network Provider Content-Type: text/plain; charset="US-ASCII" Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language