editeur.java 2.31 KB
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);
    }
}