🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

jdk1.2 printing

#19459
From: R.C. vd Zon
Date: Wed, 04 Feb 1998 00:00
44 lines
1447 bytes
Hi,

I am trying to print from jdk1.2 using PrintJob2D.
In the following code the print method will be
called 225 times!.
Printing is very slowly and uses a lot of memory.
Also the programm never returns from the print(book)
method.

Is this a bug in jdk1.2 or am I doing something wrong?

Robbert van der Zon
Dicon Automatisering



package test;

import java.awt.*;
import java.awt.print.*;
import java.awt.font.*;

public class Test implements java.awt.print.Printable {
  public static void main(String args[]){
    GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
    PrintJob2D pj = ge.getPrintJob2D();
    Book book = new Book(); 
    Test t = new Test();
    PageFormat pf = new PageFormat();
    book.append(pf,t);
    pj.print(book); 
  }

 
  public void print(Graphics2D graphics){
    graphics.drawString(
      new StyledString("hello",Font.getFont("courier")),10,10);
  }



}
Technical Details
Message-ID: <34D89294.1131@dicon.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,41322ef3228588d6,start
X-Google-Attributes: gidf74b3,public
From: "R.C. vd Zon" <vdZon@dicon.nl>
Subject: jdk1.2 printing
Date: 1998/02/04
Message-ID: <34D89294.1131@dicon.nl>
X-Deja-AN: 322019264
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: DICON Automatisering B.V.
Mime-Version: 1.0
Reply-To: vdZon@dicon.nl
Newsgroups: borland.public.jbuilder.java.language