• Post Reply Bookmark Topic Watch Topic
  • New Topic

My Print Preview does not work

 
ziansing chan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys, I  have done print preview by using Jdialog and Jpanel but it didn't show up after pack();.

I hope you guys can help me. I try different things like setVisible(true) but still doesn't work. Please Help Thanks so much.

   



Here is the preview jpanel



   

 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

What do you mean by not visible? Are you not seeing anything before or after you click “Print Preview”? I think (not certain) you need to call setPreferredSize on your components (or enough Components to cover the entire height and width of your display) before pack() will give you a useful size.
 
Fred Kleinschmidt
Bartender
Posts: 458
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your PreviewPanel code uses a variable "pf", but you not show where that is defined.
PreviewPanel should have a getPreferredSize() method.

Since the previewPanel instance is inside JScrolllPane you need to follow Campbell Ritchie's advice and give ScrollPane a specific size.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!