JTable: printing  more lines

I am reusing the code from http://manning.com/sbe/files/uts2/Chapter22html/Chapter22.htm to print a JTable. Is there anyone has any idea how to change the code in order to make the margin narrower for printing more? It is because it prints another page after printing 17 lines.
public int print(Graphics pg, PageFormat pageFormat, int pageIndex) throws PrinterException{
   if (pageIndex >= m_maxNumPage)
      return NO_SUCH_PAGE;
   pg.translate((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY());
   int wPage = 0;
   int hPage = 0;
   pageFormat.setOrientation(PageFormat.LANDSCAPE);
   if (pageFormat.getOrientation() == pageFormat.PORTRAIT){
      wPage = (int)pageFormat.getImageableWidth();
      hPage = (int)pageFormat.getImageableHeight();
   else{
      wPage = (int)pageFormat.getImageableWidth();
      wPage += wPage/2;
      hPage = (int)pageFormat.getImageableHeight();
      pg.setClip(0, 0, wPage, hPage);
   int y = 0;
   pg.setColor(Color.black);
   Font fn = pg.getFont();
   FontMetrics fm = pg.getFontMetrics();
   y += fm.getAscent();
   y += 20;
   Font headerFont = m_table.getFont().deriveFont(Font.BOLD);
   pg.setFont(headerFont);
   fm = pg.getFontMetrics();
   TableColumnModel colModel = m_table.getColumnModel();
   int nColumns = colModel.getColumnCount();
   int x[] = new int[nColumns];
   x[0] = 0;
   int h = fm.getAscent();
   y += h;
   int nRow, nCol;
   for (nCol = 0; nCol < nColumns; nCol++){
      TableColumn tk = colModel.getColumn(nCol);
      int width = tk.getWidth();
      if (x[nCol] + width > wPage){
     nColumns = nCol;
     break;
      if (nCol + 1 < nColumns)
     x[nCol + 1] = x[nCol] + width;
      String title = (String)tk.getIdentifier();
      pg.drawString(title, x[nCol], y);
   pg.setFont(m_table.getFont());
   fm = pg.getFontMetrics();
   int header = y;
   h  = fm.getHeight();
   int rowH = Math.max((int)(h * 1.5), 10);
   int rowPerPage = (hPage - header)/rowH;
   m_maxNumPage = Math.max((int)Math.ceil(m_table.getRowCount()/(double)rowPerPage), 1);
   TableModel tblModel = m_table.getModel();
   int iniRow = pageIndex * rowPerPage;
   int endRow = Math.min(m_table.getRowCount(), iniRow + rowPerPage);
   for(nRow = iniRow; nRow < endRow; nRow++){
      y += h;
      for(nCol = 0; nCol < nColumns; nCol++){
     int col = m_table.getColumnModel().getColumn(nCol).getModelIndex();
     Object obj = m_table.getValueAt(nRow, col);
     String str = obj.toString();
     pg.setColor(Color.black);
     pg.drawString(str, x[nCol], y);
   System.gc();
   return PAGE_EXISTS;
}

i have posted there. moving to Burundi from Canada, where i purchased the computer, is not conducive to calling apple ($$$$$$$$$/bad phone lines) or a conveniently located Apple repair shop (or even internet or electrical grid, for that matter).
What i hope is that enough internet ire may coax more publicity and perhaps a proper response for a defective manufacturing issue. then, with a viable repair/replacement/warranty extension program, and an actual published/documented solution to the published/documented fault, i can confidently spend the enormous effort/investment to have my computer actually FIXED.
plus it feels good to vent.

Similar Messages

  • How can I print more than 16 lines in an invoice PLD

    Hello, Im currently using SAP 2007 SP1 PL09.
    I cannot print more than 16 lines in my PLD invoice. I have tried making the repetitive area longer, making the end of report and the page footer shorter, I tried setting the "lines in repetitive area" to 50 and I also increased the max rows per page and the only thing that seemed to work was setting the "print with vertical compression" in the invoice print preferences to a value under 100.
    is this the only way I can solve my problem?
    Thanks,

    Hello neito
    Jst increase the height of the layout go to doucment properties change the height there to 1200 and see u can get more than 26 records per page
    Regards Jenny

  • Printing more than 1 header line in ALV

    How to print more than one line from header table before printing detail lines in REUSE_ALV_HIERSEQ_LIST_DISPLAY?

    Hi
    Hierarchical sequential list output.
    The function module is
    A.  REUSE_ALV_HIERSEQ_LIST_DISPLAY
    1. Export:
        a. I_CALLBACK_PROGRAM
        b. I_CALLBACK_PF_STATUS_SET
        c. I_CALLBACK_USER_COMMAND
        d. IS_LAYOUT
    e. IT_FIELDCAT
    f.  IT_EVENTS
    g. I_TABNAME_HEADER : Name of the internal table in the program containing the output data of the highest hierarchy level.
    h. I_TABNAME_ITEM : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    i. IS_KEYINFO : This structure contains the header and item table field names which link the two tables (shared key).
    2. Tables
      a. T_OUTTAB_HEADER  : Header table with data to be output
      b. T_OUTTAB_ITEM       :  Name of the internal table in the program containing the  output data of the lowest hierarchy level.
    if it is helpful reward points,
    thanks,
    sap-abap

  • Print JTable with multi line header

    I need to print a JTable with multi line header, I want to know if I can use the method jTable.print(int, MessajeFormat, MessageFormat) by manipulation of the MessageFormat. How I can manipulate it?
    Otherwise, How I can print this?

    hi again,
    To print pdf in a swing application you don't need servlet.jar.
    You'll only need itext.jar and a printer connected to your pc.
    Download the iText source code and unzip it. See the following classes:
    com.lowagie.tools.LPR and com.lowagie.tools.BuildTutorial. This latter is the main class of a swing tool that you can run.
    Silent Print:
    You have only to embed this javascript code in your pdf:
    writer.addJavaScript("this.print(false);", false);
                        document.add(new Chunk("Silent Auto Print"));Then, you have to send the document to the printer.
    Google : java print pdf
    http://forum.java.sun.com/thread.jspa?threadID=523898 or
    http://www.exampledepot.com/egs/javax.print/pkg.html for printing task.
    Under unix system, I used this:
                           String PRINTER = ...;
                   try {
                        String cmd = "lp -d " + PRINTER + " " + PDF_PATH;
                        Runtime.getRuntime().exec(new String[] { "sh", "-c", cmd });
                   } catch (Exception e) {
                                 //handle the exception
                                 e.printStackTrace();
                   }hth

  • How do I change the spacing between lines in Pages 5.5.2?  Single spacing prints more like double spacing.

    How do I change the spacing between lines in Pages 5.5.2?  Single spacing prints more like double spacing.

    In the Format panel under the Text Style tab, there is a ▸ Spacing category. Click it to open, and you will have a selector that defaults to Lines, and to the right, the ability to set your spacing in decimal values. In addition to Lines, you also have At Least, Exactly, and Between capability. You can even set exact line height  in points. Check that your Before Paragraph, and After Paragraph settings are correct for your needs.

  • Printing two lines of text in Print Module

    Is it possible to print two, or more lines of text, say on a contact sheet, such as filename and caption. If so, how?

    Lightroom automatically wraps text under the thumbnail in contact sheets. The Text Template Editor does not allow you to enter line breaks. So, if your Filename is long enough to fill the first line, the caption will start with the second. If not, you can tweak the template somehow so that it looks the way you want.

  • SAP Script Check printing Layout, Line Items to display twice in First Page

    Hi All,
    This requirement is for US check printing Layout.
    My Requirement is to display Items twice on the first page.
    Eg : Main Window has 10 Items, I need to display all the Items at the bottom in another window at the bottom.
    I can't create 2 Main windows in the first page, as the data from the Main window 1 overflows to Main window 2 in the first page.
    I copied print program RFFOUS_C into a Z-version and try to implement the logic, however unable to print the line items in the bottom window.
    Kindly give your valuable Inputs.
    Thanks
    Vinayak

    Hi
    I had the same request for a check form in Canada. I solved it by writing the line item output into variables and print these variables in a second window. It was ~10 hours of effort, not a real nice technical solution but it worked.
    If you require I can send you a PDF of the sap script form definition. You can contact me at [email protected] Answers can take 1 week or more. 
    Best regards
    JD

  • Requirement is to print more than 60 characters after ALV grid display

    Hi Consultants,
        Using 'REUSE_ALV_COMMENTARY_WRITE' , i have tried to display some text at end of page event, but ot is only displaying upto 60 characters, because SLIS is suporting oly 60 characters.
    But my requirement is to print the line of text , i am getting the text through container.
    suggest me the way to do.
    Thanks in advance.
    Madhan

    There are a few possible ways ... here's one....
    First of all, you cannot load more than 60 characters into a field at a time.  So, if you create two info objects, one as a key and the other as text, you can load multiple lines.
    For example, in Quality Notifications, there are Memo fields that can go on ... and on ... and on.  What I do in these cases is add two characteristics to my data target called ZCOUNT and ZMEMO.  ZCOUNT is the number of 60 character segments I will need to grab and ZMEMO is filled with each 60 character length of the memo field. 
    If you receive a 300 character field, then you break it up into 5 ZCOUNT's and create 4 additional, identical records with the Memo Field changed for each 60 characters of length.
    It gets a bit trickier if you have multiple 60+ character lengths, however, if you know you will always have 75 characters, then it's easier to use two info objects ... 60 + 15 characters each.
    Good Luck,
    Brian

  • Invoice Smartform  Printing Multiple Line Items

    Hi Floks,
    I have a billing Document with multiple items like labor ,material,miscellaneous and more .. i want to print all line items description and data also in smartform . It's possible to print all this requirement in Normal Windows or  How is it possible to print .If any Standard form is there .
    please Helpme Out.
    Regards,
    suresh

    Hi suresh,
        We are having standard smartform for the Invoice. Use LB_BIL_INVOICE. Copy it to Zform. You can get all the details by default.
    regards,
    Chandra.
    Note: Please reward if helpful.

  • Print more than what's showing in text field?

    Is there any way I can set a pdf form to print more than what is displayed in a text field? i.e., when there are more text lines than space in the text field and you need to scroll down to read it?
    The only way I can think is to collate responses and export to a spreadsheet and print from there but I was wondering if there was a way to do it from the form itself (i.e., have the text automatically shrink or have it print more on the page and have the document made automatically longer.
    Cheers

    Thank you - Is there an equivalent simple feature for LIVECYCLE such as setting font size to AUTO or do  I need to go into that dynamic fiels thingy?
    Cheers:)

  • Why does my C5240 printer print some lines on a page and skips others? Why does it sometimes double

    Computer is an iMac wit OS X 10.4.11. I have used this computer and printer for 2 years or more with no problems. Now it prints out lines in bold on a page but not lines in regular.I've tried copying text to a different page and restarting printer. Will try restarting computer.
    Sometimes it prints out gobblygook. If I restart the computer and printer and transfer the text to a different page, I can get the page to print correctly.
    Help would be appreciated. I need this text for a 4-hour meeting tomorrow morning!
    Nancy

    Hello,
    Thanks for the post.  We may have a ink related issue here, I've attached a couple of  links below that may assist with this issue.  (unfortunately not with the 35' of snow though) Good Luck!
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00257147&tmp_task=useCategory&cc=us&dlc=en&lang...
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00947099&tmp_task=useCategory&cc=us&dlc=en&lang...
    I worked for HP but my posts and replies are my own....Thank you!
    *Say thanks by clicking the *Kudos!* which is on the left*
    *Make it easier for other people to find solutions, by marking my answer with (Accept as Solution) if it solves your issue.*

  • JTable printing and multiline footer

    I am trying to switch to Java5 JTable printing. I had a 2 lines footer text on the printout before. With Java5 I tried it this way
                    Printable printable = thistable.getPrintable
                        JTable.PrintMode.FIT_WIDTH,
                        new MessageFormat("title"),
                        new MessageFormat("line1" + "\n" + "line2")
                    );  On the printout only one line appears, the \n is ignored. Is there a possibility to have multiline footers with Java5 table printing?

    On the printout only one line appears, the \n is
    ignored. Is there a possibility to have multiline
    footers with Java5 table printing?From my experience no. You may have to roll out your own printing
    code
    Don't mind if i ask but why do you want a multiline footer?
    Richard West

  • Message 'USER LOCKED'  when trying to give more line items in VA03

    Hi All,
    We have created a 'Z' smartform layout at delivery level and it has a 'Z' Output type.
    When i am trying to enter more line items in va03 then it says user is locked .
    Kindly give me suggestion whether this has a problem in the Layout OR else is some configurational problem.
    Very Urgent.
    Regards,
    Rajesh Kumar.

    Rajesh,
    its not a layout or print program problem at all.
    i think you have implemented some EXIT for va* and it may be creating problem.
    you have to see by debug from where this message comes from.
    than you will come to know and rectify this.
    Amit.

  • HP 3055 Prints a line down the page

    I am having some trouble with an HP Laserjet 3055, when I print a page while the printer is 'cold' , a small strip 1/8" thick of garbage prints down the entire length of the page..  If I print more than one page the error gets smaller and smaller and around the 4th page the printer prints perfectly...
    If I wait over a minute before printing another page the 'line' resurfaces.
    I've tried different toner cartridges and have done the printers cleaning command, nothing has helped...   Does anyone have any idea ?

    I have similar problem with HP LaserJet 2430.
    While printing, characters from each line are repeated at 3 inch intervals along the length of the paper at about 2 inches and 7 inches from the left margin that appear as two grey bands on the printout. The widths of the bands are approximately 2 characters and 8 characters. For example when a single line is printed the characters at 2 in and 7 in locations from the left margin repeat at 3, 6 and 9 inches down from the printed line and the intensity of the printing decreases.
    For example if I print a printer test page, the HP logo at the top right corner will repeat with reducing intensity at 3, 6, and 9 inches from the first logo print.
    Similarly if I print a word document with just one line of numbers 1234567890 repeated for the width, the numbers 23 at 2 inch and 67890123 at 7 inch from left margin will repeat every 3 inch along the length of paper (portrait mode) with decreasing intensity.
    While printing documents with multiple lines this causes two grey vertical bands along the length of the paper. 

  • Transaction ME9E - Printing Single Line Schedule Agreement

    We are trying to print a line item that has a different delivery address than that of the header.  This is a single line document and the address is different.  The problem we have is when the scheduling agreements has only one part number and the delivery address for the part number is different then the default company/plant address.  This process is predominant when you have subcontract process.  We are unable to print the address at the line level for a single line document but system does this correctly and prints this delivery address when there are two part numbers in scheduling agreement.  How can we get this to work for us for single item documents?  This is critical for our end user.  We need to have the system access the text element ITEM_DELADDRESS in the MAIN window and not produce the address in the HEADER_DELADDRESS element in the CONSGNEE window.

    Hello,
    There are two possible status for schedule lines:
            1- Fixed schedule lines : System doesn't change these schedule lines upon MRP run
            2 Non fixed schedule lines : during MRP run, system deletes these schedule lines and creates new ones.
    To make a schedule line fixed there are two possibilities:
                        1- User set manually the indicator fixed schedule line in transaction ME38
                        2- Schedule line lies within the firm period.
    The firm period :
    For each schedule agreement you can define the firm zone : 
    1- ME32L change schedule agreement
    2- select the item then in toolbar> Item> More function-->additional data  Scheduling control
    enter the firm zone "number of days".
    If schedule line lies whithin this zone system will kepp it and create new line for additional requirement
    Best Regards

Maybe you are looking for

  • Pass parameter to control file in SQL LOADER

    Hi guys, I need your help. I'm currently using Linux Enterprise 3.0 and ORACLE database. I got many ASCII text files in a folder. And I want to load those text files to database during interval of time. For example, if in that folders contains 10 tex

  • 11 Updates not Installed Not Needed

    KB3021952 Kb3004361 KB3013445 KB3023562 KB3029944 KB3031432 KB2976978 KB3016074 KB3019858 KB3020338 And the Malicious Software Removal Tool Windows 8 and 8.1 for February 2015 All show up in Windows Update but won't install because it says they are N

  • Sandisk Mobile Mate SD will not read

    I have tried rebooting with the device plugged in. It just won't show up in Finder or desktop. The light on the device is lit and it shows up in system profiler but I don't know what else can do. Hopefully someone here can help me. I know this has to

  • CustomerID refers to external url

    Hello I have a question about external links. I have a table with Customer IDs and another external website with a database portal of my company. The url structure of the database portal works in this way https://...Default.aspx?CustID=12345 Now I wa

  • PE Boot image broke

    I was trying add this driver to my PE image and after 3 hours it said it couldn't apply it and now every time I try to view properties on the PE I get errors and I can't see ANY of the previous drivers and had added. I did make a copy of the boot.P01