2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by Krefie
0
try
        {
            

            boolean complete = txtAfvoer.print(null, null, true, null, null, true);
            
            if (complete)
            {//show a success message
                JOptionPane.showMessageDialog(new JFrame(), "Printing Page\n" + "Please click finish after printing", "Finished",JOptionPane.INFORMATION_MESSAGE);
                btnFinish.setEnabled(true);
            }
            else
            {//show a message indicating that printing was cancelled
                JOptionPane.showMessageDialog(new JFrame(), "User cancelled printing session", "Error 25: Cancelled",JOptionPane.ERROR_MESSAGE);
            }
        }
        catch (PrinterException pe)
        {// Printing failed, report to the user
            JOptionPane.showMessageDialog(new JFrame(), "Printing failed...WHAT DID YOU DO??", "Error 26: Failed",JOptionPane.ERROR_MESSAGE);
        }

hmm, your question is a bit unclear..should the user know it was printed or the program? I posted code for a try & catch in printing, read the messageDialogs to understand what happend where during the printing, hopes this helps.

regards krefie

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.