+ private void chooseFont() {
+ final FontChooser fc = new FontChooser();
+ fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
+ fc.showDialog( this, "Select the Base Font" );
+ getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
+ }
+
+ private void chooseMinimalConfidence() {
+ final String s = ( String ) JOptionPane
+ .showInputDialog( this,
+ "Please the minimum for confidence values to be displayed.\n" + "[current value: "
+ + getOptions().getMinConfidenceValue() + "]\n",
+ "Minimal Confidence Value",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ getOptions().getMinConfidenceValue() );
+ if ( !ForesterUtil.isEmpty( s ) ) {
+ boolean success = true;
+ double m = 0.0;
+ final String m_str = s.trim();
+ if ( !ForesterUtil.isEmpty( m_str ) ) {
+ try {
+ m = Double.parseDouble( m_str );
+ }
+ catch ( final Exception ex ) {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ if ( success && ( m >= 0.0 ) ) {
+ getOptions().setMinConfidenceValue( m );
+ }
+ }
+ }
+
+ private void choosePdfWidth() {
+ final String s = ( String ) JOptionPane.showInputDialog( this,
+ "Please enter the default line width for PDF export.\n"
+ + "[current value: "
+ + getOptions().getPrintLineWidth() + "]\n",
+ "Line Width for PDF Export",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ getOptions().getPrintLineWidth() );
+ if ( !ForesterUtil.isEmpty( s ) ) {
+ boolean success = true;
+ float f = 0.0f;
+ final String m_str = s.trim();
+ if ( !ForesterUtil.isEmpty( m_str ) ) {
+ try {
+ f = Float.parseFloat( m_str );
+ }
+ catch ( final Exception ex ) {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ if ( success && ( f > 0.0 ) ) {
+ getOptions().setPrintLineWidth( f );
+ }
+ }
+ }
+
+ private void choosePrintSize() {
+ final String s = ( String ) JOptionPane.showInputDialog( this,
+ "Please enter values for width and height,\nseparated by a comma.\n"
+ + "[current values: "
+ + getOptions().getPrintSizeX() + ", "
+ + getOptions().getPrintSizeY() + "]\n"
+ + "[A4: " + Constants.A4_SIZE_X + ", "
+ + Constants.A4_SIZE_Y + "]\n" + "[US Letter: "
+ + Constants.US_LETTER_SIZE_X + ", "
+ + Constants.US_LETTER_SIZE_Y + "]",
+ "Default Size for Graphics Export",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ getOptions().getPrintSizeX() + ", "
+ + getOptions().getPrintSizeY() );
+ if ( !ForesterUtil.isEmpty( s ) && ( s.indexOf( ',' ) > 0 ) ) {
+ boolean success = true;
+ int x = 0;
+ int y = 0;
+ final String[] str_ary = s.split( "," );
+ if ( str_ary.length == 2 ) {
+ final String x_str = str_ary[ 0 ].trim();
+ final String y_str = str_ary[ 1 ].trim();
+ if ( !ForesterUtil.isEmpty( x_str ) && !ForesterUtil.isEmpty( y_str ) ) {
+ try {
+ x = Integer.parseInt( x_str );
+ y = Integer.parseInt( y_str );
+ }
+ catch ( final Exception ex ) {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ if ( success && ( x > 1 ) && ( y > 1 ) ) {
+ getOptions().setPrintSizeX( x );
+ getOptions().setPrintSizeY( y );
+ }
+ }
+ }
+
+ private void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
+ if ( item != null ) {
+ item.setFont( MainFrame.menu_font );
+ if ( !getConfiguration().isUseNativeUI() ) {
+ item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
+ item.setForeground( getConfiguration().getGuiMenuTextColor() );
+ }
+ item.setSelected( is_selected );
+ item.addActionListener( this );
+ }
+ }
+
+ private Phylogeny getSpeciesTree() {
+ return _species_tree;
+ }
+
+ private boolean isScreenAntialias() {
+ return true;
+ }
+
+ private void removeBranchColors() {
+ if ( getMainPanel().getCurrentPhylogeny() != null ) {
+ AptxUtil.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
+ }
+ }
+
+ private void removeVisualStyles() {
+ if ( getMainPanel().getCurrentPhylogeny() != null ) {
+ AptxUtil.removeVisualStyles( getMainPanel().getCurrentPhylogeny() );
+ }
+ }
+
+ private void setMainPanel( final MainPanelApplets main_panel ) {
+ _mainpanel = main_panel;
+ }
+
+ private void setSpeciesTree( final Phylogeny species_tree ) {
+ _species_tree = species_tree;
+ }
+
+ private void setupUI() {
+ try {
+ if ( getConfiguration().isUseNativeUI() ) {
+ UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
+ }
+ else {
+ UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
+ }
+ }
+ catch ( final UnsupportedLookAndFeelException e ) {
+ AptxUtil.dieWithSystemError( "UnsupportedLookAndFeelException: " + e.toString() );
+ }
+ catch ( final ClassNotFoundException e ) {
+ AptxUtil.dieWithSystemError( "ClassNotFoundException: " + e.toString() );
+ }
+ catch ( final InstantiationException e ) {
+ AptxUtil.dieWithSystemError( "InstantiationException: " + e.toString() );
+ }
+ catch ( final IllegalAccessException e ) {
+ AptxUtil.dieWithSystemError( "IllegalAccessException: " + e.toString() );
+ }
+ catch ( final Exception e ) {
+ AptxUtil.dieWithSystemError( e.toString() );
+ }
+ }
+