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
|
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
@SuppressWarnings("serial")
class AfficheImage extends JPanel {
Image SpamIt;
AfficheImage(String s) {
SpamIt = getToolkit().getImage(s);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(SpamIt, 0, 0, getWidth(), getHeight(), this);
}
}
@SuppressWarnings("serial")
class Click extends JFrame {
JLabel labelAttempt;
public Click() {
setTitle("SPAM IT");
setContentPane(new AfficheImage("G:\\SpamIt.png"));
setSize(920, 600);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container mainContainer = getContentPane();
mainContainer.setLayout(null);
JLabel labelTimer = new JLabel("TIMER HERE ");
labelTimer.setFont(new Font("Verdana", 1, 10));
labelTimer.setForeground(Color.WHITE);
setLocationRelativeTo(null);
labelTimer.setSize(500, 500);
labelTimer.setLocation(10, 300);
labelAttempt = new JLabel("Cliquez ci-dessous pour démarrer");
labelAttempt.setFont(new Font("Verdana", 1, 10));
labelAttempt.setForeground(Color.WHITE);
labelAttempt.setSize(200, 20);
labelAttempt.setLocation(370, 200);
JButton button = new ClickCounterSpamIt();
button.setSize(350, 100);
button.setLocation(275, 235);
mainContainer.add(labelTimer);
mainContainer.add(labelAttempt);
mainContainer.add(button);
}
public static void main(String[] args) {
Click Game = new Click();
}
} |
Partager