Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: bouton RETOUR

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default bouton RETOUR

    slt, je suis debutante en programmation mais je voudrais realiser une tache : j'ai 2 interfaces dans la 2eme interface j'ai un bouton RETOUR pour acceder a la 1ere interface j'ai pa pu faire cette etape ,j'ai besoin d'aide svp : Confused:


  2. #2
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: bouton RETOUR

    Please post your questions in English.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: bouton RETOUR

    Hi, I am a beginner in programming but I would like to realize a task: I have 2 interfaces in the 2nd interface I have a BACK button to access to the first interface I could not do this step, I need help please: Confused:

  4. #4
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: bouton RETOUR

    Please post some code that shows what you are having problems with.

  5. #5
    Junior Member
    Join Date
    Feb 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: bouton RETOUR

    Quote Originally Posted by Norm View Post
    Please post some code that shows what you are having problems with.
    import java.io.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.*;

    import javax.*;
    import javax.swing.*;




    public class testGestion implements ActionListener {
    private JButton But1,But2;
    private JLabel lab1,lab2,lab3;
    private TextField text1 ;
    private JPasswordField text2;
    private JPanel pano1,pano2,pano3,pano4;
    private JFrame fenetre;
    private static JFrame f;



    public testGestion (JFrame f)
    {

    fenetre=new JFrame();
    fenetre.setTitle("authentification");
    fenetre.setSize(400,400);
    fenetre.setLocationRelativeTo(null);
    fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CL OSE);

    lab3=new JLabel(" INTERFACE DE CONNEXION ");
    lab3.setFont (new Font ("Courier New", Font.BOLD, 12 ));
    lab3.setLocation (10,10 );


    lab1=new JLabel("LOGIN :");
    lab1.setFont (new Font ("Courier New", Font.BOLD, 12 ));




    lab2=new JLabel ("PASSWORD :");
    lab2.setFont (new Font ("Courier New", Font.BOLD, 12 ));


    text1=new TextField(12);
    text2=new JPasswordField(10);


    pano1=new JPanel();
    pano1.setLayout(new FlowLayout());
    fenetre.setLayout (new GridLayout (4,2));
    pano1.add(lab3);

    pano2=new JPanel();
    pano2.add(lab1);
    pano2.add(text1);

    pano3=new JPanel();
    pano3.add(lab2);
    pano3.add(text2);

    pano4=new JPanel();
    pano4.setLayout(new FlowLayout(1));
    But1=new JButton("insription");
    But1.addActionListener(this);
    But2=new JButton("connexion ");
    But2.addActionListener(this);
    pano4.add(But1);
    pano4.add(But2);

    fenetre.getContentPane().add(pano1);
    fenetre.getContentPane().add(pano2);
    fenetre.getContentPane().add(pano3);
    fenetre.getContentPane().add(pano4);

    fenetre.setVisible(true);
    }
    @Override
    public void actionPerformed(ActionEvent event ) {
    // TODO Auto-generated method stub
    if (event.getSource()==But1 )
    {
    fenetre.setVisible(false);
    fenetre.dispose();
    f.setVisible(true);
    }
    }



    public static void main (String[] args){

    new testGestion(f);//ERROR
    }


    }

  6. #6
    Junior Member
    Join Date
    Feb 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: bouton RETOUR

    }
    @Override
    public void actionPerformed(ActionEvent event ) {
    // TODO Auto-generated method stub
    if (event.getSource()==But1 )//bouton appui´┐Ż
    {
    fenetre.setVisible(false); // se rendre invisible
    fenetre.dispose(); // si plus besoin
    f.setVisible(true); // pour la rendre visible
    }
    }



    public static void main (String[] args){

    new testGestion(f);
    }


    }