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
|
import javax.swing.*;
import java.io.*;
public class Fenetre{
private JButton bouton;
private JFrame frame = new JFrame("titre");
public Fenetre(){
File file = new File("eat.gif");
if(file.exists())
System.out.println("file found");
else
System.out.println("file not found");
frame.setTitle("Bouton");
frame.setSize(1000, 500);
frame.setLayout(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Icon warnIcon = new ImageIcon("eat.gif"));
bouton = new JButton(warnIcon);
bouton.setBounds(10,10,103,24);
frame.add(bouton);
frame.setVisible(true);
}
} |
Partager