Une interface qui ressemble à ceci? :lol:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FenetreMain
{
public static void main (String[] args)
{
FenetreImprimante fenetreImprimante = new FenetreImprimante();
}
}
class FenetreImprimante extends JFrame
{
JPanel jPanel = new JPanel();
GroupBox groupBox = new GroupBox("Imprimante", 510, 150);
JLabel jLabelNom = new JLabel("Nom :");
JComboBox jComboBoxImprimantes = new JComboBox();
JLabel jLabelEtat = new JLabel("Etat :");
JLabel jLabelValeurEtat = new JLabel();
JLabel jLabelType = new JLabel("Type :");
JLabel jLabelValeurType = new JLabel();
JLabel jLabelOu = new JLabel("Où :");
JLabel jLabelValeurOu = new JLabel();
JLabel jLabelCommentaire = new JLabel("Commentaire :");
JLabel jLabelValeurCommentaire = new JLabel();
JButton jButtonProprietes = new JButton("Propriétés...");
JButton jButtonRechImpr = new JButton("Rechercher une imprimante...");
JCheckBox jCheckBoxImprDansFichier = new JCheckBox("Imprimer dans un fichier");
JCheckBox jCheckBoxRectoVersoManuel = new JCheckBox("Recto Verso Manuel");
public FenetreImprimante()
{
setTitle("Imprimer");
setLocation(200, 200);
setSize(600, 230);
setLayout(null);
groupBox.setLayout(null);
groupBox.setBounds(45, 20, groupBox.sizeX, groupBox.sizeY);
jLabelNom.setBounds(10, 15, 100, 20);
jLabelEtat.setBounds(10, 45, 100, 20);
jLabelType.setBounds(10, 70, 100, 20);
jLabelOu.setBounds(10, 95, 100, 20);
jLabelCommentaire.setBounds(10, 120, 100, 20);
String[] imprimantes = new String[2];
imprimantes[0] = "imprimante 1";
imprimantes[1] = "imprimante 2";
jComboBoxImprimantes = new JComboBox(imprimantes);
jLabelValeurEtat.setFont(new Font("Arial", Font.PLAIN, 12));
jLabelValeurEtat.setText("Active et motivée");
jLabelValeurType.setFont(new Font("Arial", Font.PLAIN, 12));
jLabelValeurType.setText("Une imprimante en plastique");
jLabelValeurOu.setText("Ici ou là");
jLabelValeurOu.setFont(new Font("Arial", Font.PLAIN, 12));
jLabelValeurCommentaire.setText("bla bla bla");
jLabelValeurCommentaire.setFont(new Font("Arial", Font.PLAIN, 12));
jComboBoxImprimantes.setBounds(100, 15, 200, 20);
jLabelValeurEtat.setBounds(100, 45, 200, 20);
jLabelValeurType.setBounds(100, 70, 200, 20);
jLabelValeurOu.setBounds(100, 95, 200, 20);
jLabelValeurCommentaire.setBounds(100, 120, 200, 20);
jButtonProprietes.setBounds(330, 15, 170, 20);
jButtonRechImpr.setBounds(330, 50, 170, 20);
jCheckBoxImprDansFichier.setBounds(330, 90, 170, 20);
jCheckBoxRectoVersoManuel.setBounds(330, 120, 170, 20);
groupBox.add(jLabelNom);
groupBox.add(jLabelEtat);
groupBox.add(jLabelType);
groupBox.add(jLabelOu);
groupBox.add(jLabelCommentaire);
groupBox.add(jComboBoxImprimantes);
groupBox.add(jLabelValeurEtat);
groupBox.add(jLabelValeurType);
groupBox.add(jLabelValeurOu);
groupBox.add(jLabelValeurCommentaire);
groupBox.add(jButtonProprietes);
groupBox.add(jButtonRechImpr);
groupBox.add(jCheckBoxImprDansFichier);
groupBox.add(jCheckBoxRectoVersoManuel);
add(groupBox);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}
class GroupBox extends JPanel
{
int sizeX;
int sizeY;
String label;
int nbePaint = 0;
public GroupBox(String label_arg, int sizeX_arg, int sizeY_arg)
{
setLayout(null);
sizeX = sizeX_arg;
sizeY = sizeY_arg;
label = label_arg;
}
public void paint(Graphics g)
{
super.paint(g);
g.setColor(new Color(216, 210, 189));
g.drawLine(0, 5, sizeX, 5);
g.drawLine(sizeX, 10, sizeX, sizeY);
g.drawLine(sizeX , sizeY, 0, sizeY);
g.drawLine(0, sizeY, 0, 5);
g.setColor(new Color(255, 255, 255));
g.drawLine(1, 6, sizeX - 1, 6);
g.drawLine(sizeX - 1, 6, sizeX - 1, sizeY - 1);
g.drawLine(sizeX - 1, sizeY - 1, 1, sizeY - 1);
g.drawLine(1, sizeY - 1, 1, 6);
g.setColor(this.getBackground());
for (int i = 7; i < 14 ; i++)
{
g.drawString(label, i, 10);
}
g.setColor(new Color(33, 93, 198));
g.drawString(label, 10, 10);
}
}
Si tu as un soucis demande moi je t'aiderai
Bonne chance
Une interface qui ressemble à ceci? :lol:
Si tu as un soucis demande moi je t'aiderai
Bonne chance