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
| package design;
import java.awt.Color;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Main {
static JFrame mClient;
static JPanel mMainPanel;
static JPanel mMenuPanel;
static ImagePanel mImageFond;
static ImagePanel mImageFondMenu;
public static void main(String[] args) {
mClient = new JFrame();
mImageFond = new ImagePanel();
mMainPanel = new JPanel();
mClient.setLayout(null);
mMainPanel.setLayout(null);
loadImage();
initializeParam();
initializeMainPanel();
initializeMenuPanel();
initializeConnexionPanel();
mClient.setVisible(true);
}
public static void initializeParam() {
mClient.setSize(1440, 860);
mClient.setLocationRelativeTo(null);
mClient.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void initializeMainPanel() {
mMainPanel.add(mImageFond);
mClient.setContentPane(mMainPanel);
}
public static void initializeMenuPanel() {
mMenuPanel = new JPanel();
mMenuPanel.setLayout(null);
mMenuPanel.setBounds(15, 15, 1395, 80);
mMenuPanel.setBackground(Color.white);
mClient.add(mMenuPanel);
}
public static void initializeConnexionPanel() {
mMenuPanel = new JPanel();
mMenuPanel.setLayout(null);
mMenuPanel.setBounds(400, 350, 600, 300);
mMenuPanel.setBackground(Color.white);
mClient.add(mMenuPanel);
}
public static void loadImage() {
BufferedImage img = null;
try {
img = ImageIO
.read(new File("ressource/client/background/fond.png"));
} catch (IOException e) {
}
mImageFond.setImage(img);
}
} |
Partager