menu for choosing between 'protein' and 'RNA' mode (unlikely to be merged into main...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 7 Dec 2012 15:01:08 +0000 (15:01 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 7 Dec 2012 15:01:08 +0000 (15:01 +0000)
src/jalview/bin/Jalview.java
src/jalview/gui/MenuChooser.java [new file with mode: 0644]

index 1c63f7f..df9501d 100755 (executable)
@@ -70,7 +70,11 @@ public class Jalview
       }
     });
   }
-  protected static boolean proteine;
+  /**
+   * Put protein=true for get a protein example
+   */
+  private static boolean protein=false;
+
 
   /**
    * main class for Jalview application
@@ -521,27 +525,14 @@ public class Jalview
     // And the user
     // ////////////////////
   
-    JFrame Typechooser =new JFrame("choose molecule type"); 
-    FlowLayout fl = new FlowLayout();
-    Typechooser.setLayout(fl);
-    Typechooser.setSize(400,400);
-    Typechooser.setDefaultCloseOperation(Typechooser.DISPOSE_ON_CLOSE);
-    JLabel label = new JLabel("What would you open ? ");
-    JButton rnabutton = new JButton("RNA molecule");
-    JButton pbutton = new JButton("Proteine molecule");
-    
-    pbutton.addActionListener(new pbuttonlistener());
-    rnabutton.addActionListener(new rnabuttonlistener());
-    Typechooser.getContentPane().add(label);
-    Typechooser.getContentPane().add(rnabutton);
-    Typechooser.getContentPane().add(pbutton);
-    Typechooser.setVisible(true);
+
     
     
 
     
     if (!headless && file == null && vamsasImport == null
-            && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true) && proteine == true)
+            && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true) && protein == true)
     {
       file = jalview.bin.Cache.getDefault(
               "STARTUP_FILE",
diff --git a/src/jalview/gui/MenuChooser.java b/src/jalview/gui/MenuChooser.java
new file mode 100644 (file)
index 0000000..2ea7bca
--- /dev/null
@@ -0,0 +1,79 @@
+package jalview.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+public class MenuChooser implements ActionListener
+{
+  public static boolean protein;
+
+  private JFrame choosemenu = new JFrame("Animation");
+
+  private JButton bouton = new JButton("bouton 1");
+
+  private JButton bouton2 = new JButton("bouton 2");
+
+  private JPanel container = new JPanel();
+
+  private JLabel label = new JLabel("Le JLabel");
+
+  public MenuChooser()
+  {
+
+    choosemenu.setSize(300, 300);
+    choosemenu.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+    choosemenu.setLocationRelativeTo(null);
+
+    container.setBackground(Color.white);
+    container.setLayout(new BorderLayout());
+
+    // On ajoute notre Fenetre à la liste des auditeurs de notre Bouton
+    bouton.addActionListener(this);
+    bouton2.addActionListener(this);
+
+    JPanel south = new JPanel();
+    south.add(bouton);
+    south.add(bouton2);
+    container.add(south, BorderLayout.SOUTH);
+
+    // On change la couleur de police
+    label.setForeground(Color.blue);
+    // Et on change l'alignement du texte grâce aux attributs static de la
+    // classe JLabel
+    label.setHorizontalAlignment(JLabel.CENTER);
+
+    container.add(label, BorderLayout.NORTH);
+
+    choosemenu.setContentPane(container);
+    choosemenu.setVisible(true);
+
+  }
+
+  // ...
+
+  // *******************************************************************************
+  // LA VOILAAAAAAAAAAAAAA
+  // *******************************************************************************
+  /**
+   * C'est la méthode qui sera appelée lors d'un clic sur notre bouton
+   */
+  public void actionPerformed(ActionEvent arg0)
+  {
+
+    if (arg0.getSource() == bouton)
+      protein = false;
+    label.setText("RNA menu");
+
+    if (arg0.getSource() == bouton2)
+      label.setText("Protein menu");
+    protein = true;
+  }
+
+}