Menu

ensi2005 Messages postés 6 Date d'inscription mercredi 15 novembre 2000 Statut Membre Dernière intervention 13 février 2009 - 26 mars 2008 à 13:09
uhrand Messages postés 491 Date d'inscription samedi 20 mai 2006 Statut Membre Dernière intervention 15 juillet 2012 - 28 mars 2008 à 06:52
ok
en premier lieu j'ai besoin du code quand on clik sur un jmenuItem appeler par exemple EA la fenetre jpanel appelée EA apparetre
merci de vos reponses c la premiere fois que je pose une question dans un forum
 c pour ce la que j'ai pas bien le posé
alors c le code de menu:

package trafic1;


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;






public class Index extends JFrame {
  JPanel contentPane;
  JMenuBar jMenuBar1 = new JMenuBar();
  JMenu jMenuAnalogique = new JMenu();
  JMenuItem jMenuEA = new JMenuItem();
  JMenu jMenuIP = new JMenu();
  XYLayout xYLayout1 = new XYLayout();
  JMenuItem jMenuEB = new JMenuItem();
  JMenuItem jMenuEC = new JMenuItem();
  JMenuItem jMenuExit = new JMenuItem();
  JMenu jMenuCentrAppel = new JMenu();
  JMenu jMenuCellulaire = new JMenu();
  JMenu jMenuAide = new JMenu();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();


  //Construct the frame
  public Index() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  //Component initialization
  private void jbInit() throws Exception  {
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(xYLayout1);
    this.setSize(new Dimension(500, 300));
    this.setTitle("Index");
    jMenuAnalogique.setText("Téléphonie Analogique");
    jMenuEA.setText("Erlang A");
    jMenuEA.addFocusListener(new Index_jMenuEA_focusAdapter(this));
    jMenuEA.addActionListener(new Index_jMenuEA_ActionAdapter(this));
    jMenuIP.setText("Téléphonie sur IP");
    jMenuEB.setBackground(Color.white);
    jMenuEB.setText("Erlang B");
    jMenuEC.setText("Erlang C");
    jMenuExit.setText("Exit");
    jMenuCentrAppel.setText("Centre d\'Appel");
    jMenuCellulaire.setText("Téléphonie Cellulaire");
    jMenuAide.setText("Aide");
    jLabel1.setFont(new java.awt.Font("Dialog", 0, 20));
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("Bienvenue dans notre application:");
    jLabel2.setFont(new java.awt.Font("Serif", 1, 30));
    jLabel2.setForeground(Color.red);
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("Dimonsionnement du Trafic Télécom");
    jMenuAnalogique.add(jMenuEA);
    jMenuAnalogique.add(jMenuEB);
    jMenuAnalogique.add(jMenuEC);
    jMenuAnalogique.add(jMenuExit);
    jMenuBar1.add(jMenuAnalogique);
    jMenuBar1.add(jMenuIP);
    jMenuBar1.add(jMenuCentrAppel);
    jMenuBar1.add(jMenuCellulaire);
    jMenuBar1.add(jMenuAide);
    contentPane.add(jLabel1,  new XYConstraints(55, 111, 397, 36));
    contentPane.add(jLabel2,  new XYConstraints(5, 162, 489, 117));
    this.setJMenuBar(jMenuBar1);
  }
  //File | Exit action performed
  public void jMenuEA_actionPerformed(ActionEvent e) {
    System.exit(0);
  }
  //Help | About action performed
  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      jMenuEA_actionPerformed(null);
    }
  }




}


class Index_jMenuEA_ActionAdapter implements ActionListener {
  Index adaptee;


  Index_jMenuEA_ActionAdapter(Index adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jMenuEA_actionPerformed(e);
  }
}


class Index_jMenuEA_focusAdapter extends java.awt.event.FocusAdapter {
  Index adaptee;


  Index_jMenuEA_focusAdapter(Index adaptee) {
    this.adaptee = adaptee;
  }


}

merci §§§

1 réponse

uhrand Messages postés 491 Date d'inscription samedi 20 mai 2006 Statut Membre Dernière intervention 15 juillet 2012 9
28 mars 2008 à 06:52
0
Rejoignez-nous