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
|
package fr.dinge;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class Main {
public static Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
public static int Swidth = (int)size.getWidth();
public static int Sheight = (int)size.getHeight();
public static void main(String[] main) {
Accueil.show();
}
}
class Accueil {
public static int width = 1100;
public static int height = 700;
private static int newX = 0;
private static int newY = 0;
private static int newwidth = 1100;
private static int newheight = 700;
public static void show() {
JFrame frame = new JFrame();
frame.setTitle("SH Project");
frame.setBounds((Main.Swidth/2-width/2), (Main.Sheight/2-height/2), width, height);
frame.setBackground(Color.WHITE);
JPanel Pfriend = Friends();
frame.add(Pfriend);
JPanel header = Header();
frame.add(header);
JPanel contenu = Contenu();
frame.add(contenu);
frame.setUndecorated(true);
frame.setResizable(false);
frame.setVisible(true);
}
private static JPanel Friends() {
int width = 250;
JPanel Panel = new JPanel();
Panel.setBounds(0, 0, width, newheight);
Panel.setBorder(null);
Panel.setBackground(Color.RED);
newX += width;
return Panel;
}
private static JPanel Header() {
int height = 100;
JPanel Panel = new JPanel();
Panel.setBounds(newX, newY, newwidth, height);
Panel.setBorder(null);
Panel.setBackground(Color.GREEN);
newheight -= height;
newY += height;
return Panel;
}
private static JPanel Contenu() {
JPanel Panel = new JPanel();
Panel.setBounds(newX, newY, newwidth, newheight);
Panel.setBackground(Color.BLUE);
Panel.add(new JTextField("Bonjour"));
return Panel;
}
} |
Partager