Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4616183
Votes 0
Synopsis java window behind the print dialog is not repainted
Category java:classes_2d
Reported Against 1.3.1
Release Fixed
State 11-Closed, duplicate of 4394889, bug
Priority: 4-Low
Related Bugs 4273333 , 4394889
Submit Date 19-DEC-2001
Description

While testing the bug fix for BugId 4273333 (jdk 1.3.1) on windows,  xxxxx 
found this new bug:

I tested out the fix for bug ID 4273333 - Print dialog is not modal. The
dialog is modal now, however, when I move the print dialog, the java window
behind the dialog is not repainted.


Testcase:
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import java.io.*;
import javax.swing.*;
import javax.swing.JFrame;

public class TestPrint implements Printable
{
    private String data = null;
    private PrinterJob printJob;
    private JButton  mybutton ;

    public TestPrint( String text )
    {
        data = text;
        printJob = PrinterJob.getPrinterJob();
        printJob.setPrintable( this );
    }

    public void printIt()
    {
        if( printJob.printDialog() ) {
            System.out.println("Will Print because OK clicked");
        }
        else
                System.out.println("Won't Print because Cancel Clicked");
    }


    /**
     * print : Printable interface method
     *   is not doing anything right now since the intention is to show the
     *   non-modal nature of the print dialog.
     */
    public int print( Graphics g, PageFormat pf, int pageIndex ) throws PrinterException
    {
        System.out.println("Print called");
                return 0;
    }//end of print


    /**
     * main - starting point for the appl.  
     *  Does following  Creates Text data,  Sets it to the TextArea, and
     */
  public static void main( String[] args )
  {
        String nl = System.getProperty("line.separator");
        final String text = new String(
                "Twinkle twinkle little stars" + nl +
                "how i wonder what you are" + nl +
                "up above the sky so high " + nl +
                "like a something in the sky" + nl);

        JFrame frame = new JFrame();
        Container panel = frame.getContentPane();
        panel.setLayout( new BorderLayout() );

        JTextArea ta = new JTextArea( 8, 100 );
        ta.setText( text );
        panel.add( ta, BorderLayout.NORTH );

        JButton myButton = new JButton("Print Out");
        panel.add( myButton, BorderLayout.SOUTH );
        myButton.addActionListener( new ActionListener() {
  
       public void actionPerformed( ActionEvent e )
       {
                TestPrint p = new TestPrint( text );
            p.printIt();
       }} );

       frame.setSize( 400, 200 );
       frame.setVisible( true );

    }//end of main
}//end of class
Work Around
N/A
Evaluation
Need to call dialog.show() for the print dialog.
 xxxxx@xxxxx  2001-12-19
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang