alignPanel.makeEPS(f);
}
+
+ public void pageSetup_actionPerformed(ActionEvent e)
+ {
+ PrinterJob printJob = PrinterJob.getPrinterJob();
+ PrintThread.pf = printJob.pageDialog(printJob.defaultPage());
+ }
+
/**
* DOCUMENT ME!
*
public void printMenuItem_actionPerformed(ActionEvent e)
{
//Putting in a thread avoids Swing painting problems
- PrintThread thread = new PrintThread();
+ PrintThread thread = new PrintThread(alignPanel);
thread.start();
}
return tp;
}
- class PrintThread
- extends Thread
- {
- public void run()
- {
- PrinterJob printJob = PrinterJob.getPrinterJob();
- PageFormat pf = printJob.pageDialog(printJob.defaultPage());
- printJob.setPrintable(alignPanel, pf);
-
- if (printJob.printDialog())
- {
- try
- {
- printJob.print();
- }
- catch (Exception PrintException)
- {
- PrintException.printStackTrace();
- }
- }
- }
- }
/**
* Generates menu items and listener event actions for web service clients
return viewport;
}
}
+
+class PrintThread extends Thread
+{
+ AlignmentPanel ap;
+ public PrintThread(AlignmentPanel ap)
+ {
+ this.ap = ap;
+ }
+ static PageFormat pf;
+ public void run()
+ {
+ PrinterJob printJob = PrinterJob.getPrinterJob();
+
+ if (pf != null)
+ printJob.setPrintable(ap, pf);
+ else
+ printJob.setPrintable(ap);
+
+ if (printJob.printDialog())
+ {
+ try
+ {
+ printJob.print();
+ }
+ catch (Exception PrintException)
+ {
+ PrintException.printStackTrace();
+ }
+ }
+ }
+}
protected JCheckBoxMenuItem idRightAlign = new JCheckBoxMenuItem();\r
protected JMenuItem gatherViews = new JMenuItem();\r
protected JMenuItem expandViews = new JMenuItem();\r
+ JMenuItem pageSetup = new JMenuItem();\r
public GAlignFrame()\r
{\r
try\r
wrapMenuItem_actionPerformed(e);\r
}\r
});\r
- printMenuItem.setText("Print");\r
+ printMenuItem.setText("Print ...");\r
printMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.\r
event.KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
printMenuItem.addActionListener(new java.awt.event.ActionListener()\r
expandViews_actionPerformed(e);\r
}\r
});\r
+ pageSetup.setText("Page Setup ...");\r
+ pageSetup.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ pageSetup_actionPerformed(e);\r
+ }\r
+ });\r
\r
alignFrameMenuBar.add(fileMenu);\r
alignFrameMenuBar.add(editMenu);\r
fileMenu.add(save);\r
fileMenu.add(saveAs);\r
fileMenu.add(outputTextboxMenu);\r
+ fileMenu.add(pageSetup);\r
fileMenu.add(printMenuItem);\r
fileMenu.addSeparator();\r
fileMenu.add(jMenu2);\r
{\r
\r
}\r
+\r
+ public void pageSetup_actionPerformed(ActionEvent e)\r
+ {\r
+\r
+ }\r
}\r