bonjours,

j'ai fait une JFrame avec un bouton, quand je lance le programme, le bouton est invisible jus qua que je passe la souris dessus.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
public class Frame extends JFrame {
	int bi = 0;  
	public static final long serialVersionUID = 1L;
	public Frame (String title) {	
		JLabel pp2 = new JLabel();
		JLabel sp1 = new JLabel();
		JLabel sp2 = new JLabel();	
		setLayout(null);
		ImageIcon bout = new ImageIcon(getClass().getResource("/bouton1.png"));
		ImageIcon fond = new ImageIcon(getClass().getResource("/fond.jpg"));
		String[] choix1 = {"Spawn aléatoire","Master kill"};
		JComboBox choix = new JComboBox(choix1);
	    JLabel fo = new JLabel();
	    this.add(choix);
	    choix.setBounds(0, 0, 220, 30);
	    choix.setVisible(true);
	    this.setIconImage(new ImageIcon(getClass().getResource("/logo.png")).getImage());
		setTitle(title);		
		this.setSize(1250, 700);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		fo.setIcon(fond);
		fo.setBounds(0, 0, getWidth(), getHeight());
		setResizable(true);
		setLocationRelativeTo(null);
		setVisible(true);		
		fo.setBounds(0, 0, getWidth(), getHeight());
		this.add(fo);
		fo.setVisible(true);
		this.setResizable(false);
 
		JButton b = new JButton();
		b.setBounds(0, 370, 300, 300);
		this.add(b);
		b.setIcon(bout);
merci.