Navigation Entre Interfaces
Bonjour,
Je vais essayé d’expliquer mon problème, je suis débutant en Swing , je suis entrant de créer une interface graphique qui comporte un jMenu et des ItemMenu , JButton …..
Mon problème c’est au niveau des appels aux interfaces, c'est-à-dire si je clique sur lun element de Menu "JMenuItem" , l’interface « X » se charge , j'ai essayé mais je en sais :cry:
Voila men code :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
Menu_Action_SAVE.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
System.out.println("OK");
Grandpanel.removeAll();
Grandpanel.add(new Actionn().getPanel(),BorderLayout.CENTER);
Grandpanel.setVisible(true);
Grandpanel.revalidate();
}
}); |
code de class Actionn
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| package Generale;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class TU2Actions extends AbstractAction {
private Fenetre FRN;
private SavegarderActions SV;
JPanel panel = new JPanel();
public TU2Actions(Fenetre FRN , String Texte) {
// TODO Auto-generated constructor stub
super(Texte);
this.FRN = FRN;
}
private JPanel buildContentPane(){
//SV.panel.removeAll();
panel.setLayout(new FlowLayout());
JTextField textField = new JTextField();
textField.setColumns(10);
panel.add(textField);
JButton Bt1 = new JButton("OK");
panel.add(Bt1);
JLabel Lab_Work_Flow = new JLabel("Work Flow : ");
panel.add(Lab_Work_Flow);
FRN.add(panel);
panel.setVisible(true);
FRN.setVisible(true);
return panel;
}
public void actionPerformed(ActionEvent e) {
System.out.println("OK");
}
protected void initPanel() {
// TODO Auto-generated method stub
}
} |
Merci d'avance:oops: