🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Printing Problems

#11856
From: John Niesz
Date: Tue, 06 Apr 1999 00:00
48 lines
2246 bytes
I'm having the same problems, using JDK1.1.6_Borland and JDK1.2, with Swing 1.1
and 1.1.1 (all possible combinations tested).  Whenever I try to print my
components with the code below, it prints a blank page.  The same code worked
with JDK1.1.6 without Swing components, so there's something wrong with the way
Swing tries to print (if it tries at all).  Any ideas?

////////////////////////////////////////////////////////////
    Properties props=new Properties();
    PrintJob pj=getToolkit().getPrintJob(this, "DataMan 3.0 Printing...",
props);
    if (pj!=null) { //user did not cancel
      Graphics pg=pj.getGraphics();
      getContentPane().printAll(pg);
      pg.dispose();
      pj.end();
    }
/////////////////////////////////////////////////////////////



Don Lyman wrote:

> To just get a snapshot (in Windows) do: <Alt><PrintScrn> then <Ctrl>V in
> Word.
>
> I had some success printing components with jdk1.1.6_Borland, but any other
> jdk prints ugly components because it assumes the same dpi as your screen.
>
> Anne Nortcliffe wrote in message <36D2AED0.CC8E0C49@sheffield.ac.uk>...
> >Anybody know how I can print my GUI to a file for manipulation in Word
> >etc Also I'm having problems just printing a form out, with the
> >following code;
> > PrintJob prnJob=getToolkit().getPrintJob(this, "Printing",  null);
> >
> >    Graphics pg=prnJob.getGraphics();
> >    this.printComponents(pg);
> >      if (pg!=null){
> >      this.printAll(pg);
> >      pg.dispose();
> >
> >      }
> >    prnJob.end();
> >
> >All I get is a blank page..
> >
> >Any help would be helpful
> >
> >
Technical Details
Message-ID: <370AC85D.414B3304@worldnet.att.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36D2AED0.CC8E0C49@sheffield.ac.uk> <7c7c0h$kbd8@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,d8d31f3d4bf44ba5
X-Google-Attributes: gid111d45,public
From: John Niesz <sunrunner15@worldnet.att.net>
Subject: Re: Printing Problems
Date: 1999/04/06
Message-ID: <370AC85D.414B3304@worldnet.att.net>
X-Deja-AN: 463485767
Content-Transfer-Encoding: 7bit
References: <36D2AED0.CC8E0C49@sheffield.ac.uk> <7c7c0h$kbd8@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing