Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Printing problem

Posted on 2004-11-01
10
Medium Priority
?
285 Views
Last Modified: 2008-02-26
I have created a report by using JTable in a JPanel, I want to print the contents of JPanel. could you guys pls help me to do this?.

I did use

PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(this);


But I am getting the error message:

ReportUI.java [648:1] cannot resolve symbol
symbol  : method setPrintable (ReportUI)
location: class java.awt.print.PrinterJob
        printJob.setPrintable(this);
                ^


what will be the peoblem?.
0
Comment
Question by:tstName
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
10 Comments
 
LVL 13

Expert Comment

by:petmagdy
ID: 12461844
"this" is not of Type ReportUI
0
 

Author Comment

by:tstName
ID: 12462065
"this" is not of Type ReportUI" is the message that i got from java, my problem is to get print the panel contents, the panel includes table data and label data.
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12462388
sorry my mistake

ok if ur class implemetns Printable do this

printJob.setPrintable( (Printable) this );



0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tstName
ID: 12462489
printJob.setPrintable( (Printable) this ); // this statement will give cast exception
0
 
LVL 13

Accepted Solution

by:
petmagdy earned 120 total points
ID: 12462523
then ur ReportUI dosn't implement Printable, that is the cause of the problem
0
 

Author Comment

by:tstName
ID: 12472562
i have a swing Form with JPanel and a JTable.JPanel contain Header and footer informatin for a report, JTable contain  100's of records, i need to print the Jpanel and JTable data. JTable is a Scrollable table, 20 records will display at a time.pls help me to solve this issue.
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12472605
Let ReportUI implements Printable as the link given by JK2429
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question