import javax.swing.*; import java.awt.*; public class exo3 { public static void main(String[] args) { // un objet pour servir de fenetre JFrame fenetre = new JFrame(); // on configure la fenetre fenetre.setSize(1200, 1000); fenetre.setLocation(100, 100); fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // On crée un champ de texte JTextField champTexte = new JTextField("Zone de texte (faut écrire ici en gros)"); champTexte.setForeground(Color.green); /*ou new Color(255,255,255) */ champTexte.setBackground(Color.black); /*ou new Color(255,255,255) */ // On crée une zone de texte JTextArea zoneDeTexte = new JTextArea("Bonjour, veuillez écrire des trucs en dessous svp ! \n Pourquoi écrire un truc en bas ?\n La réponse est la suivante : \n Lorem Ipsum is simply dummy text of the printing and typesetting industry. \nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a \ngalley of type and scrambled it to make a type specimen book. \nIt has survived not only five centuries, \nbut also the leap into electronic typesetting, remaining essentially unchanged. \nIt was popularised in the 1960s with the release of Letraset sheets\n containing Lorem Ipsum passages, \nand more recently with desktop publishing software like Aldus\n PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever \nsince the 1500s, when an unknown\n printer took a galley of type and scrambled it to make a type specimen book. It has survived \nnot only five centuries, but also the leap into electronic \ntypesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem \nIpsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem \nIpsum is simply dummy text of the printing and typesetting industry. \nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \nIt has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the\n 1960s with the release of Letraset sheets\n containing Lorem Ipsum passages, and more recently \nwith desktop publishing software like Aldus PageMaker including \nversions of Lorem Ipsum. "); zoneDeTexte.setForeground(Color.green); /*ou new Color(255,255,255) */ zoneDeTexte.setBackground(new Color(153,153,153)); zoneDeTexte.setEditable(false); // on ajoute le composant dans la fenetre, au milieu fenetre.add(champTexte, BorderLayout.SOUTH); fenetre.add(zoneDeTexte, BorderLayout.NORTH); // et on montre le resultat fenetre.setVisible(true); } }