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

Cross-platform printer dialog gets block by alwaysOnTop JFrame

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java 1.6.0-b105, mixed mode

      ADDITIONAL OS VERSION INFORMATION :
      Windows Xp Pro Service Pack 2

      A DESCRIPTION OF THE PROBLEM :
      Always on Top JFrame blocks, from the user the print Dialog
      very similar to this bug
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4775862

      We need createDialog()





      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
       
      import java.awt.*;
      import javax.swing.*;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.print.PrinterException;
      import javax.swing.table.DefaultTableModel;
       
       
      class TablePrintDialogBehind {

      boolean x = false;

      String[] cNames = {"A","B","C","D","E","F","G","H"};
          
          Object[][] datos = {{"", "","","", "","","",""}};

          TablePrintDialogBehind() {
          
          final JFrame frame = new JFrame();
          frame.setLayout(new BorderLayout());
           
          DefaultTableModel model = new DefaultTableModel(datos ,cNames);
          final JTable table = new JTable(model);
          
          JButton print = new JButton("Print");
          print.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
          
          try{
          
          table.print();
          }catch(PrinterException a){
          a.printStackTrace();
          }
      }});
          JButton onTop = new JButton("onTop");
          onTop.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
          
          frame.setAlwaysOnTop(x);
          frame.setTitle("ON TOP - "+x);
          x = !x;
          }
      });
          
          
          frame.add(table, BorderLayout.CENTER);
          frame.add(print, BorderLayout.SOUTH);
          frame.add(onTop, BorderLayout.NORTH);
          frame.setSize(400,400);
          frame.setVisible(true);
          }

      public static void main(String [] args){

      SwingUtilities.invokeLater(new Runnable(){
      public void run(){

      new TablePrintDialogBehind();

      }});
      }
      }

      ---------- END SOURCE ----------

            art Artem Ananiev (Inactive)
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: