User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 456,419 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,620 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1479 | Replies: 3
Reply
Join Date: Feb 2006
Posts: 14
Reputation: rahulgupta1979 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
rahulgupta1979 rahulgupta1979 is offline Offline
Newbie Poster

Help help needed in printing in java :(

  #1  
Apr 16th, 2007
hi everybody, cud neone here pls help me out in printing a page in Java. I have a page designed in swings which contains mainly labels and textareas. And i need to print this page in java with a click of a button. Could nebody arnd please help me out in this matter as it is very urgent and important. I will be really grateful to all the masters here.

<<snipped>>
Thanks and kind regards,
Rahul Gupta.
Last edited by ~s.o.s~ : Apr 17th, 2007 at 1:12 pm. Reason: Keep it on site.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2007
Location: Singapore
Posts: 42
Reputation: lucky1981_iway is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 3
lucky1981_iway's Avatar
lucky1981_iway lucky1981_iway is offline Offline
Light Poster

Re: help needed in printing in java :(

  #2  
Apr 16th, 2007
PrintService[] services3 = PrintServiceLookup.lookupPrintServices(null, null);
AttributeSet aset3 = new HashAttributeSet();
aset3.add(new PrinterName("my printer name", null));
aset3.add(MediaTray.BOTTOM);
services3 = PrintServiceLookup.lookupPrintServices(null, aset3);
PrinterJob pjob = PrinterJob.getPrinterJob();

try this . it will work
Last edited by lucky1981_iway : Apr 16th, 2007 at 7:26 am.
Reply With Quote  
Join Date: Feb 2006
Posts: 14
Reputation: rahulgupta1979 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
rahulgupta1979 rahulgupta1979 is offline Offline
Newbie Poster

Re: help needed in printing in java :(

  #3  
Apr 16th, 2007
thanks for the prompt reply. but how can I implement this with my JFrame page.???

Originally Posted by lucky1981_iway View Post
PrintService[] services3 = PrintServiceLookup.lookupPrintServices(null, null);
AttributeSet aset3 = new HashAttributeSet();
aset3.add(new PrinterName("my printer name", null));
aset3.add(MediaTray.BOTTOM);
services3 = PrintServiceLookup.lookupPrintServices(null, aset3);
PrinterJob pjob = PrinterJob.getPrinterJob();

try this . it will work
Reply With Quote  
Join Date: Apr 2007
Location: Singapore
Posts: 42
Reputation: lucky1981_iway is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 3
lucky1981_iway's Avatar
lucky1981_iway lucky1981_iway is offline Offline
Light Poster

Re: help needed in printing in java :(

  #4  
Apr 16th, 2007
You want to take printout of which thing ...?
You can add print job listener to your printjob and then you can implement your own set of actions.
Or in actionPerformed of button event you can create a printjob and add it for printing.

something like this

services3.createPrintJob();
.
.
.
pjob.print();
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 1:01 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC