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
| package interfaceGraphique;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import arbre.Arbre;
/**
* IHM de l'outil
* @author ZEGGWAGH_L
*
*/
public class IHM implements MouseMotionListener {
/* Attributs */
/* Composants Swing*/
// Fenêtre
public static JFrame cadre ;
// Les panels
private JPanel mainPanel ;
//Les arbres
private Arbre arbreComposant;
private Arbre arbreArchitecture;
/**
* Méthode qui initialise l'ihm au lancement
*/
public void init(){
// Création de l'IHM
cadre=new JFrame();
//Panel
mainPanel=new JPanel();
/* Agencement*/
mainPanel.setLayout(new GridLayout(1,2));
//Arbres
arbreComposant =new Arbre();
arbreArchitecture =new Arbre();
cadre.add(mainPanel);
mainPanel.add(arbreComposant);
mainPanel.add(arbreArchitecture);
//Options du cadre
cadre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cadre.setSize(1200, 900);
cadre.setVisible(true);
//Ajout des listeners
arbreComposant.addMouseMotionListener(this);
arbreArchitecture.addMouseMotionListener(this);
}
@Override
public void mouseDragged(MouseEvent arg0) {
System.out.println("appel de la fonction mouseDragged");
}
@Override
public void mouseMoved(MouseEvent arg0) {
// TODO Auto-generated method stub
}
public static void main(String[] args) {
new IHM().init();
}
} |
Partager