Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4346902

impossible to print an image with the Deskjet 970 Cxi printer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • client-libs
    • 2d
    • beta
    • x86
    • windows_2000



      Name: sl110371 Date: 06/20/2000


      java version "1.3.0rc2"
      java (TM) 2 Runtime Environment Standard Edition (build 1.3.0rc2-Y)
      java HotSpot(TM) Client VM (build 1.3.0rc2-Y, mixed mode)

      1.
      When I try to draw an image on the graphic context of the Deskjet 970
      Cxi printer, the image is not printed! But that functions correctly on the other
      printers.

      2.
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import java.awt.print.*;

      public class SimplePrint extends JPanel implements ActionListener, Printable {

        static boolean ok = true;
        Image im;

      public SimplePrint() {
           JButton button = new JButton("Imprimer avec Java 2");
           button.addActionListener(this);
           add(button);

           setBackground(Color.white);

           ImageIcon icon = new ImageIcon("JavaCup.gif");
           im = icon.getImage();
         }

      public void actionPerformed(ActionEvent e) {
           PrinterJob printJob = PrinterJob.getPrinterJob();
           printJob.setPrintable(this);

           System.out.println("setPrintable est pass?");

           try {
             printJob.print();
             System.exit(0);
           } catch (Exception PrintException) {
            System.out.println(PrintException);
           }
         }

      public int print(Graphics g, PageFormat pageFormat, int pageIndex) {

           if (pageIndex == 0) {
              g.drawImage(im, 200, 200, this);
             return Printable.PAGE_EXISTS;
           }

           return Printable.NO_SUCH_PAGE;
         }


      public static void main(String s[]) {

           Frame f = new Frame("Exemple d'impression");

           WindowListener l = new WindowAdapter() {
               public void windowClosing(WindowEvent e) {System.exit(0);}
           };

           f.addWindowListener(l);
           f.add("Center", new SimplePrint());
           f.setSize(new Dimension(300, 100));
           f.show();
         }
       }
      (Review ID: 103477)
      ======================================================================

            prr Philip Race
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: