Link to home
Start Free TrialLog in
Avatar of nraghu
nraghu

asked on

Java printing

I have an application which uses all swing components (JFrame , JScrollPane, JPanel etc). I have laid many panels in my JFrame which are enclosed in a JScrollPane. I am also displaying some graphics in the viewable area. I need to print the whole set without any loss of data, like even when I reduce the size of the application. I shud be able to print the entire contents (even the non viewable part which needs the scrolling). One component is JTable which may have data half hidden, I need to get the entire row set printed. What shud I do?
Avatar of threshold
threshold

You should create a invisible Frame(or Container) to include your components that you want to print.
If your data is very large, you should get the page size from PringJob and divide the data into several pages.
Then, Open the PrintJob to print the invisible frame.
Of cause, the Frame and the JScrollPane should be big enough to display the whole data(or sub-elements).

Maybe, you can display the invisible Frame for "preview".
Avatar of nraghu

ASKER

I need to handle the way MFC does. Already all my components are in a container. Jpanel.
So why shud I need an invisible frame. Does that mean that my JScrollpane shud be expanded to the maximum size. Does that mean my printing capabilities are limited
Yes and Yes. Java isn't MFC.
ASKER CERTIFIED SOLUTION
Avatar of threshold
threshold

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial