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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
package statistique;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class statistique {
private JFrame fr_stat = new JFrame( "statistique" );
private JPanel panel = new JPanel();
private Rectangle r = new Rectangle( 0, 0, 1000, 1000 );
private Color c = Color.BLUE;
private aide_statistique fr_help;
public statistique() {
fr_stat.getContentPane().setBackground( Color.BLUE );
fr_stat.setBackground( c );
fr_stat.setDefaultCloseOperation( fr_stat.EXIT_ON_CLOSE );
fr_stat.setSize( 1000, 1000 );
fr_stat.setVisible( true );
fr_stat.getContentPane().setLayout( null );
fr_stat.setLocationRelativeTo( null );
panel.setBounds( r );
panel.setBackground( c );
panel.setBorder( null );
panel.setLayout( null );
fr_stat.getContentPane().add( panel );
fr_help = new aide_statistique( this );
JButton help = new JButton( "aide statistique" );
help.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
fr_help.toStart();
toSleep();
}
} );
help.setBounds( 66, 62, 260, 67 );
panel.add( help );
JButton menu = new JButton( "menu principale" );
menu.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
fr_stat.dispose();
}
} );
menu.setBounds( 66, 162, 260, 67 );
panel.add( menu );
panel.repaint();
panel.revalidate();
}
public void toStart() {
fr_stat.setVisible( true );
}
public void toSleep() {
fr_stat.setVisible( false );
}
public static void main( String[] args ) {
new statistique();
}
}
class aide_statistique {
private JFrame fr_help = new JFrame( "aide statistique" );
private JPanel panel = new JPanel();
private Rectangle r = new Rectangle( 0, 0, 1000, 1000 );
private Color c = Color.red;
public aide_statistique( final statistique fr_stat ) {
fr_help.getContentPane().setBackground( Color.BLUE );
fr_help.setBackground( c );
fr_help.setDefaultCloseOperation( fr_help.EXIT_ON_CLOSE );
fr_help.setSize( 1000, 1000 );
fr_help.setVisible( false );
fr_help.getContentPane().setLayout( null );
fr_help.setLocationRelativeTo( null );
panel.setBounds( r );
panel.setBackground( c );
panel.setBorder( null );
panel.setLayout( null );
fr_help.getContentPane().add( panel );
JButton retour = new JButton( "retour" );
retour.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
fr_stat.toStart();
toSleep();
}
} );
retour.setBounds( 66, 62, 260, 67 );
panel.add( retour );
}
public void toStart() {
fr_help.setVisible( true );
}
public void toSleep() {
fr_help.setVisible( false );
}
} |
Partager