+ // file menu:
+ JMenuItem _open_item;
+ JMenuItem _open_url_item;
+ JMenuItem _save_item;
+ JMenuItem _save_all_item;
+ JMenuItem _close_item;
+ JMenuItem _exit_item;
+ JMenuItem _new_item;
+ JMenuItem _print_item;
+ JMenuItem _write_to_pdf_item;
+ JMenuItem _write_to_jpg_item;
+ JMenuItem _write_to_gif_item;
+ JMenuItem _write_to_tif_item;
+ JMenuItem _write_to_png_item;
+ JMenuItem _write_to_bmp_item;
+ JMenu _file_jmenu;
+
+
+ void writePhylogenyToGraphicsFile( final String file_name, final GraphicsExportType type ) {
+ _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getCurrentTreePanel().getWidth(),
+ _mainpanel.getCurrentTreePanel().getHeight() );
+ String file_written_to = "";
+ boolean error = false;
+ try {
+ file_written_to = AptxUtil.writePhylogenyToGraphicsFile( file_name,
+ _mainpanel.getCurrentTreePanel().getWidth(),
+ _mainpanel.getCurrentTreePanel().getHeight(),
+ _mainpanel.getCurrentTreePanel(),
+ _mainpanel.getControlPanel(),
+ type,
+ getOptions() );
+ }
+ catch ( final IOException e ) {
+ error = true;
+ JOptionPane.showMessageDialog( this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE );
+ }
+ if ( !error ) {
+ if ( ( file_written_to != null ) && ( file_written_to.length() > 0 ) ) {
+ JOptionPane.showMessageDialog( this,
+ "Wrote image to: " + file_written_to,
+ "Graphics Export",
+ JOptionPane.INFORMATION_MESSAGE );
+ }
+ else {
+ JOptionPane.showMessageDialog( this,
+ "There was an unknown problem when attempting to write to an image file: \""
+ + file_name + "\"",
+ "Error",
+ JOptionPane.ERROR_MESSAGE );
+ }
+ }
+ _contentpane.repaint();
+ }