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
|
import javax.swing.*;
public class ListenerAnonyme {
private JFrame jf=null;
private Button btn1=null;
private JLabel lbl1=null;
public ListenerAnonyme()
{
initialiser();
layout();
addComponent();
}
public void initialiser()
{
jf=new JFrame();
btn1=new Button("Valider");
lbl1=new JLabel("OUI/NON?");
jf.setVisible(true);
jf.setSize(400, 300);
}
public void layout()
{
FlowLayout fl=new FlowLayout(FlowLayout.LEFT);
jf.setLayout(fl);
}
public void addComponent()
{
jf.add(btn1);
jf.add(lbl1);
}
} |
Partager