Printing using 1.1 API - big gray square in upper left

Discussion in 'Java' started by Bruce Feist, Oct 25, 2006.

  1. Bruce Feist

    Bruce Feist Guest

    I'm trying to print using Java, for the first time. I decided to use
    the 1.1 API because it's simple and adequate for the simple line drawing
    I'm trying to display (a maze). I'm actually drawing on the Graphics
    object received from the PrintJob directly, scaling my diagram to the
    reported dimensions. The drawing is done with a series of
    Graphics.setColor() and Graphics.drawLine() calls -- nothing else. The
    only colors I set to are white and black, and the same routine that
    draws to the page also is used to draw to a 400x400 JFrame's ContentPane
    successfully.

    It mostly works, the upper left corner of each 8.5" x 11" page is
    obscured by a light gray square, measuring roughly 5" x 5". The square
    only shows up when I draw to the printer -- not to the JFrame/ContentPane.

    What on earth could cause this? Any ideas?

    Thanks,
    Bruce Feist
    Bruce Feist, Oct 25, 2006
    #1
    1. Advertising

  2. Bruce Feist

    Bruce Feist Guest

    Bruce Feist wrote:

    > the upper left corner of each 8.5" x 11" page is
    > obscured by a light gray square, measuring roughly 5" x 5".


    Update: I tried this on two printers (different models), and got
    identical results. So, I gave up on the 1.1-style printing, and rewrote
    the code for 1.2 style instead. It works perfectly -- even though it's
    using exactly the same underlying method for drawing on a Graphics
    object that both the 1.1 version and the frame-based version do.

    It's moot at this point, but I'd still like to know why I was getting
    that square!

    Bruce
    Bruce Feist, Oct 26, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,192
  2. Shaguf
    Replies:
    0
    Views:
    318
    Shaguf
    Dec 24, 2008
  3. Shaguf
    Replies:
    0
    Views:
    422
    Shaguf
    Dec 26, 2008
  4. Shaguf
    Replies:
    0
    Views:
    207
    Shaguf
    Dec 26, 2008
  5. BlackHelicopter
    Replies:
    0
    Views:
    494
    BlackHelicopter
    Jan 31, 2013
Loading...

Share This Page