473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

creating print button in applet

hey i want to create a print button in java applet to print nwhole applet .. i created one but it is printing a blank blank page . my actionListener function is as following..
Expand|Select|Wrap|Line Numbers
  1.  public void actionPerformed(ActionEvent e) {
  2.        String str= e.getActionCommand();
  3.         if (str.equals("print"))
  4.        {
  5.        PrinterJob printJob = PrinterJob.getPrinterJob();
  6.            printJob.setPrintable(this);
  7.            if (printJob.printDialog()) 
  8.            {
  9.               try 
  10.               {
  11.                 printJob.print();
  12.               } 
  13.               catch (Exception ex)
  14.               {
  15.                 ex.printStackTrace();
  16.               }
  17.            }
  18.  
  19.        }
  20.  
Jul 1 '11 #1
0 1210

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Dennis Allen | last post by:
Hi. On one particular web page I want to offer the user a print button. Question. How do I create one? Something compatible with most browsers would be nice. Appreciate any advice...Dennis
3
by: Mariame | last post by:
Hi All, How to add a print button to a crystal report??? Thx & Regards
0
by: prophet | last post by:
how do I create a print button that is on my index page that prints my target page (and only the target page) I tried <INPUT onclick=window.print(); type=button value="Print This Page"...
1
by: hexagram | last post by:
hi can anybody here help me on my problem the condition is if the form is blank or incomplete or not save the print button is disable, otherwise if the form is fill up complete and saved the...
0
by: esateesh | last post by:
HI i have a .aspx page with a print button and am calling java script function i.e onclick="window.print()" when a print is given am gettng print button in the pirnted page, but it should not be...
2
by: fperri | last post by:
I have a custom toolbar with a print button on it that pops up when the user is print previewing a report. I used the print command under the file list on the custom menu window when building it. For...
2
by: gggram2000 | last post by:
Hi, I'm using visual studio 2005, c#. Im having problems creating a print button that will open a word document with the data entered by the user...the user enters his name and so fort in text...
4
by: pacarv | last post by:
I've created a database in Access 2003 with multiple reports that are accessable from the switchboard. The switchboard also has a print button. The user selects the report from the menu which then...
0
by: mohanty2050 | last post by:
I am using Crystal Report 9 and VB6.0. I can display the report through Crystal report viewer properly. But the print button in the Crystal report viewer does not work. My printer is in network. If I...
0
by: Anoop Athreyasa | last post by:
Hi all, I'm facing issue with the print button present in the toolbar of IE. Whenever i click the print button, the page's prerender event is called. This happens only in IE. When i try to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.