craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > Printing issues Post New Topic   Post A Reply
Printing a table not included in a Frame gives blank pages printer friendly version
next newest post
Author Messages
Vishal
Private First Class

Gender: Male
Location: Williamstown, MA
Registered: Jul 2004
Status: Offline
Posts: 12

Click here to see the profile for Vishal Send email to Vishal Send private message to Vishal Find more posts by Vishal Edit or delete this message Reply w/Quote
Posted Friday, August 27, 2004 @ 15:27:39    ICQ  YIM

While trying to print a table which is not included in any swing component, I got blank pages. I want to print a table a little differently than it is displayed on the screen of the user as I want to resize the table so that columns fit on 1 page. To do this, I copied the main table into a new table by using newTable.refresh(oldTable.getDataVector()) Then I changed the columns and stuff of newTable and did newTable.print() - I got only blank sheets of paper.
Later, I tried putting newTable in a JFrame using the following code which worked:
JFrame frame = new JFrame();
frame.getContentPane().add(newTable);
frame.show();
then,
newTable.print(); //This time it works!!!

Is it neccessary to put a DBTable into a Frame to be able to just print it? Is there a way around this?

--------------------

Vishal
Private First Class

Gender: Male
Location: Williamstown, MA
Registered: Jul 2004
Status: Offline
Posts: 12

Click here to see the profile for Vishal Send email to Vishal Send private message to Vishal Find more posts by Vishal Edit or delete this message Reply w/Quote
Posted Wednesday, September 1, 2004 @ 15:10:40    ICQ  YIM

After the newTable.print() statement I dispose the temporary frame by using frame.dispose() so that users don't see and get confused by a new empty frame window.

--------------------

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Wednesday, September 1, 2004 @ 22:56:06  

This is a java limitation. If the component is not visible, you cannot print it.

There are some workaround

1) create the temporary frame outside screen coordiantes, so users cannot see this
JFrame frame = new JFrame();
frame.setBounds(-200, 0, 200, 200);
frame.getContentPane().add(newTable);
frame.setVisible(true);

2) try calling newTable.addNotify() (without adding to frame) & then call print. If this doesn't work then add newTable to frame , but without calling show() or setVisible(true); call newTable.addNotify() & then call print.

If this works, please share with us which solution worked.

Vishal
Private First Class

Gender: Male
Location: Williamstown, MA
Registered: Jul 2004
Status: Offline
Posts: 12

Click here to see the profile for Vishal Send email to Vishal Send private message to Vishal Find more posts by Vishal Edit or delete this message Reply w/Quote
Posted Thursday, September 2, 2004 @ 07:22:07    ICQ  YIM

The only workaround that works for me is to put the table in a dummy frame, then dispose that frame so that the users do not see that frame window, and then print. Here's the code I used:

//table has the dbtable which needs to be printed
JFrame frame = new JFrame(); //create dummy frame
frame.getContentPane().add(table); //add table to dummy frame
frame.show(); //show the dummy frame
frame.dispose(); //remove the dummy frame
table.print(); //print the dbtable - this works even after the above frame is disposed

--------------------

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios