APL/APL2.1/TP02/Contingences/Contingences.java

29 lines
986 B
Java
Raw Normal View History

2022-02-07 17:26:04 +01:00
import javax.swing.*;
import java.awt.*;
public class Contingences {
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(500, 300);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextField myTextField = new JTextField("Hello World!");
myTextField.setBackground(Color.GRAY);
myTextField.setForeground(new Color(0, 255, 0));
fenetre.add(myTextField, BorderLayout.SOUTH);
JTextArea myTextArea = new JTextArea("Hello World!");
myTextArea.setBackground(Color.BLACK);
myTextArea.setForeground(new Color(0, 255, 0));
myTextArea.setLineWrap(true);
JScrollPane myPane = new JScrollPane(myTextArea);
myPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
myPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
fenetre.add(myPane, BorderLayout.CENTER);
fenetre.setVisible(true);
}
}