The Artima Developer Community
Sponsored Link

Java Answers Forum
printing JPanel that is added to the JScrollPane

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
vasireddy kiran kumar

Posts: 1
Nickname: vkk
Registered: Aug, 2002

printing JPanel that is added to the JScrollPane Posted: Aug 2, 2002 6:33 AM
Reply to this message Reply
Advertisement
Hi

I am facing a typical problem while I am printing my JPanel.
My Panel is added to the JScrollPane.And I added 200 Images to the JPanel (20 rows and 10 columns).
To see the 6,7,8,9,10 Images I have to scroll it left side and for 80 to 200 images I have to scroll down.
Now if i print my JPanel it is only printing the Images those are visible to the user at a time. If scroll down and say print again it is printing the bottom components and missing Top components (Images).
I want to print all the images at a time.
Can any body suggest me how to do it. My Panel implements Printable interface and the following is the print method that I implemented


public int print(Graphics g, PageFormat pageFormat, int pageIndex) {

if (pageIndex > 0) {
return(NO_SUCH_PAGE);
} else {
Graphics2D g2d = (Graphics2D)g;
g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());


componentToBePrinted.paintAll(g2d);
return(PAGE_EXISTS);
}
}

Thank you and Regards
Kiran Kumar Vasireddy

Topic: Flaw in inheritance and overloading combination? Previous Topic   Next Topic Topic: JOptionPane  - conflict with exception handling?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use