Skip to content

Instantly share code, notes, and snippets.

@mdeous
Created April 25, 2011 12:02
Show Gist options
  • Save mdeous/940415 to your computer and use it in GitHub Desktop.
Save mdeous/940415 to your computer and use it in GitHub Desktop.
public class TutoClass {
public static void main(String[] args) {
System.out.println();
}
}
@Daroth
Copy link

Daroth commented Apr 25, 2011

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

public class MonApplication {

public static void main(String[] args) {
    MaFenetre f = new MaFenetre();
    f.afficher();
}

}

class MaFenetre {

JFrame mainFrame = null;

public MaFenetre() {

    mainFrame = new JFrame();
    mainFrame.setTitle("Mon application");

    mainFrame.addWindowListener(new WindowAdapter() {

        class MonAutreClasse {

            public void afficher(String message) {
                System.out.println(message);
            }

        }

        public void windowClosing(WindowEvent ev) {
            MonAutreClasse mac = new MonAutreClasse();
            mac.afficher("message");
            System.exit(0);
        }
    });

    mainFrame.setSize(320, 240);
}

public void afficher() {
    mainFrame.setVisible(true);
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment