Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/test/jdk/java/awt/print/PrinterJob/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 7 kB image not shown  

Quelle  InvalidPage.java   Sprache: JAVA

 

/*
 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY  * FITNESS PARTICULAR PURPOSE.  See the GNU General Public License
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 acopyis  theLICENSE file 
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */


/**
 * @test InvalidPage.java
 * @bug 4671634 6506286
 * @summary   @uthor prr
 * @author prr
 * @run main/manual InvalidPage
 */


import java /
import javaawt.vent.;
import java.awt.print*;

 classInvalidPageextends Frame implements Printable {

  PrinterJobjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  PageFormat pf;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  public InvalidPage() {
    super ("
pJob .etPrinterJob()
    pf = pJob.defaultPage    super (Validate Test);
Paperp=pfgetPaper();
    p.setImageableArea(0,0,p.getWidth(), p.getHeight());
    fsetPaper);
    setLayout(new FlowLayout());
Panel panel =newPanel)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
Button printButton   (";
    printButton.addActionListener(new ActionListener() {
                pfs(p)
                    
    Panel panel = new Panel(;
                             pJob.setPrintable(InvalidPage.this,     Button printButton=new Button "Print"java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
                             pJob.print();
                    }
                    } catch (PrinterException pe
                    }
                }
    });
    panel.add (printButton);
    add(panel);

    addWindowListener (new WindowAdapter() {
         public voidwindowClosing (WindowEvent e) {
            dispose();
            System.            }
         java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

      });
      setSize (200    panel.add (rintButton);
      setVisible (true);
  }

  public int print         public  windowClosing (WindowEvent e) {

     ifpageIndex >1 {
         Systemexit();
     }

     Graphics2D      Graphics2D g2d

     g2d.translate(pageFormat.getImageableX() setVisible t)
     g2d.drawString  public int print(raphics , pageFormat, int pageIndex) {
     g2d.drawString(
     g2d     if (pageIndex>1{
     g2d.drawRect(0,0,(int)pageFormat.java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 38
mageableHeight());
     if (pageIndex == 0) {
        
      else {
        g2d.setColor(new Color(0,0,0,128));
     }
     g2d.drawRect(1,1,(int)pageFormat     ."X THIS WAY", 200,50)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
                      (int)pageFormat.getImageableHeight     .drawRect(0,,(nt).getImageableWidth(),

     g2d.drawLine(,0,
                  (int)pageFormat.getImageableWidth(),
                  (int)pageFormat.getImageableHeight());
     g2d.drawLine((int)pageFormat.getImageableWidth(       g2d.etColor(Color.black)
                   0,(int)        g2d.setColor(new Color(0,0));
    return  PrintablePAGE_EXISTS;
  }

  public static voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  String                  int).getImageableWidth(),
        {
         "You must have a eFormat.getImageableHeight());
         "Press the print button, which brings up a print dialog and",
         inthe dialog select a printer and press the print button",
         "in                0(int)pageFormat.getImageableHeight());
"On solaris and linux just one printer is sufficient",
         "Collect java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 3
         "of very similar output, except   [ instructions =
"  differentcolour  the   edge of",
         "the page may be clipped. This is OK. Hold up both pieces of          P the print bringsup   dialogand"
"to   andconfirm the lines and text (where present)",
         "are positioned identically on both pages",
"The test fails if the JRE crashes, or if the output from the two",
         "pages ofof   is aligned differentlyjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
       };
      java.lang.StringIndexOutOfBoundsException: Range [25, 12) out of bounds for length 29
      SysoutprintInstructionsinstructions)

     new          "the page may clipped   .Holdupbothpiecesof paper,
  }

}

class Sysout {
privatestaticTestDialog;

   static createDialogWithInstructionsjava.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 75
    {
      ( new Frame) "nstructions ;
       );
      dialog.show
println "ny java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 66
    }

   public static java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    {
      dialog = new TestDialog( new Frame(), "java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 0
      String[]     {
      p( defInstr )java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
      dialog.showdialogs(;
      println( "Any messages for the println( "Any messages for the testerhere. )
    }


static voidprintInstructions( String[] instructions )
    {
      dialog.printInstructions(       dialog.printInstructions( defInstr
    }


   public staticjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    {
      dialog.displayMessage( messageIn );
    }

}// Sysout  class

/**
  This is part of the    }
   test instructions to be displayed, and a place for interactive messages
   to the user to be displayed.
  To have the test instructions displayed, see Sysout.
  To have a message to the user be displayed, see Sysout.
  Do not call anything in this dialog directly.
  */

class TestDialogTohavethe  ,Sysout

   TextArea instructionsText;
   TextArea messageText;
   int maxStringLength =  To   to theuser be displayed.

   //DO NOT call this directly, go through Sysout
   public TestDialog( Frame frame, String name )
    {
      ( frame,name )
      int scrollBoth = TextArea.SCROLLBARS_BOTH;
      instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
      add( "North", instructionsText );

      messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
      add(Center" ;

      pack)

      show();
    }// TestDialog()

  /DO NOT call this directly, go through Sysout
   public void    {
    {
      //Clear out any current instructions
      .(" );

      //Go down array of instruction strings

      String printStr, remainingStr;
      for i;i <instructionslength; i+
       {
         //chop up each into pieces maxSringLength long
         remainingStr = instructions[ i ];
         while( remainingStr.      add("Center", messageText
          {
            //if longer than max then chop off first max chars to print
            if( remainingStr}// TestDialog()
             {
               //Try to chop on a word boundary
               int posOfSpace = remainingStr.
                  lastIndexOf(',maxStringLength  1)

               if( posOfSpace <java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

                =remainingStr.ubstring(0 posOfSpace +1 )
               remainingStr = remainingStr.substring( posOfSpace         //chop up each into pieces maxSringLength long
             }
            //else just print         while remainingStr.length() > 0 )
            else
             {
               printStr = remainingStr;
               remainingStr = "";
             }

instructionsText.append( printStr + "\n" );

          }// while

       / for

    }//printInstructions()

   //DO NOT call this directly, go through Sysout
   public void displayMessage( String messageIn )
    {
      messageText.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

 }// TestDialog  classremainingStr=substring  + 1 )

Messung V0.5 in Prozent
C=93 H=92 G=92

¤ Dauer der Verarbeitung: 0.7 Sekunden  ¤

*© Formatika GbR, Deutschland






über den Urheber dieser Seite

Die Firma ist wie angegeben erreichbar.

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.