}
});
}
- protected static boolean proteine;
+ /**
+ * Put protein=true for get a protein example
+ */
+ private static boolean protein=false;
+
/**
* main class for Jalview application
// 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",
--- /dev/null
+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;
+ }
+
+}