From acc0719b1f2f3e7632b981e9ea6f2a76b169f729 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 18 Feb 2005 12:28:36 +0000 Subject: [PATCH] treepanel is now internalframe, has a menu --- src/jalview/jbgui/GTreePanel.java | 105 +++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 45 deletions(-) diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java index 43ee7c9..4b18fd3 100755 --- a/src/jalview/jbgui/GTreePanel.java +++ b/src/jalview/jbgui/GTreePanel.java @@ -4,105 +4,120 @@ import java.awt.*; import javax.swing.*; import java.awt.event.*; -public class GTreePanel extends JPanel +public class GTreePanel extends JInternalFrame { BorderLayout borderLayout1 = new BorderLayout(); - JPanel jPanel1 = new JPanel(); - JLabel jLabel1 = new JLabel(); - protected JComboBox fontSizeCombobox = new JComboBox(); - protected JCheckBox showDistanceCheckbox = new JCheckBox(); - protected JButton saveButton = new JButton(); - protected JCheckBox bootStrapCheckBox = new JCheckBox(); protected JScrollPane scrollPane = new JScrollPane(); + JMenuBar jMenuBar1 = new JMenuBar(); + JMenu jMenu1 = new JMenu(); + JMenuItem saveMenu = new JMenuItem(); + JMenuItem printMenu = new JMenuItem(); + JMenu jMenu2 = new JMenu(); + protected JMenuItem fontSize = new JMenuItem(); + protected JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem(); public GTreePanel() { try { jbInit(); + this.setJMenuBar(jMenuBar1); } catch(Exception e) { e.printStackTrace(); } - for(int i=2; i<26; i+=2) - fontSizeCombobox.addItem(i+""); - fontSizeCombobox.setSelectedItem("12"); - } private void jbInit() throws Exception { - this.setLayout(borderLayout1); - jLabel1.setFont(new java.awt.Font("Verdana", 0, 12)); - jLabel1.setText("Font size"); - showDistanceCheckbox.setFont(new java.awt.Font("Verdana", 0, 12)); - showDistanceCheckbox.setText("Show distances"); - showDistanceCheckbox.addActionListener(new java.awt.event.ActionListener() + this.getContentPane().setLayout(borderLayout1); + this.setBackground(Color.white); + this.setFont(new java.awt.Font("Verdana", 0, 12)); + this.setMinimumSize(new Dimension(530, 60)); + scrollPane.setOpaque(false); + jMenu1.setText("File"); + saveMenu.setEnabled(false); + saveMenu.setText("Save"); + saveMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { - showDistanceCheckbox_actionPerformed(e); + saveMenu_actionPerformed(e); } }); - saveButton.setFont(new java.awt.Font("Verdana", 0, 12)); - saveButton.setToolTipText(""); - saveButton.setText("Save as postscript"); - saveButton.addActionListener(new java.awt.event.ActionListener() + printMenu.setText("Print"); + printMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { - saveButton_actionPerformed(e); + printMenu_actionPerformed(e); } }); - this.setBackground(Color.white); - this.setFont(new java.awt.Font("Verdana", 0, 12)); - this.setMinimumSize(new Dimension(530, 60)); - fontSizeCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); - fontSizeCombobox.addActionListener(new java.awt.event.ActionListener() + jMenu2.setText("View"); + fontSize.setText("Font Size - 12"); + fontSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { - fontSizeCombobox_actionPerformed(e); + fontSize_actionPerformed(e); } }); - bootStrapCheckBox.setFont(new java.awt.Font("Verdana", 0, 12)); - bootStrapCheckBox.setText("Show bootstrap"); - bootStrapCheckBox.addActionListener(new java.awt.event.ActionListener() + bootstrapMenu.setText("Show Bootstrap values"); + bootstrapMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { - bootStrapCheckBox_actionPerformed(e); + bootstrapMenu_actionPerformed(e); } }); - scrollPane.setOpaque(false); - this.add(jPanel1, BorderLayout.SOUTH); - jPanel1.add(jLabel1, null); - jPanel1.add(fontSizeCombobox, null); - jPanel1.add(showDistanceCheckbox, null); - jPanel1.add(bootStrapCheckBox, null); - jPanel1.add(saveButton, null); - this.add(scrollPane, BorderLayout.CENTER); + distanceMenu.setText("Show Distances"); + distanceMenu.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + distanceMenu_actionPerformed(e); + } + }); + this.getContentPane().add(scrollPane, BorderLayout.CENTER); + jMenuBar1.add(jMenu1); + jMenuBar1.add(jMenu2); + jMenu1.add(saveMenu); + jMenu1.add(printMenu); + jMenu2.add(fontSize); + jMenu2.add(distanceMenu); + jMenu2.add(bootstrapMenu); } + protected void saveMenu_actionPerformed(ActionEvent e) + { + + } - public void saveButton_actionPerformed(ActionEvent e) + protected void printMenu_actionPerformed(ActionEvent e) { } - public void showDistanceCheckbox_actionPerformed(ActionEvent e) + protected void fontSize_actionPerformed(ActionEvent e) { } - public void fontSizeCombobox_actionPerformed(ActionEvent e) + protected void distanceMenu_actionPerformed(ActionEvent e) { } - public void bootStrapCheckBox_actionPerformed(ActionEvent e) + protected void bootstrapMenu_actionPerformed(ActionEvent e) { } + + + + + + } -- 1.7.10.2