Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing Form  RSS feed

 
Ali Hassaan
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I hav to print a frame having JTable with some data.
But its not working for me. I m using Java Print API.
pls help me out.....
 
Jamie Young
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may or may not help???
This is a print method used to print text from a large text edit area. I am not quite sure how it would handle printing a table. I sure that you could print all the contents of it, but I am not sure what it would look like.
Good luck!

/**
* This method prints a file from the text edit area.
*
* @return void
*/
void PrintCommand()
{
//Frame used for PrintJob toolkit
Frame frame = new Frame();
//Properties used for PrintJob toolkit
Properties p = new Properties();
PrintJob pjob = getToolkit().getPrintJob (frame, "Report", p);
if(pjob != null)
{
Graphics pg = pjob.getGraphics();
// Reset the paper's origin to allow for left 1 inch margin
// 72 pts equivalent to 1 inch
pg.translate(72,72);
if(pg != null)
{
String s = BROWSEWIN_mBrowseMTEd.getText();
printLongString (pjob, pg, s);
pg.dispose();
}
pjob.end();
}
}//end of PrintCommand()

------------------
 
John Sinues
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the five part JavaWorld article, Printing in Java, at http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-print_p.html
Maybe this can give you some insight to your problem.
John
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!