import java.awt.event.ActionEvent;\r
\r
\r
-public class AppletPDBViewer extends Frame\r
+public class AppletPDBViewer extends Frame implements ActionListener, ItemListener\r
{\r
- PDBEntry pdb;\r
- Sequence sequence;\r
AppletPDBCanvas pdbcanvas;\r
-\r
-\r
public AppletPDBViewer(String pdbtext,String type,\r
Sequence seq,\r
SeqCanvas seqcanvas)\r
{\r
- sequence = seq;\r
\r
try\r
{\r
\r
add(pdbcanvas, BorderLayout.CENTER);\r
\r
- StringBuffer title = new StringBuffer(sequence.getName() + ":");\r
+ StringBuffer title = new StringBuffer(seq.getName() + ":");\r
\r
jalview.bin.JalviewLite.addFrame(this,title.toString(),400, 400);\r
\r
}\r
}\r
\r
+ public void actionPerformed(ActionEvent evt)\r
+ {\r
+ if(evt.getSource()==mapping)\r
+ mapping_actionPerformed();\r
+ else if(evt.getSource()==wire)\r
+ wire_actionPerformed();\r
+ else if(evt.getSource()==depth)\r
+ depth_actionPerformed();\r
+ else if(evt.getSource()==zbuffer)\r
+ zbuffer_actionPerformed();\r
+ else if(evt.getSource()==charge)\r
+ charge_actionPerformed();\r
+\r
+ else if(evt.getSource()==chain)\r
+ chain_actionPerformed();\r
+ else if(evt.getSource()==seqButton)\r
+ seqButton_actionPerformed();\r
+ else if(evt.getSource()==zappo)\r
+ pdbcanvas.setColours(new ZappoColourScheme());\r
+ else if(evt.getSource()==taylor)\r
+ pdbcanvas.setColours(new TaylorColourScheme());\r
+ else if(evt.getSource()==hydro)\r
+ pdbcanvas.setColours(new HydrophobicColourScheme());\r
+ else if(evt.getSource()==helix)\r
+ pdbcanvas.setColours(new HelixColourScheme());\r
+ else if(evt.getSource()==strand)\r
+ pdbcanvas.setColours(new StrandColourScheme());\r
+ else if(evt.getSource()==turn)\r
+ pdbcanvas.setColours(new TurnColourScheme());\r
+ else if(evt.getSource()==buried)\r
+ pdbcanvas.setColours(new BuriedColourScheme());\r
+ else if(evt.getSource()==user)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ new jalview.appletgui.UserDefinedColours(pdbcanvas);\r
+ }\r
+ }\r
+\r
+ public void itemStateChanged(ItemEvent evt)\r
+ {\r
+ if (evt.getSource() == allchains)\r
+ allchains_itemStateChanged();\r
+ else if (evt.getSource() == wire)\r
+ wire_actionPerformed();\r
+ else if (evt.getSource() == depth)\r
+ depth_actionPerformed();\r
+ else if (evt.getSource() == zbuffer)\r
+ zbuffer_actionPerformed();\r
+ }\r
+\r
\r
private void jbInit()\r
throws Exception\r
{\r
- this.setMenuBar(jMenuBar1);\r
+ setMenuBar(jMenuBar1);\r
fileMenu.setLabel("File");\r
coloursMenu.setLabel("Colours");\r
mapping.setLabel("View Mapping");\r
- mapping.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- mapping_actionPerformed();\r
- }\r
- });\r
+ mapping.addActionListener(this);\r
wire.setLabel("Wireframe");\r
- wire.addItemListener(new ItemListener()\r
- {\r
- public void itemStateChanged(ItemEvent e)\r
- {\r
- wire_actionPerformed();\r
- }\r
- });\r
+ wire.addItemListener(this);\r
depth.setState(true);\r
depth.setLabel("Depthcue");\r
- depth.addItemListener(new ItemListener()\r
- {\r
- public void itemStateChanged(ItemEvent e)\r
- {\r
- depth_actionPerformed();\r
- }\r
- });\r
+ depth.addItemListener(this);\r
zbuffer.setState(true);\r
zbuffer.setLabel("Z Buffering");\r
- zbuffer.addItemListener(new ItemListener()\r
- {\r
- public void itemStateChanged(ItemEvent e)\r
- {\r
- zbuffer_actionPerformed();\r
- }\r
- });\r
+ zbuffer.addItemListener(this);\r
charge.setLabel("Charge & Cysteine");\r
- charge.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- charge_actionPerformed();\r
- }\r
- });\r
+ charge.addActionListener(this);\r
hydro.setLabel("Hydrophobicity");\r
- hydro.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- pdbcanvas.setColours(new HydrophobicColourScheme());\r
- }\r
- });\r
+ hydro.addActionListener(this);\r
chain.setLabel("By Chain");\r
- chain.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- chain_actionPerformed();\r
- }\r
- });\r
+ chain.addActionListener(this);\r
seqButton.setLabel("By Sequence");\r
- seqButton.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e){\r
- seqButton_actionPerformed();\r
- }\r
- });\r
+ seqButton.addActionListener(this);\r
allchains.setLabel("All Chains Visible");\r
- allchains.addItemListener(new ItemListener()\r
- {\r
- public void itemStateChanged(ItemEvent itemEvent)\r
- {\r
- allchains_itemStateChanged(itemEvent);\r
- }\r
- });\r
+ allchains.addItemListener(this);\r
viewMenu.setLabel("View");\r
zappo.setLabel("Zappo");\r
- zappo.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbcanvas.setColours(new ZappoColourScheme());\r
- }\r
- });\r
+ zappo.addActionListener(this);\r
taylor.setLabel("Taylor");\r
- taylor.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbcanvas.setColours(new TaylorColourScheme());\r
- }\r
- });\r
+ taylor.addActionListener(this);\r
helix.setLabel("Helix Propensity");\r
- helix.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbcanvas.setColours(new HelixColourScheme());\r
- }\r
- });\r
+ helix.addActionListener(this);\r
strand.setLabel("Strand Propensity");\r
- strand.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbcanvas.setColours(new StrandColourScheme());\r
- }\r
- });\r
+ strand.addActionListener(this);\r
turn.setLabel("Turn Propensity");\r
- turn.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbcanvas.setColours(new TurnColourScheme());\r
- }\r
- });\r
+ turn.addActionListener(this);\r
buried.setLabel("Buried Index");\r
- buried.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbcanvas.setColours(new BuriedColourScheme());\r
- }\r
- });\r
+ buried.addActionListener(this);\r
user.setLabel("User Defined...");\r
- user.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbcanvas.bysequence = false;\r
- new jalview.appletgui.UserDefinedColours(pdbcanvas);\r
- }\r
- });\r
+ user.addActionListener(this);\r
jMenuBar1.add(fileMenu);\r
jMenuBar1.add(coloursMenu);\r
jMenuBar1.add(viewMenu);\r
cap.setText(pdbcanvas.mappingDetails.toString());\r
}\r
\r
- public void allchains_itemStateChanged(ItemEvent itemEvent)\r
+ public void allchains_itemStateChanged()\r
{\r
pdbcanvas.setAllchainsVisible(allchains.getState());\r
}\r