Ajout d'une toolbar
This commit is contained in:
123
AppThinker/src/AppThinkerToolbar.java
Normal file
123
AppThinker/src/AppThinkerToolbar.java
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class AppThinkerToolbar extends JPanel {
|
||||||
|
/**
|
||||||
|
* Constructeur de la classe AppThinkerToolbar
|
||||||
|
* @author V.BOULANGER
|
||||||
|
*/
|
||||||
|
public AppThinkerToolbar(){
|
||||||
|
//Création de la Toolbar
|
||||||
|
this.setLayout(new GridLayout(2,3, 10, 0));
|
||||||
|
this.setBackground(new Color(69, 69, 72));
|
||||||
|
|
||||||
|
JPanel projectPanel = new JPanel();
|
||||||
|
projectPanel.setLayout(new GridLayout(1,4));
|
||||||
|
JButton newProject = new JButton();
|
||||||
|
newProject.setSize(32, 32);
|
||||||
|
newProject.setBorderPainted(false);
|
||||||
|
newProject.setIcon(new ImageIcon(getClass().getResource("img/x32/newProject.png")));
|
||||||
|
newProject.setToolTipText("Créer un nouveau projet.");
|
||||||
|
projectPanel.add(newProject);
|
||||||
|
JButton openProject = new JButton();
|
||||||
|
openProject.setSize(32, 32);
|
||||||
|
openProject.setBorderPainted(false);
|
||||||
|
openProject.setIcon(new ImageIcon(getClass().getResource("img/x32/importProject.png")));
|
||||||
|
openProject.setToolTipText("Importer un projet existant.");
|
||||||
|
projectPanel.add(openProject);
|
||||||
|
JButton saveProject = new JButton();
|
||||||
|
saveProject.setSize(32, 32);
|
||||||
|
saveProject.setBorderPainted(false);
|
||||||
|
saveProject.setIcon(new ImageIcon(getClass().getResource("img/x32/saveProject.png")));
|
||||||
|
saveProject.setToolTipText("Sauvegarder le projet.");
|
||||||
|
projectPanel.add(saveProject);
|
||||||
|
JButton saveAsProject = new JButton();
|
||||||
|
saveAsProject.setSize(32, 32);
|
||||||
|
saveAsProject.setBorderPainted(false);
|
||||||
|
saveAsProject.setIcon(new ImageIcon(getClass().getResource("img/x32/saveAsProject.png")));
|
||||||
|
saveAsProject.setToolTipText("Sauvegarder le projet à un autre endroit.");
|
||||||
|
projectPanel.add(saveAsProject);
|
||||||
|
|
||||||
|
JPanel editionPanel = new JPanel();
|
||||||
|
editionPanel.setLayout(new GridLayout(1,7));
|
||||||
|
JButton select = new JButton();
|
||||||
|
select.setSize(32, 32);
|
||||||
|
select.setBorderPainted(false);
|
||||||
|
select.setIcon(new ImageIcon(getClass().getResource("img/x32/select.png")));
|
||||||
|
select.setToolTipText("Sélectionner un élément.");
|
||||||
|
editionPanel.add(select);
|
||||||
|
JButton edit = new JButton();
|
||||||
|
edit.setSize(32, 32);
|
||||||
|
edit.setBorderPainted(false);
|
||||||
|
edit.setIcon(new ImageIcon(getClass().getResource("img/x32/edit.png")));
|
||||||
|
edit.setToolTipText("Éditer les propriétés d'un élément.");
|
||||||
|
editionPanel.add(edit);
|
||||||
|
JButton delete = new JButton();
|
||||||
|
delete.setSize(32, 32);
|
||||||
|
delete.setBorderPainted(false);
|
||||||
|
delete.setIcon(new ImageIcon(getClass().getResource("img/x32/delete.png")));
|
||||||
|
delete.setToolTipText("Supprimer un élément.");
|
||||||
|
editionPanel.add(delete);
|
||||||
|
JButton copy = new JButton();
|
||||||
|
copy.setSize(32, 32);
|
||||||
|
copy.setBorderPainted(false);
|
||||||
|
copy.setIcon(new ImageIcon(getClass().getResource("img/x32/copy.png")));
|
||||||
|
copy.setToolTipText("Copier un élément.");
|
||||||
|
editionPanel.add(copy);
|
||||||
|
JButton paste = new JButton();
|
||||||
|
paste.setSize(32, 32);
|
||||||
|
paste.setBorderPainted(false);
|
||||||
|
paste.setIcon(new ImageIcon(getClass().getResource("img/x32/paste.png")));
|
||||||
|
paste.setToolTipText("Coller un élément.");
|
||||||
|
editionPanel.add(paste);
|
||||||
|
JButton undo = new JButton();
|
||||||
|
undo.setSize(32, 32);
|
||||||
|
undo.setBorderPainted(false);
|
||||||
|
undo.setIcon(new ImageIcon(getClass().getResource("img/x32/undo.png")));
|
||||||
|
undo.setToolTipText("Annuler le dernier changement.");
|
||||||
|
editionPanel.add(undo);
|
||||||
|
JButton redo = new JButton();
|
||||||
|
redo.setSize(32, 32);
|
||||||
|
redo.setBorderPainted(false);
|
||||||
|
redo.setIcon(new ImageIcon(getClass().getResource("img/x32/redo.png")));
|
||||||
|
redo.setToolTipText("Rétablir le dernier changement annulé.");
|
||||||
|
editionPanel.add(redo);
|
||||||
|
|
||||||
|
JPanel modelisationPanel = new JPanel();
|
||||||
|
modelisationPanel.setLayout(new GridLayout(1,3));
|
||||||
|
JButton newClass = new JButton();
|
||||||
|
newClass.setSize(32, 32);
|
||||||
|
newClass.setBorderPainted(false);
|
||||||
|
newClass.setIcon(new ImageIcon(getClass().getResource("img/x32/newClass.png")));
|
||||||
|
newClass.setToolTipText("Ajouter une classe.");
|
||||||
|
modelisationPanel.add(newClass);
|
||||||
|
JButton newAssociation = new JButton();
|
||||||
|
newAssociation.setSize(32, 32);
|
||||||
|
newAssociation.setBorderPainted(false);
|
||||||
|
newAssociation.setIcon(new ImageIcon(getClass().getResource("img/x32/newAssociation.png")));
|
||||||
|
newAssociation.setToolTipText("Ajouter une association.");
|
||||||
|
modelisationPanel.add(newAssociation);
|
||||||
|
JButton newLink = new JButton();
|
||||||
|
newLink.setSize(32, 32);
|
||||||
|
newLink.setBorderPainted(false);
|
||||||
|
newLink.setIcon(new ImageIcon(getClass().getResource("img/x32/newLink.png")));
|
||||||
|
newLink.setToolTipText("Ajouter un lien.");
|
||||||
|
modelisationPanel.add(newLink);
|
||||||
|
|
||||||
|
this.add(projectPanel, BorderLayout.CENTER);
|
||||||
|
this.add(editionPanel, BorderLayout.CENTER);
|
||||||
|
this.add(modelisationPanel, BorderLayout.CENTER);
|
||||||
|
JLabel projectLabel = new JLabel("Projet");
|
||||||
|
projectLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
projectLabel.setForeground(Color.WHITE);
|
||||||
|
this.add(projectLabel);
|
||||||
|
JLabel editLabel = new JLabel("Édition");
|
||||||
|
editLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
editLabel.setForeground(Color.WHITE);
|
||||||
|
this.add(editLabel);
|
||||||
|
JLabel modelisationLabel = new JLabel("Modélisation");
|
||||||
|
modelisationLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
modelisationLabel.setForeground(Color.WHITE);
|
||||||
|
this.add(modelisationLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,12 +16,23 @@ public class AppThinkerWindow extends JFrame {
|
|||||||
try { img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png")); } catch (Exception ex) { }
|
try { img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png")); } catch (Exception ex) { }
|
||||||
this.setIconImage(img);
|
this.setIconImage(img);
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
this.setLocation(0, 0);
|
this.setLocationRelativeTo(null);
|
||||||
this.setSize(500, 500);
|
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
||||||
|
|
||||||
//Ajout du menu à la fenêtre
|
//Ajout du menu à la fenêtre
|
||||||
AppThinkerMenuBar menu = new AppThinkerMenuBar();
|
AppThinkerMenuBar menu = new AppThinkerMenuBar();
|
||||||
this.setJMenuBar(menu);
|
this.setJMenuBar(menu);
|
||||||
|
|
||||||
|
//Ajout de la toolbar à la fenêtre
|
||||||
|
AppThinkerToolbar toolbar = new AppThinkerToolbar();
|
||||||
|
this.add(toolbar, BorderLayout.NORTH);
|
||||||
|
|
||||||
|
//Ajout de la grille à la fenêtre
|
||||||
|
AppThinkerGrid grid = new AppThinkerGrid();
|
||||||
|
this.add(grid, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
//Ajout de la statusbar à la fenêtre
|
||||||
|
AppThinkerStatusbar statusbar = new AppThinkerStatusbar();
|
||||||
|
this.add(statusbar, BorderLayout.SOUTH);
|
||||||
|
this.pack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user