Results 1 to 1 of 1
Thread: double execution of a method
- 01-13-2011, 02:11 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 1
- Rep Power
- 0
double execution of a method
Hello.
I'm developing an applications that has to print.
In the class that implements printable it calls a method.
This method is executed twice every click on stamp dialogs.
Here's the code where I add a listener on the button that has to call the print method. Could anybody give me any advise to resolve the problem?
Java Code:stampButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("You clicked stamp1 button"); //aumento fattura try { SavingA.aumentaFattura(); } catch (IOException ex) { System.out.println("Start_Dialogs: IOException button stamp1"); } PrinterJob printerJob = PrinterJob.getPrinterJob(); boolean annulla = printerJob.printDialog(); if(annulla) { PageFormat pageFormat = printerJob.pageDialog(printerJob.defaultPage()); pageFormat = printerJob.validatePage(pageFormat); printerJob.setPrintable(new stampaFattura()); try { printerJob.print(); } catch(PrinterException ex) { ex.printStackTrace(); } } } });
Similar Threads
-
Re-iterate Thread execution after its execution finishes.
By TurtleRock in forum New To JavaReplies: 10Last Post: 11-29-2010, 02:02 PM -
JSpinner getValue method bug in double?
By cotarelo in forum AWT / SwingReplies: 9Last Post: 07-05-2010, 05:53 PM -
non-static method add(double,double) cannot be referenced from a static context
By cravi85 in forum Java SoftwareReplies: 5Last Post: 03-21-2009, 09:32 PM -
Timeout for a method execution
By pjmorce in forum Advanced JavaReplies: 2Last Post: 12-22-2008, 06:51 PM -
Method execution time
By javaplus in forum Advanced JavaReplies: 3Last Post: 11-26-2007, 09:51 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks