menu for choosing between 'protein' and 'RNA' mode (unlikely to be merged into main...
[jalview.git] / src / jalview / gui / MenuChooser.java
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;
+  }
+
+}