+\r
+ public void showURL(String url, String target)\r
+ {\r
+ if (viewport.applet == null)\r
+ {\r
+ System.out.println("Not running as applet - no browser available.");\r
+ }\r
+ else\r
+ {\r
+ try\r
+ {\r
+ System.out.println("Show url: "+url);\r
+ viewport.applet.getAppletContext().showDocument(new java.net.URL(url),\r
+ target);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ //////////////////////////////////////////////////////////////////////////////////\r
+ //JBuilder Graphics here\r
+\r
+ protected MenuBar alignFrameMenuBar = new MenuBar();\r
+ protected Menu fileMenu = new Menu("File");\r
+ protected MenuItem loadApplication = new MenuItem("View in Full Application");\r
+ protected MenuItem loadTree = new MenuItem("Load Associated Tree");\r
+ protected MenuItem closeMenuItem = new MenuItem("Close");\r
+ protected Menu editMenu = new Menu("Edit");\r
+ protected Menu viewMenu = new Menu("View");\r
+ protected Menu colourMenu = new Menu("Colour");\r
+ protected Menu calculateMenu = new Menu("Calculate");\r
+ protected MenuItem selectAllSequenceMenuItem = new MenuItem("Select all");\r
+ protected MenuItem deselectAllSequenceMenuItem = new MenuItem("Deselect All");\r
+ protected MenuItem invertSequenceMenuItem = new MenuItem("Invert Selection");\r
+ protected MenuItem remove2LeftMenuItem = new MenuItem();\r
+ protected MenuItem remove2RightMenuItem = new MenuItem();\r
+ protected MenuItem removeGappedColumnMenuItem = new MenuItem();\r
+ protected MenuItem removeAllGapsMenuItem = new MenuItem();\r
+ protected CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();\r
+ protected CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();\r
+ protected MenuItem sortPairwiseMenuItem = new MenuItem();\r
+ protected MenuItem sortIDMenuItem = new MenuItem();\r
+ protected MenuItem sortGroupMenuItem = new MenuItem();\r
+ protected MenuItem removeRedundancyMenuItem = new MenuItem();\r
+ protected MenuItem pairwiseAlignmentMenuItem = new MenuItem();\r
+ protected MenuItem PCAMenuItem = new MenuItem();\r
+ protected MenuItem averageDistanceTreeMenuItem = new MenuItem();\r
+ protected MenuItem neighbourTreeMenuItem = new MenuItem();\r
+ BorderLayout borderLayout1 = new BorderLayout();\r
+ public Label statusBar = new Label();\r
+ protected Menu outputTextboxMenu = new Menu();\r
+ protected MenuItem clustalColour = new MenuItem();\r
+ protected MenuItem zappoColour = new MenuItem();\r
+ protected MenuItem taylorColour = new MenuItem();\r
+ protected MenuItem hydrophobicityColour = new MenuItem();\r
+ protected MenuItem helixColour = new MenuItem();\r
+ protected MenuItem strandColour = new MenuItem();\r
+ protected MenuItem turnColour = new MenuItem();\r
+ protected MenuItem buriedColour = new MenuItem();\r
+ protected MenuItem userDefinedColour = new MenuItem();\r
+ protected MenuItem PIDColour = new MenuItem();\r
+ protected MenuItem BLOSUM62Colour = new MenuItem();\r
+ MenuItem njTreeBlosumMenuItem = new MenuItem();\r
+ MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
+ protected CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();\r
+ protected CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();\r
+ MenuItem overviewMenuItem = new MenuItem();\r
+ protected MenuItem undoMenuItem = new MenuItem();\r
+ protected MenuItem redoMenuItem = new MenuItem();\r
+ protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();\r
+ MenuItem noColourmenuItem = new MenuItem();\r
+ protected CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();\r
+ protected CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();\r
+ MenuItem findMenuItem = new MenuItem();\r
+ protected CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();\r
+ protected MenuItem nucleotideColour = new MenuItem();\r
+ MenuItem deleteGroups = new MenuItem();\r
+ MenuItem delete = new MenuItem();\r
+ MenuItem copy = new MenuItem();\r
+ MenuItem cut = new MenuItem();\r
+ Menu pasteMenu = new Menu();\r
+ MenuItem pasteNew = new MenuItem();\r
+ MenuItem pasteThis = new MenuItem();\r
+ protected CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();\r
+ protected MenuItem font = new MenuItem();\r
+ protected CheckboxMenuItem scaleAbove = new CheckboxMenuItem();\r
+ protected CheckboxMenuItem scaleLeft = new CheckboxMenuItem();\r
+ protected CheckboxMenuItem scaleRight = new CheckboxMenuItem();\r
+ MenuItem modifyPID = new MenuItem();\r
+ MenuItem modifyConservation = new MenuItem();\r
+ protected CheckboxMenuItem autoCalculate\r
+ = new CheckboxMenuItem("Autocalculate Consensus", true);\r
+ protected Menu sortByTreeMenu = new Menu();\r
+ Menu sort = new Menu();\r
+ Menu calculate = new Menu();\r
+ MenuItem inputText = new MenuItem();\r
+ Menu helpMenu = new Menu();\r
+ MenuItem documentation = new MenuItem();\r
+ MenuItem about = new MenuItem();\r
+ protected CheckboxMenuItem seqLimits = new CheckboxMenuItem();\r
+ Panel embeddedMenu;\r
+ Label embeddedEdit;\r
+ Label embeddedSelect;\r
+ Label embeddedView;\r
+ Label embeddedFormat;\r
+ Label embeddedColour;\r
+ Label embeddedFile;\r
+ Label embeddedHelp;\r
+ Label embeddedCalculate;\r
+ FlowLayout flowLayout1;\r
+\r
+ private void jbInit() throws Exception {\r
+\r
+ setMenuBar(alignFrameMenuBar);\r
+\r
+ MenuItem item;\r
+\r
+ // dynamically fill save as menu with available formats\r
+ for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)\r
+ {\r
+\r
+ item = new MenuItem( jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);\r
+\r
+ item.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ outputText_actionPerformed(e);\r
+ }\r
+ });\r
+\r
+ outputTextboxMenu.add(item);\r
+ }\r
+ closeMenuItem.addActionListener(this);\r
+ loadApplication.addActionListener(this);\r
+\r
+ loadTree.addActionListener(this);\r
+ selectAllSequenceMenuItem.addActionListener(this);\r
+ deselectAllSequenceMenuItem.addActionListener(this);\r
+ invertSequenceMenuItem.addActionListener(this);\r
+ remove2LeftMenuItem.setLabel("Remove Left");\r
+ remove2LeftMenuItem.addActionListener(this);\r
+ remove2RightMenuItem.setLabel("Remove Right");\r
+ remove2RightMenuItem.addActionListener(this);\r
+ removeGappedColumnMenuItem.setLabel("Remove Empty Columns");\r
+ removeGappedColumnMenuItem.addActionListener(this);\r
+ removeAllGapsMenuItem.setLabel("Remove All Gaps");\r
+ removeAllGapsMenuItem.addActionListener(this);\r
+ viewBoxesMenuItem.setLabel("Boxes");\r
+ viewBoxesMenuItem.setState(true);\r
+ viewBoxesMenuItem.addItemListener(this);\r
+ viewTextMenuItem.setLabel("Text");\r
+ viewTextMenuItem.setState(true);\r
+ viewTextMenuItem.addItemListener(this);\r
+ sortPairwiseMenuItem.setLabel("by Pairwise Identity");\r
+ sortPairwiseMenuItem.addActionListener(this);\r
+ sortIDMenuItem.setLabel("by ID");\r
+ sortIDMenuItem.addActionListener(this);\r
+ sortGroupMenuItem.setLabel("by Group");\r
+ sortGroupMenuItem.addActionListener(this);\r
+ removeRedundancyMenuItem.setLabel("Remove Redundancy...");\r
+ removeRedundancyMenuItem.addActionListener(this);\r
+ pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments...");\r
+ pairwiseAlignmentMenuItem.addActionListener(this);\r
+ PCAMenuItem.setLabel("Principal Component Analysis");\r
+ PCAMenuItem.addActionListener(this);\r
+ averageDistanceTreeMenuItem.setLabel(\r
+ "Average Distance Using % Identity");\r
+ averageDistanceTreeMenuItem.addActionListener(this);\r
+ neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity");\r
+ neighbourTreeMenuItem.addActionListener(this);\r
+ alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+ statusBar.setBackground(Color.white);\r
+ statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+ statusBar.setText("Status bar");\r
+ outputTextboxMenu.setLabel("Output to Textbox");\r
+ clustalColour.setLabel("Clustalx");\r
+\r
+ clustalColour.addActionListener(this);\r
+ zappoColour.setLabel("Zappo");\r
+ zappoColour.addActionListener(this);\r
+ taylorColour.setLabel("Taylor");\r
+ taylorColour.addActionListener(this);\r
+ hydrophobicityColour.setLabel("Hydrophobicity");\r
+ hydrophobicityColour.addActionListener(this);\r
+ helixColour.setLabel("Helix Propensity");\r
+ helixColour.addActionListener(this);\r
+ strandColour.setLabel("Strand Propensity");\r
+ strandColour.addActionListener(this);\r
+ turnColour.setLabel("Turn Propensity");\r
+ turnColour.addActionListener(this);\r
+ buriedColour.setLabel("Buried Index");\r
+ buriedColour.addActionListener(this);\r
+ userDefinedColour.setLabel("User Defined...");\r
+ userDefinedColour.addActionListener(this);\r
+ PIDColour.setLabel("Percentage Identity");\r
+ PIDColour.addActionListener(this);\r
+ BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
+ BLOSUM62Colour.addActionListener(this);\r
+ avDistanceTreeBlosumMenuItem.setLabel(\r
+ "Average Distance Using BLOSUM62");\r
+ avDistanceTreeBlosumMenuItem.addActionListener(this);\r
+ njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");\r
+ njTreeBlosumMenuItem.addActionListener(this);\r
+ annotationPanelMenuItem.setLabel("Show Annotations");\r
+ annotationPanelMenuItem.addItemListener(this);\r
+ colourTextMenuItem.setLabel("Colour Text");\r
+ colourTextMenuItem.addItemListener(this);\r
+ overviewMenuItem.setLabel("Overview Window");\r
+ overviewMenuItem.addActionListener(this);\r
+ undoMenuItem.setEnabled(false);\r
+ undoMenuItem.setLabel("Undo");\r
+ undoMenuItem.addActionListener(this);\r
+ redoMenuItem.setEnabled(false);\r
+ redoMenuItem.setLabel("Redo");\r
+ redoMenuItem.addActionListener(this);\r
+ conservationMenuItem.setLabel("by Conservation");\r
+ conservationMenuItem.addItemListener(this);\r
+ noColourmenuItem.setLabel("None");\r
+ noColourmenuItem.addActionListener(this);\r
+ wrapMenuItem.setLabel("Wrap");\r
+ wrapMenuItem.addItemListener(this);\r
+ renderGapsMenuItem.setLabel("Show Gaps");\r
+ renderGapsMenuItem.setState(true);\r
+ renderGapsMenuItem.addItemListener(this);\r
+ findMenuItem.setLabel("Find...");\r
+ findMenuItem.addActionListener(this);\r
+ abovePIDThreshold.setLabel("Above Identity Threshold");\r
+ abovePIDThreshold.addItemListener(this);\r
+ nucleotideColour.setLabel("Nucleotide");\r
+ nucleotideColour.addActionListener(this);\r
+ deleteGroups.setLabel("Undefine Groups");\r
+ deleteGroups.addActionListener(this);\r
+ copy.setLabel("Copy");\r
+ copy.addActionListener(this);\r
+ cut.setLabel("Cut");\r
+ cut.addActionListener(this);\r
+ delete.setLabel("Delete");\r
+ delete.addActionListener(this);\r
+ pasteMenu.setLabel("Paste");\r
+ pasteNew.setLabel("To New Alignment");\r
+ pasteNew.addActionListener(this);\r
+ pasteThis.setLabel("Add To This Alignment");\r
+ pasteThis.addActionListener(this);\r
+ applyToAllGroups.setLabel("Apply Colour To All Groups");\r
+ applyToAllGroups.setState(true);\r
+ applyToAllGroups.addItemListener(this);\r
+ font.setLabel("Font...");\r
+ font.addActionListener(this);\r
+ scaleAbove.setLabel("Scale Above");\r
+ scaleAbove.setState(true);\r
+ scaleAbove.setEnabled(false);\r
+ scaleAbove.addItemListener(this);\r
+ scaleLeft.setEnabled(false);\r
+ scaleLeft.setState(true);\r
+ scaleLeft.setLabel("Scale Left");\r
+ scaleLeft.addItemListener(this);\r
+ scaleRight.setEnabled(false);\r
+ scaleRight.setState(true);\r
+ scaleRight.setLabel("Scale Right");\r
+ scaleRight.addItemListener(this);\r
+ modifyPID.setLabel("Modify Identity Threshold...");\r
+ modifyPID.addActionListener(this);\r
+ modifyConservation.setLabel("Modify Conservation Threshold...");\r
+ modifyConservation.addActionListener(this);\r
+ sortByTreeMenu.setLabel("By Tree Order");\r
+ sort.setLabel("Sort");\r
+ calculate.setLabel("Calculate Tree");\r
+ autoCalculate.addItemListener(this);\r
+ inputText.setLabel("Input from textbox");\r
+ inputText.addActionListener(this);\r
+\r
+ helpMenu.setLabel("Help");\r
+ documentation.setLabel("Documentation");\r
+ documentation.addActionListener(this);\r
+\r
+ about.setLabel("About...");\r
+ about.addActionListener(this);\r
+ seqLimits.setState(true);\r
+ seqLimits.setLabel("Show Sequence Limits");\r
+ seqLimits.addItemListener(this);\r
+ featureSettings.setLabel("Feature Settings...");\r
+ featureSettings.addActionListener(this);\r
+ sequenceFeatures.setLabel("Sequence Features");\r
+ sequenceFeatures.addItemListener(this);\r
+ sequenceFeatures.setState(false);\r
+ annotationColour.setLabel("by Annotation...");\r
+ annotationColour.addActionListener(this);\r
+ invertSequenceMenuItem.setLabel("Invert Sequence Selection");\r
+ invertColSel.setLabel("Invert Column Selection");\r
+ menu1.setLabel("Show");\r
+ showColumns.setLabel("All Columns ");\r
+ showSeqs.setLabel("All Sequences");\r
+ menu2.setLabel("Hide");\r
+ hideColumns.setLabel("Selected Columns");\r
+ hideSequences.setLabel("Selected Sequences");\r
+ invertColSel.addActionListener(this);\r
+ showColumns.addActionListener(this);\r
+ showSeqs.addActionListener(this);\r
+ hideColumns.addActionListener(this);\r
+ hideSequences.addActionListener(this);\r
+ formatMenu.setLabel("Format");\r
+ selectMenu.setLabel("Select");\r
+ alignFrameMenuBar.add(fileMenu);\r
+ alignFrameMenuBar.add(editMenu);\r
+ alignFrameMenuBar.add(selectMenu);\r
+ alignFrameMenuBar.add(viewMenu);\r
+ alignFrameMenuBar.add(formatMenu);\r
+ alignFrameMenuBar.add(colourMenu);\r
+ alignFrameMenuBar.add(calculateMenu);\r
+ alignFrameMenuBar.add(helpMenu);\r
+ fileMenu.add(inputText);\r
+ fileMenu.add(outputTextboxMenu);\r
+ if(jalviewServletURL!=null)\r
+ fileMenu.add(loadApplication);\r
+ fileMenu.addSeparator();\r
+ fileMenu.add(loadTree);\r
+ fileMenu.add(closeMenuItem);\r
+ editMenu.add(undoMenuItem);\r
+ editMenu.add(redoMenuItem);\r
+ editMenu.add(cut);\r
+ editMenu.add(copy);\r
+ editMenu.add(pasteMenu);\r
+ editMenu.add(delete);\r
+ editMenu.addSeparator();\r
+ editMenu.add(remove2LeftMenuItem);\r
+ editMenu.add(remove2RightMenuItem);\r
+ editMenu.add(removeGappedColumnMenuItem);\r
+ editMenu.add(removeAllGapsMenuItem);\r
+ editMenu.add(removeRedundancyMenuItem);\r
+ viewMenu.add(menu1);\r
+ viewMenu.add(menu2);\r
+ viewMenu.addSeparator();\r
+ viewMenu.add(annotationPanelMenuItem);\r
+ viewMenu.addSeparator();\r
+ viewMenu.add(sequenceFeatures);\r
+ viewMenu.add(featureSettings);\r
+ viewMenu.addSeparator();\r
+ viewMenu.add(overviewMenuItem);\r
+ colourMenu.add(applyToAllGroups);\r
+ colourMenu.addSeparator();\r
+ colourMenu.add(noColourmenuItem);\r
+ colourMenu.add(clustalColour);\r
+ colourMenu.add(BLOSUM62Colour);\r
+ colourMenu.add(PIDColour);\r
+ colourMenu.add(zappoColour);\r
+ colourMenu.add(taylorColour);\r
+ colourMenu.add(hydrophobicityColour);\r
+ colourMenu.add(helixColour);\r
+ colourMenu.add(strandColour);\r
+ colourMenu.add(turnColour);\r
+ colourMenu.add(buriedColour);\r
+ colourMenu.add(nucleotideColour);\r
+ colourMenu.add(userDefinedColour);\r
+ colourMenu.addSeparator();\r
+ colourMenu.add(conservationMenuItem);\r
+ colourMenu.add(modifyConservation);\r
+ colourMenu.add(abovePIDThreshold);\r
+ colourMenu.add(modifyPID);\r
+ colourMenu.add(annotationColour);\r
+ calculateMenu.add(sort);\r
+ calculateMenu.add(calculate);\r
+ calculateMenu.addSeparator();\r
+ calculateMenu.add(pairwiseAlignmentMenuItem);\r
+ calculateMenu.add(PCAMenuItem);\r
+ calculateMenu.add(autoCalculate);\r
+ this.add(statusBar, BorderLayout.SOUTH);\r
+ pasteMenu.add(pasteNew);\r
+ pasteMenu.add(pasteThis);\r
+ sort.add(sortIDMenuItem);\r
+ sort.add(sortByTreeMenu);\r
+ sort.add(sortGroupMenuItem);\r
+ sort.add(sortPairwiseMenuItem);\r
+ calculate.add(averageDistanceTreeMenuItem);\r
+ calculate.add(neighbourTreeMenuItem);\r
+ calculate.add(avDistanceTreeBlosumMenuItem);\r
+ calculate.add(njTreeBlosumMenuItem);\r
+ helpMenu.add(documentation);\r
+ helpMenu.add(about);\r
+ menu1.add(showColumns);\r
+ menu1.add(showSeqs);\r
+ menu2.add(hideColumns);\r
+ menu2.add(hideSequences);\r
+ formatMenu.add(font);\r
+ formatMenu.add(seqLimits);\r
+ formatMenu.add(wrapMenuItem);\r
+ formatMenu.add(scaleAbove);\r
+ formatMenu.add(scaleLeft);\r
+ formatMenu.add(scaleRight);\r
+ formatMenu.add(viewBoxesMenuItem);\r
+ formatMenu.add(viewTextMenuItem);\r
+ formatMenu.add(colourTextMenuItem);\r
+ formatMenu.add(renderGapsMenuItem);\r
+ selectMenu.add(findMenuItem);\r
+ selectMenu.addSeparator();\r
+ selectMenu.add(selectAllSequenceMenuItem);\r
+ selectMenu.add(deselectAllSequenceMenuItem);\r
+ selectMenu.add(invertSequenceMenuItem);\r
+ selectMenu.add(invertColSel);\r
+ selectMenu.add(deleteGroups);\r
+ }\r
+\r
+ public void setEmbedded()\r
+ {\r
+\r
+ embeddedMenu = new Panel();\r
+ embeddedEdit = new Label("Edit");\r
+ embeddedSelect = new Label("Select");\r
+ embeddedView = new Label("View");\r
+ embeddedFormat = new Label("Format");\r
+ embeddedColour = new Label("Colour");\r
+ embeddedFile = new Label("File");\r
+ embeddedHelp = new Label("Help");\r
+ embeddedCalculate = new Label("Calculate");\r
+ flowLayout1 = new FlowLayout();\r
+ embeddedMenu.setBackground(Color.lightGray);\r
+ embeddedMenu.setLayout(flowLayout1);\r
+ embeddedEdit.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedSelect.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedView.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedFormat.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedColour.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedFile.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedHelp.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedCalculate.setFont(new java.awt.Font("Arial", Font.PLAIN, 10));\r
+ embeddedMenu.add(embeddedFile);\r
+ embeddedMenu.add(embeddedEdit);\r
+ embeddedMenu.add(embeddedSelect);\r
+ embeddedMenu.add(embeddedView);\r
+ embeddedMenu.add(embeddedFormat);\r
+ embeddedMenu.add(embeddedColour);\r
+ embeddedMenu.add(embeddedCalculate);\r
+ embeddedMenu.add(embeddedHelp);\r
+ flowLayout1.setAlignment(FlowLayout.LEFT);\r
+ flowLayout1.setHgap(2);\r
+ flowLayout1.setVgap(0);\r
+ embeddedFile.addMouseListener(this);\r
+ embeddedEdit.addMouseListener(this);\r
+ embeddedSelect.addMouseListener(this);\r
+ embeddedView.addMouseListener(this);\r
+ embeddedFormat.addMouseListener(this);\r
+ embeddedColour.addMouseListener(this);\r
+ embeddedCalculate.addMouseListener(this);\r
+ embeddedHelp.addMouseListener(this);\r
+\r
+ // setVisible(false);\r
+ fileMenu.remove(closeMenuItem);\r
+ fileMenu.remove(3); // Seperator\r
+\r
+ viewport.applet.setLayout(new BorderLayout());\r
+ viewport.applet.add(embeddedMenu, BorderLayout.NORTH);\r
+ viewport.applet.add(statusBar, BorderLayout.SOUTH);\r
+ // viewport.applet.validate();\r
+\r
+ alignPanel.setSize(viewport.applet.size().width, viewport.applet.size().height\r
+ - embeddedMenu.HEIGHT - statusBar.HEIGHT);\r
+\r
+ viewport.applet.add(alignPanel, BorderLayout.CENTER);\r
+ viewport.applet.validate();\r
+\r
+ }\r
+\r
+\r
+\r
+ PopupMenu filePopup, editPopup, searchPopup,\r
+ viewPopup, formatPopup, colourPopup, calculatePopup, helpPopup;\r
+ MenuItem featureSettings = new MenuItem();\r
+ CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem();\r
+ MenuItem annotationColour = new MenuItem();\r
+ MenuItem invertColSel = new MenuItem();\r
+ Menu menu1 = new Menu();\r
+ MenuItem showColumns = new MenuItem();\r
+ MenuItem showSeqs = new MenuItem();\r
+ Menu menu2 = new Menu();\r
+ MenuItem hideColumns = new MenuItem();\r
+ MenuItem hideSequences = new MenuItem();\r
+ Menu formatMenu = new Menu();\r
+ Menu selectMenu = new Menu();\r
+\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ PopupMenu popup = null;\r
+ Label source = (Label)evt.getSource();\r
+ if(source==embeddedFile)\r
+ {\r
+ popup = filePopup = genPopupMenu(filePopup, fileMenu);\r
+ }\r
+ else if(source==embeddedEdit)\r
+ {\r
+ popup = editPopup = genPopupMenu(editPopup, editMenu);\r
+ }\r
+ else if(source==embeddedSelect)\r
+ {\r
+ popup = searchPopup = genPopupMenu(searchPopup, selectMenu);\r
+ }\r
+ else if(source==embeddedView)\r
+ {\r
+ popup = viewPopup = genPopupMenu(viewPopup, viewMenu);\r
+ }\r
+ else if (source ==embeddedFormat)\r
+ {\r
+ popup = formatPopup = genPopupMenu(formatPopup, formatMenu);\r
+ }\r
+ else if(source==embeddedColour)\r
+ {\r
+ popup = colourPopup = genPopupMenu(colourPopup, colourMenu);\r
+ }\r
+ else if(source==embeddedCalculate)\r
+ {\r
+ popup = calculatePopup = genPopupMenu(calculatePopup, calculateMenu);\r
+ }\r
+ else if(source==embeddedHelp)\r
+ {\r
+ popup = helpPopup = genPopupMenu(helpPopup, helpMenu);\r
+ }\r
+\r
+ embeddedMenu.add(popup);\r
+ popup.show(embeddedMenu,\r
+ source.getBounds().x,\r
+ source.getBounds().y + source.getBounds().getSize().height);\r
+ }\r
+\r
+ PopupMenu genPopupMenu(PopupMenu popup, Menu original)\r
+ {\r
+ if(popup!=null)\r
+ {\r
+ return popup;\r
+ }\r
+ popup = new PopupMenu();\r
+ int m, mSize = original.getItemCount();\r
+ for(m=0; m<mSize; m++)\r
+ {\r
+ popup.add(original.getItem(m));\r
+ mSize--;\r
+ m--;\r
+ }\r
+\r
+ return popup;\r
+ }\r
+ public void mouseClicked(MouseEvent evt)\r
+ {}\r
+ public void mouseReleased(MouseEvent evt)\r
+ {}\r
+ public void mouseEntered(MouseEvent evt)\r
+ {}\r
+ public void mouseExited(MouseEvent evt)\r
+ {}\r
+\r