editeur.java
2.31 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package tp1;
import javax.swing.*;
import java.awt.*;
import java.util.concurrent.Flow;
public class editeur {
public static final int width = 1000;
public static final int height = 800;
public static void main(String[] args) {
JFrame win = new JFrame();
win.setSize( width, height);
win.setLocationRelativeTo(null);
FlowLayout toolBarLayout = new FlowLayout(FlowLayout.LEFT);
JPanel toolbar = new JPanel();
toolbar.setLayout(toolBarLayout);
JButton file = new JButton("Fichier");
JButton edit = new JButton("Edition");
JButton format = new JButton("Format");
toolbar.add(file);
toolbar.add(edit);
toolbar.add(format);
FlowLayout statusBarLayout = new FlowLayout(FlowLayout.LEFT);
JPanel statusBar = new JPanel();
statusBar.setLayout(statusBarLayout);
JLabel researchLabel = new JLabel("Rechercher :");
JTextField researchBar = new JTextField();
researchBar.setPreferredSize(new Dimension(200, 25));
JButton leftArrow = new JButton("<-");
JButton rightArrow = new JButton("->");
JButton overlineAll = new JButton("Tout surligner");
statusBar.add(researchLabel);
statusBar.add(researchBar);
statusBar.add(leftArrow);
statusBar.add(rightArrow);
statusBar.add(overlineAll);
JTextArea editor = new JTextArea();
JWindow menu = new JWindow();
menu.setLayout(new BoxLayout(menu.getContentPane(), BoxLayout.PAGE_AXIS));
menu.add(Box.createRigidArea(new Dimension(15, 0)));
menu.add(new JLabel("Nouveau"));
menu.add(new JLabel("Ouvrir"));
menu.add(new JLabel("Enregistrer"));
menu.add(new JLabel("Enregistrer sous"));
menu.add(new JSeparator());
menu.add(new JLabel("Mise en page "));
menu.add(new JLabel("imprimer"));
menu.add(new JSeparator());
menu.add(new JLabel("Quitter"));
win.add(toolbar, BorderLayout.NORTH);
win.add(editor);
win.add(statusBar, BorderLayout.SOUTH);
win.setVisible(true);
menu.setSize(210, 120);
menu.setLocation(win.getX()+5,win.getY()+file.getHeight()+40);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
menu.setVisible(true);
}
}