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
| package petroineosTools2;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class accueil {
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame fenestre = new JFrame();
fenestre.setTitle("PetroIneos Tools"); // Défini le titre de la fenêtre
fenestre.setSize(1500, 900); // Défini la taille de la fenêtre
fenestre.setLocationRelativeTo(null); // Place la fenêtre au centre
fenestre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Termine le processus avec clic sur croix rouge
fenestre.setResizable(false); //Empêche le redimensionnement de la fenêtre
fenestre.setVisible(true); // Rend la fenêtre visible
JPanel fond = new JPanel(); // Crée un JPanel
fond.setBackground(Color.DARK_GRAY); // Défini le couleur grise au JPanel
fenestre.setContentPane(fond); // Informe le JFrame que le JPanel est son content pane
accueil.initComponent();
}
private static void initComponent() {
Component icon = new JLabel(new ImageIcon("PetroineosTools.jpg"));
JPanel panIcon = new JPanel();
panIcon.setBackground(Color.DARK_GRAY);
panIcon.setLayout(new BorderLayout());
panIcon.add(icon);
}
} |
Partager