< prev index next >

test/java/awt/print/PrinterJob/PrintTextPane.java

Print this page
rev 17561 : 8185500: [TESTBUG] Add keywords headful/printer in java/awt and javax tests.
Summary: Add new keyword 'printer'. Some minor test fixes to show headless exception. Add some @requires windows.


   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25   @test PrintTextPane.java
  26   @bug 6452415 6570471
  27   @summary Test that swing text prints using GDI printer fonts.
  28   @author prr: area=PrinterJob
  29   @run main PrintTextPane
  30 
  31  */

  32 import java.io.*;
  33 import java.net.*;
  34 import java.awt.*;
  35 import java.awt.event.*;
  36 import javax.print.attribute.*;
  37 import javax.print.attribute.standard.*;
  38 import javax.swing.*;
  39 import javax.swing.text.*;
  40 import java.awt.print.*;
  41 
  42 public class PrintTextPane extends JTextPane implements Printable {
  43 
  44    static String text = "Twinkle twinkle little star, \n" +
  45                         "How I wonder what you are. \n" +
  46                         "Up above the world so high, \n" +
  47                         "Like a diamond in the sky. \n" +
  48                         "Twinkle, twinkle, little star, \n" +
  49                         "How I wonder what you are!\n";
  50 
  51     public int print(Graphics g, PageFormat pf, int page)




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test PrintTextPane.java
  26  * @key headful printer
  27  * @bug 6452415 6570471
  28  * @summary Test that swing text prints using GDI printer fonts.
  29  * @author prr: area=PrinterJob
  30  * @run main PrintTextPane
  31  */
  32 
  33 import java.io.*;
  34 import java.net.*;
  35 import java.awt.*;
  36 import java.awt.event.*;
  37 import javax.print.attribute.*;
  38 import javax.print.attribute.standard.*;
  39 import javax.swing.*;
  40 import javax.swing.text.*;
  41 import java.awt.print.*;
  42 
  43 public class PrintTextPane extends JTextPane implements Printable {
  44 
  45    static String text = "Twinkle twinkle little star, \n" +
  46                         "How I wonder what you are. \n" +
  47                         "Up above the world so high, \n" +
  48                         "Like a diamond in the sky. \n" +
  49                         "Twinkle, twinkle, little star, \n" +
  50                         "How I wonder what you are!\n";
  51 
  52     public int print(Graphics g, PageFormat pf, int page)


< prev index next >