29 lines
986 B
Java
29 lines
986 B
Java
|
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);
|
||
|
}
|
||
|
}
|