Results 1 to 4 of 4

Thread: Print in java using Swing

  1. #1
    Join Date
    Nov 2009
    Posts
    877

    Print in java using Swing

    Hi, I am making my project using java swing components and need to print my page. Can anyone tell me how to do this? It will make me more trouble if I couldn't get the solution. Will you please help me? Please reply as soon as possible. I am waiting for your reply.
    Last edited by Sheenas; 18-11-2009 at 09:22 AM.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Print in java using Swing

    For Printing using Swing I have used following code when I made my project. Just try this In your code:

    Frame frame = new Frame(“Text for printing ”);
    Toolkit toolkit = frame.getToolkit();
    PrintJob job = toolkit.getPrintJob(frame, “Test Printing”, null);
    Graphics g = job.getGraphics();
    frame.printComponents(g);
    g.dispose();
    job.end();


    It will work to print your frame.

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: Print in java using Swing

    Hi, I don't think that this would be possible using swing components. If you are using java script in your code then that will provide you the method of window.print() which prints the whole page which you are opened that time. Just try to use it. I think it will give you solution. But, in case of the swing, you don't find more solution so just check it. Try to find it in the java books which are specifically provides you the information regarding the swing components.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Print in java using Swing

    Hi, you need to use some third party solution such as reports. It will help to print the forms using swing. Just check on the internet which type of reports will help you in this situation. Just try to use it. I know that this would work for you as one of my friend had done this when he was getting the same problem. So, just try to search which report will help you in this situation. I don't know the exact name of report and it is not possible to ask to that friend also. Just tr;y to search it. And make it to use for your purpose.

Similar Threads

  1. Applets V/s Swing in JAVA
    By "Dritan" in forum Software Development
    Replies: 3
    Last Post: 14-12-2010, 09:04 AM
  2. Java Swing and MySQL
    By shelton141 in forum Software Development
    Replies: 1
    Last Post: 22-09-2009, 08:50 AM
  3. drawPolygon in java Swing?
    By JagdishP in forum Software Development
    Replies: 3
    Last Post: 07-08-2009, 11:33 PM
  4. Message Box example for Java Swing
    By Visala28 in forum Software Development
    Replies: 3
    Last Post: 31-07-2009, 05:30 PM
  5. Java swing help with repaint()
    By grudge in forum Software Development
    Replies: 4
    Last Post: 23-07-2009, 03:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,481,051.29042 seconds with 17 queries