From af94a4ec352bed730ba82f9e3bdcc7a34656b1e4 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 18 Feb 2005 12:26:49 +0000 Subject: [PATCH] treepanel is now internalframe --- src/jalview/gui/AlignFrame.java | 10 +++++---- src/jalview/gui/TreePanel.java | 46 ++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index a20a3fe..ebaacda 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -52,7 +52,6 @@ public class AlignFrame extends GAlignFrame } }); - AlignmentUtil.fetchSequenceFeatures(al, alignPanel); } protected void saveAs_actionPerformed(ActionEvent e) @@ -611,6 +610,11 @@ public class AlignFrame extends GAlignFrame public void sequenceFeatures_actionPerformed(ActionEvent evt) { viewport.showSequenceFeatures(sequenceFeatures.isSelected()); + if(viewport.showSequenceFeatures && !((Alignment)viewport.alignment).featuresAdded) + { + AlignmentUtil.fetchSequenceFeatures( viewport.alignment , alignPanel); + ((Alignment)viewport.alignment).featuresAdded = true; + } alignPanel.RefreshPanels(); } @@ -973,7 +977,6 @@ if ( viewport.getConservationSelected() ) return; } - JInternalFrame frame = new javax.swing.JInternalFrame(); TreePanel tp=null; if (viewport.getSelection() != null && viewport.getSelection().size() > 3) { @@ -986,8 +989,7 @@ if ( viewport.getConservationSelected() ) type, pwType, 0, viewport.alignment.getWidth()); } - frame.setContentPane(tp); - Desktop.addInternalFrame(frame, title, 600, 500); + Desktop.addInternalFrame(tp, title, 600, 500); } diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 936eebe..4b605bf 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -9,6 +9,9 @@ import java.util.*; import java.io.*; import jalview.util.*; import javax.swing.*; +import java.awt.print.*; +import java.awt.*; + public class TreePanel extends GTreePanel @@ -250,25 +253,52 @@ public void propertiesInit() { } - public void showDistanceCheckbox_actionPerformed(ActionEvent e) + + protected void saveMenu_actionPerformed(ActionEvent e) { - treeCanvas.setShowDistances(showDistanceCheckbox.isSelected()); + + } + + protected void printMenu_actionPerformed(ActionEvent e) + { + + //Putting in a thread avoids Swing painting problems + treeCanvas.startPrinting(); } - public void fontSizeCombobox_actionPerformed(ActionEvent e) + protected void fontSize_actionPerformed(ActionEvent e) { if( treeCanvas==null ) return; - int size = Integer.parseInt( fontSizeCombobox.getSelectedItem().toString() ); - treeCanvas.setFontSize( size ); - + String size = fontSize.getText().substring( fontSize.getText().indexOf("-")+1); + + Object selection = JOptionPane.showInternalInputDialog(Desktop.desktop, + "Select font size", + "Font size", + JOptionPane.QUESTION_MESSAGE, + null, new String[]{"1","2","4","6","8","10","12","14","16","18","20"} + ,"Font Size - "+size); + if(selection!=null) + { + fontSize.setText("Font Size - " + selection); + + int i = Integer.parseInt(selection.toString()); + treeCanvas.setFontSize(i); + } scrollPane.setViewportView(treeCanvas); + + } + + protected void distanceMenu_actionPerformed(ActionEvent e) + { + treeCanvas.setShowDistances(distanceMenu.isSelected()); } - public void bootStrapCheckBox_actionPerformed(ActionEvent e) + protected void bootstrapMenu_actionPerformed(ActionEvent e) { - treeCanvas.setShowBootstrap(bootStrapCheckBox.isSelected()); + treeCanvas.setShowBootstrap(bootstrapMenu.isSelected()); } + } -- 1.7.10.2