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
| package testgui;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
public class Fenetre extends JFrame {
private JTextField textbox1;
private JTextField textbox2;
JLabel sortie;
/////////////get/set textbox1
public JTextField getTextbox2()
{
return textbox2;
}
public void setTextbox2(JTextField textbox2)
{
this.textbox2 = textbox2;
}
///////////get/set label sortie
public JLabel getSortie()
{
return sortie;
}
public void setSortie(int alpha, JLabel sortie)
{
this.sortie = sortie;
}
///////////get/set textbox2
public JTextField getTextbox1()
{
return textbox1;
}
public void setTextbox1(JTextField textbox1)
{
this.textbox1 = textbox1;
}
public Fenetre() {
JButton button1 = new JButton("calculer");
textbox1 = new JTextField(20);
textbox2 = new JTextField(20);
JLabel label1 = new JLabel("α = ");
JLabel label2 = new JLabel("β = ");
sortie = new JLabel();
JLabel info = new JLabel("on appelle barycentre de deux points pondérés (A,α)");
JLabel info2 = new JLabel("et (B,ß) le point G défini par :");
JPanel panneau = new JPanel(null);
textbox1.setBounds(50, 100, 120, 30);
textbox2.setBounds(50, 150, 120, 30);
button1.setBounds(200, 120, 100, 35);
sortie.setBounds(100, 200, 100, 30);
label1.setBounds(30, 100, 60, 30);
label2.setBounds(30, 150, 60, 30);
info.setBounds(30,40,300,30);
info2.setBounds(40,60,300,30);
panneau.add(info2);
panneau.add(info);
panneau.add(sortie);
panneau.add(label1);
panneau.add(textbox1);
panneau.add(label2);
panneau.add(textbox2);
panneau.add(button1);
JFrame frame = new JFrame("Barycentres");
frame.setContentPane(panneau);
frame.pack();
frame.setSize(360, 640);
frame.setVisible(true);
MoteurCalcul moteurCalcul = new MoteurCalcul(this);
button1.addActionListener(moteurCalcul);
}
} |
Partager