Print option:-  to print the entire JFrame and its components

I have created a screen using JFrame.
The screen contains components such as a graph, combobox, tabbedpane and JTable.
Now we have given 2 options to the end user, either to print the entire screen(JFrame) or
the contents available in the table.
My query is , how can i print the entire screen(all the components must be printed),
is there any api available for this purpose.
If possible provide me some sample codes.

<h3>{color:#ff0000}Cross posted{color}</h3>
[http://forum.java.sun.com/thread.jspa?threadID=5286030]
Cross posting is rude.
db

Similar Messages

  • How do I lift a picture in a document to print it without printing the entire document, and when I ask it to print at 400%, how do I get it to tell me how many pages there are and what is on them

    I have a pix of a quilt in a document. I would like to print the page of the document at 400% to enable me to see the quilt better. When I go to effects and put in my percent, it prints the entire document and will not allow me to move to other pages. It says its p1 of 1. I am taking a class for making this quilt. I need this pix for the class.

    http://www.kimberlyeinmo.com/classes/
    This the site. The tulip quilt is what I would like to enlarge and print without the whole document.

  • There is a difference between the document total and its components

    Hi!
    I have an error message "There is a difference between the document total and its components" when I want to create an InventoryGenEntry
    the problem arises from time to time and my customer must do the document two or three times before it is created.
    I have seen in this forum and in notes that this is probably being caused by a Rounding.
    I am using 2 digits for amounts, 4 digits for prices, 6 digits for rates and 3 digits for quantities.
    For information my customer use SAP 2005 and the patch level 46.
    This problem happened only in InventoryGenEntry. how can I modifiy parameters to resolve this problem?
    thank you for your help.
    Best Regards
    Séverine

    Hi Séverine,
    Do you find any additional code added to SBO_SP_Transaction stored procedure. A similar issue with stock transfer fixed in later patch. Please test in latest patch.
    Regards,
    Vijay kumar
    SAP Business One Forums Team

  • Difference between the document total and its components in inventory transfer

    Hi Everyone!
    When I make Inventory Transfer, SAP notice error "There is difference between the document total and its components.".Everyone that knows this problem, Pls help to find way to solve it.
    Thanks & Best regards
    Ngoc Loan

    Hi,
    Please refer to the thread.
    There is a difference between the document total and its components
    Hope Helps!
    Regards,

  • How to ZOOM the JFrame and its components ?

    Hi
    I could not find any solution/suggestions for this, so I am asking help.
    I am adding multiple components (JLables, JtextFields and a JTable) in to Jpanel(s) and to a JFrame window and I want to add Zoom (+ or - ) functions.
    I don't want to take each and every component from JFrame/ JPanel(s) and resize or repaint.
    Is there any way, that you can increase and decrease the whole JFrame and JPanel's view so that the components, which are been added to them, look like their sizes are also increased / decreased?
    Any suggestions or help would be appreciated.
    Thanks.
    Regards,
    Vally.

    ok...
    god bless the "GlassPane"
    you can take a snapShot of your frame...
    draw it on your glassPane..
    and just use your glassPane
    to paint the image with the requested size...
    in this approach you cant press a button and to things..
    shay

  • Enlarge JFrame and its components properties  proportionally

    Hi,
    We have a simple JFrame � Container - uses Flow Layout and has got Buttons, Text Fields� All of them are using Java�s default fonts, sizes..�
    And we want to increase or enlarge all of the JFrame and its sub components properties proportionally (especially Font�.) like in for example MS-Word.
    In the Ms-Word, there is ZOOM option in the Standard tool bar menu. If you set zoom to 150%, the font is automatically increases. And if you set it to 100% the font sets back to normal. And if the window is not enough to fit, it adds the scroll bars.
    For example, if we increase the Labels Font, the height of that component also should increase proportionally. So the Frame also should increase.
    How could we achieve this sort of functionality ( i.e. Proportionally increasing the component�s properties ) in Swing?
    I believe it is hard to set/adjust the all of the Frame�s components properties (I.e. Height, Font�) proportionally by using the Component listeners.
    (Another example, you might have noticed that the Frame�s Font, hight,width �sizes are proportionally bigger in Systems screen�s 800 by 600 pixels mode compare with 1024 by 768 pixels mode. May be this is windows feature. But we are looking at achieving the same sort of feature)
    Any help or thoughts would be appreciated.
    Thanks in advance.
    Vally.

    Here is a working sample:
    package ui_graphics;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.LayoutManager;
    import java.util.Arrays;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JSpinner;
    import javax.swing.SpinnerListModel;
    import javax.swing.SpinnerModel;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class ZoomableFrameTest {
       private ZoomablePanel zoomPanel;
       private JLabel label;
       public ZoomableFrameTest() {
          label = new JLabel("Essai pour le zoom");
          label.setBounds(0,0,200,16);
          zoomPanel = new ZoomablePanel();
          zoomPanel.add(label);
          JFrame frame= new JFrame("Zoom test");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().add(getZoomSpinner(), BorderLayout.NORTH);
          frame.getContentPane().add(zoomPanel, BorderLayout.CENTER);
          frame.pack();
          frame.setVisible(true);
       public static void main(String[] args) {
          new ZoomableFrameTest();
       public JSpinner getZoomSpinner() {
          String[] zoomValues = { "50", "100", "150" };
          SpinnerModel model = new SpinnerListModel(Arrays.asList(zoomValues));
          final JSpinner spZoom = new JSpinner(model);
          Dimension dim = new Dimension(60, 22);
          spZoom.setMinimumSize(dim);
          spZoom.setPreferredSize(dim);
          spZoom.setMaximumSize(dim);
          spZoom.setFocusable(false);
          spZoom.addChangeListener(new ChangeListener() {
             public void stateChanged(ChangeEvent e) {
                // R�cup�re le facteur d'�chelle
                int factor = Integer.parseInt((String)spZoom.getValue());
                setScaleFactor(factor);
          spZoom.setValue("100");
          return spZoom;
       private void setScaleFactor(int factor) {
          zoomPanel.setZoomFactor(factor);
    class ZoomablePanel extends JPanel {
       private int zoomFactor;
       public ZoomablePanel() {
          super(null);
       public void setZoomFactor(int factor) {
          this.zoomFactor = factor;
          if (this.isShowing()) this.repaint();
       public void paint(Graphics g) {
          super.paintComponent(g);
          double d = zoomFactor / 100d;
          Graphics2D g2 =(Graphics2D)g;
          g2.scale(d, d);
          super.paint(g2);
    }

  • How can i print just one page of photo book without printing the entire book

    how can i print just one page of photo book without printing the entire book

    Jim,
    Take heart.  We can help.
    First turn on page view so you can see how the content of your sheet fits on the page(s).  A Numbers document contains sheets (listed on the left) which in turn contain tables, charts, text, and graphics.  Select the sheet you want to print on the left, then enable page view by selecting the menu item:
    "View > Show Print View":
    Now you should see your content and how it fits on one, or more, pages.  If thie content is too big for one page use the controls and the bottom left of the window to expose the sheet controls:
    Here a table is too big to fit on one page:
    slide the "Content Scale" slider so the content fits:

  • How to print the whole JFrame

    Hi,
    I got this code somewhere from the net.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    /** A simple utility class that lets you very simply print
    *  an arbitrary component. Just pass the component to the
    *  PrintUtilities.printComponent. The component you want to
    *  print doesn't need a print method and doesn't have to
    *  implement any interface or do anything special at all.
    *  <P>
    *  If you are going to be printing many times, it is marginally more
    *  efficient to first do the following:
    *  <PRE>
    *    PrintUtilities printHelper = new PrintUtilities(theComponent);
    *  </PRE>
    *  then later do printHelper.print(). But this is a very tiny
    *  difference, so in most cases just do the simpler
    *  PrintUtilities.printComponent(componentToBePrinted).
    *  7/99 Marty Hall, http://www.apl.jhu.edu/~hall/java/
    *  May be freely used or adapted.
    public class PrintUtilities implements Printable {
      private JFrame componentToBePrinted;
      public static void printComponent(JFrame c) {
        new PrintUtilities(c).print();
      public PrintUtilities(JFrame componentToBePrinted) {
        this.componentToBePrinted = componentToBePrinted;
      public void print() {
        PrinterJob printJob = PrinterJob.getPrinterJob();
        printJob.setPrintable(this);
        if (printJob.printDialog())
          try {
            printJob.print();
          } catch(PrinterException pe) {
            System.out.println("Error printing: " + pe);
      public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
        if (pageIndex > 0) {
          return(NO_SUCH_PAGE);
        } else {
          Graphics2D g2d = (Graphics2D)g;
          g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
          disableDoubleBuffering(componentToBePrinted);
          componentToBePrinted.paint(g2d);
          enableDoubleBuffering(componentToBePrinted);
          return(PAGE_EXISTS);
      /** The speed and quality of printing suffers dramatically if
       *  any of the containers have double buffering turned on.
       *  So this turns if off globally.
       *  @see enableDoubleBuffering
      public static void disableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
      /** Re-enables double buffering globally. */
      public static void enableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(true);
    }From my main class (where the JFrame resides), the print() method is invoked to print the JFrame. However, when it is printed, it only prints the top left part of the JFrame, not the whole JFrame. Can anyone help please? Thank you very much.

    public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
        if (pageIndex > 0) {
          return(NO_SUCH_PAGE);
        else {
          Graphics2D g2d = (Graphics2D)g;     
          g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
           double xScale = 0.63;
           double yScale = 0.56;
          g2d.scale(xScale, yScale);
          disableDoubleBuffering(componentToBePrinted);     
          componentToBePrinted.paint(g2d);
          enableDoubleBuffering(componentToBePrinted);
          return(PAGE_EXISTS);
      }Hi all,
    Alright I managed to scale it to print the whole JFrame. But another problem surfaces. When I select draft quality printing, it doesn't print the whole JFrame. Other printing qualities (standard, high) do print the whole JFrame. I am really puzzled. Anyone has any clue?
    And I have an unrelated question to this topic. How do I set a JTextField so that when I click on it the first time, it highlights its content? Have to work around with the mouselistener?
    Thank you.

  • Why will some website articles not print preview or print more than part of the document in firefox. I sometimes have to go to IE to be able to print the entire document.

    I often want to print an article from a website. Many times when I print preview, it will only show the first, second and maybe last page, but nothing inbetween. I have tried printing it anyway but nothing inbetween will print. My solution has been to go to Internet Explorer where I have then been able to print preview and print the entire article. This is annoying and takes extra time. Is there a setting that I need to make in order to eliminate the problem

    Top left (Orange) Firefox button, Print, Print Preview. Does everything look correct? You may also click the icon that looks like a "DISK" to save, which allows you to save it to your computer and CTRL+P will allow you to print.

  • How do i set it to fit to screen to print the entire file?

    How do i set it to fit to screen to print the entire file?  I have a file that is smaller than 8.5x11 but it says it's larger and clipping will occur and when I print it, it does not fit the paper.  Ive even clicked the box that says Scale to Fit Paper Size and it's still giving me that message and cutting info off. 
    I also need to be able to size it by percentage so I can adjust it to fit into a pre made form Im working with.

    First, I am new to this forum and I was told by Adobe that I would get help from Adobe as well as other users here, so that's why I posted.  But nobody asked me for basic info about image dimensions and printing sizes.  I never claimed to be an expert, just a basic user of PS, which is why Im asking for help.  I've used this program for my basic needs which is probably 1/1000th of what PS is capable of, but it's what I've used and I've always had success doing what I needed to do with it. If you can help, I very much appreciate it but if you just want to slam me and say you don't believe what I say, then that's not really helpful. Since nobody else responded to this post with any offers for help, the info you seek is below.  If you have any thoughts on how to help, I greatly appreciate it.
    Im not sure how the image dimensions apply to my question at all but here they are: 3300x2550 with a 300 dpi resolution. 
    Im simply trying to get the program to allow me to fit the image to the paper Im printing and adjust it as necessary to make it fit a partially pre-printed form I need for work and in every PS version I've used that I can recall, it allowed that.  It certainly allowed it, using the same printers Im using now, in CS5.
    Also, you mentioned that the printer driver handles this but I can do this in every other program I have on this computer with the same printers, from Numbers (it's a Mac) to Preview to Mac Mail so why wouldn't it do the same thing in PS? That's what Im trying to find out here and with most software, I can pick up a phone or get on a one-on-one chat and get help, but apparently not with PS and since it's not a cheap program, I expected more.  I never needed to call for help before using this new version, so that's something I need to consider.
    Again, if you are able to help, I appreciate it. Thanks!

  • Unable to print the entire document, how do I print the entire document?

    Unable to print the entire document, how can I fix this and get the entire document printed?

    Please provide some details; without it, nobody can possibly answer your question.

  • Printing the entire contents of a folder

    Hi,
    I have a Macbook with Tiger, and I'm trying to print an entire folder of Word documents at the same time. I tried creating a desktop printer so I could drag and drop the files, but my computer just opens a Word window (to the very annoying Word default screen, asking me if I want to create a blank document) for each document I drag in. Is there any way to elegantly print the entire contents of a folder?
    Message was edited by: Stockmoose16

    Hi alex!
    Unfortunately, not in OS X.
    But take a look at this utility Printwindow. Corrected Now.
    EDIT: OOPS! That link seems to be broken. I'll see if I can find a new one.
    BRB
    ali b

  • How to print the row  ,column,and particular cell in separate color

    how to print the row  ,column,and particular cell in separate color IN ALV GRID

    HI,
    Here you go good program links
    <a href="http://www.sapfans.com/forums/viewtopic.php?t=52107">How to Set Color to a Cell in AVL</a>
    <a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm">ALV Grid Coloring</a>
    Thanks
    Mahesh

  • How to print the current date and time?

    Hi Friends!
    I have tried this program to print the current time and date,
    #include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    time_t tim;
    time(&tim);
    cout << ctime(&tim);
    return 0;
    But it show the warning as;
    warning C4996: 'ctime': This function or variable may be unsafe. Consider using ctime_s instead.
    Can anyone suggest whats wrong with this?

    i also got many warring when i use old version keyword. as i note on think thatin new vc++ has many keyword change with _s. the old keyword works even get warring.or you can change to as it suggest.For About ctime_s
    Check this link for more detail (RefLink)
    No, it shows error, when you use ctime_s instead of ctime.
    error C2660: 'ctime_s' : function does not take 1 arguments

  • Can I print the File name and page number

    When printing a file, I would like to print the File Name and the page number also...something like a header, in every page printed.  Is this possible in Acrobat?  Please advise.
    Thanks

    Sure. Did you look under Tools - Pages - Header & Footer ?

Maybe you are looking for

  • Performance issue with Oracle data source

    Hi all, I've a rather strange problem that I'm stuck on need some assistance on. I have a rules file which drags data in via an SQL data source thats an Oracle server. If I cut/paste the 3 sections of "select" "from" and "where" into SQL-Developer an

  • Can i get a z report of MB5B

    Hi, I need a custom report of MB5B for a company showing opening stock and closing stock of materials without showing null stock materials? Thanks

  • Creation of Space failes with the following error

    SR- 3-6660108191 Ver-11.1.1.6 In customer production environment when they attempting to creat a space from WebCenter, they receive the following: Creation of space SteveSpace4_11January2013 failed with errors : WCS#2013.01.11.08.47.28: Errors were e

  • Date and number format with JDEV 10 g

    Are there some known bugs in JDEV 10g regarding dates and currency format? I am using bc4j, struts and jsp. I have tried setting the format on the entity and view objects but it works sometimes and sometimes not.

  • Command 1 in Messages not bringing up Buddies Window

    When I press Command 1 in Messages, it not bringing up Buddies Window.  I can go to Window and select Buddies fine.  Any ideas?