Tuto jtatoo

523 views

Published on

Un tutoriel pour prendre en main l'api Jtatoo afin d'améliorer vos ihm swing n'hésitez pas laissez des commentaires

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
523
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Tuto jtatoo

  1. 1. Cheick Ismael MAIGACheick.ismo@gmail.com 1Jtatoo : Api pour vos IHMIntroductionJtattoo se compose de plusieurs outils pour les applications Swing. Chacun dentre eux permet auxdéveloppeurs daméliorer leur application avec une excellente interface utilisateur. L’api permet demodifier les thèmes et d’ajouter des boutons close au jtabbePane et autre fonctionnalités.Téléchargement et installationTéléchargementlien : http://www.jtattoo.net/Download.htmlInstallationComme tout jar l’installation se fait par l’ajout de la librairie à partir du built path .Il existe plusieurméthode . Je vais vous présenter deux méthodes1èreméthode :Clic droit sur le projet built path add external archivesUne boite de dialogue s’ouvre et vous demande le chemin ou se situe le jar télécharger2èmeméthode :Cette méthode consiste a crée un user library. L’avantage de cette méthode est que vous n’auriezplus à aller cherche le jar eclipse s’aura d’office là ou chercherClic droit sur le projet built path addlibraries  user library (voir screenshots )
  2. 2. Cheick Ismael MAIGACheick.ismo@gmail.com 2
  3. 3. Cheick Ismael MAIGACheick.ismo@gmail.com 3Une fois fini votre api est prêt à être utiliserTPLe TP consiste a crée une petite application et tester les différentes thème que nous propose l’apiLes différents lookAndFeel proposés sont : acryl : "com.jtattoo.plaf.acryl.AcrylLookAndFeel" aero: "com.jtattoo.plaf.aero.AeroLookAndFeel" aluminium: "com.jtattoo.plaf.aluminium.AluminiumLookAndFeel" bernstein: "com.jtattoo.plaf.bernstein.BernsteinLookAndFeel" fast : "com.jtattoo.plaf.fast.FastLookAndFeel" graphite : "com.jtattoo.plaf.graphite.GraphiteLookAndFeel" hifi : "com.jtattoo.plaf.hifi.HiFiLookAndFeel" luna : "com.jtattoo.plaf.luna.LunaLookAndFeel" mcwin : "com.jtattoo.plaf.mcwin.McWinLookAndFeel" mint : "com.jtattoo.plaf.mint.MintLookAndFeel" noire : "com.jtattoo.plaf.noire.NoireLookAndFeel" smart : "com.jtattoo.plaf.smart.SmartLookAndFeel" texture: "com.jtattoo.plaf.texture.TextureLookAndFeel"Code source de l’appplicationpackage com.app.ihm;import java.awt.BorderLayout;import java.awt.EventQueue;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.GroupLayout;import javax.swing.GroupLayout.Alignment;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JTextArea;import javax.swing.LayoutStyle.ComponentPlacement;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;import javax.swing.border.EmptyBorder;import javax.swing.JToolBar;public class Myapp extends JFrame {private JPanel contentPane;private static UIManager ui;//servira modifier le thèmeprivate JTextArea textArea;/*** Launch the application.* @throws UnsupportedLookAndFeelException* @throws IllegalAccessException* @throws InstantiationException* @throws ClassNotFoundException*/
  4. 4. Cheick Ismael MAIGACheick.ismo@gmail.com 4/** pour modifier le look il suffi de changer la de faire* ui.setLookAndFeel(thème) thème sera changer* par exemple par com.jtattoo.plaf.aero.AeroLookAndFeel*/public static void main(String[] args) throws ClassNotFoundException, InstantiationException,IllegalAccessException, UnsupportedLookAndFeelException {//permet de modifier le thème//getUi().setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel");EventQueue.invokeLater(new Runnable() {public void run() {try {Myapp frame = new Myapp();frame.setVisible(true);} catch (Exception e) {e.printStackTrace();}}});}/*** Create the frame.*/public Myapp() {setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 450, 401);contentPane = new JPanel();contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));contentPane.setLayout(new BorderLayout(0, 0));setContentPane(contentPane);JPanel panel = new JPanel();contentPane.add(panel, BorderLayout.WEST);JButton btnNewButton = new JButton("acyrl");btnNewButton.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");textArea.setText("acryl");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace(); }}});JButton btnNewButton_1 = new JButton("aero");btnNewButton_1.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel");textArea.setText("aero");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();} }});JButton btnNewButton_2 = new JButton("aluminium");btnNewButton_2.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.aluminium.AluminiumLookAndFeel");textArea.setText("aluminium");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});JButton btnNewButton_3 = new JButton("bernstein");btnNewButton_3.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {
  5. 5. Cheick Ismael MAIGACheick.ismo@gmail.com 5getUi().setLookAndFeel("com.jtattoo.plaf.bernstein.BernsteinLookAndFeel");textArea.setText("bernstein");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});JButton btnNewButton_4 = new JButton("fast");btnNewButton_4.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.fast.FastLookAndFeel");textArea.setText("fast");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});JButton btnNewButton_5 = new JButton("graphite");btnNewButton_5.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel");textArea.setText("graphite");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});JButton btnNewButton_6 = new JButton("hifi");btnNewButton_6.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel");textArea.setText("hifi");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});JButton btnNewButton_7 = new JButton("luna");btnNewButton_7.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.luna.LunaLookAndFeel");textArea.setText("luna");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace(); }}});JButton btnNewButton_8 = new JButton("texture");btnNewButton_8.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {
  6. 6. Cheick Ismael MAIGACheick.ismo@gmail.com 6getUi().setLookAndFeel("com.jtattoo.plaf.texture.TextureLookAndFeel");textArea.setText("texture");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});JButton btnNewButton_9 = new JButton("noire");btnNewButton_9.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {try {getUi().setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel");textArea.setText("noire");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});JButton btnNewButton_10 = new JButton("smart");btnNewButton_10.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent arg0) {try {getUi().setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");textArea.setText("smart");} catch (ClassNotFoundException | InstantiationException| IllegalAccessException| UnsupportedLookAndFeelException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});GroupLayout gl_panel = new GroupLayout(panel);gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup().addContainerGap().addGroup(gl_panel.createParallelGroup(Alignment.TRAILING).addComponent(btnNewButton_8, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_7, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_6, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_2, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(btnNewButton_3, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_4, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_5, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_9, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_10, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton_1, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE).addComponent(btnNewButton, Alignment.LEADING,GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)).addContainerGap()));gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel.createSequentialGroup().addComponent(btnNewButton).addPreferredGap(ComponentPlacement.RELATED)
  7. 7. Cheick Ismael MAIGACheick.ismo@gmail.com 7.addComponent(btnNewButton_1).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnNewButton_2).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnNewButton_3).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnNewButton_4).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(btnNewButton_5).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnNewButton_6).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnNewButton_7).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(btnNewButton_8).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(btnNewButton_9).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnNewButton_10).addContainerGap(25, Short.MAX_VALUE)));panel.setLayout(gl_panel);JPanel panel_1 = new JPanel();contentPane.add(panel_1, BorderLayout.CENTER);textArea = new JTextArea();GroupLayout gl_panel_1 = new GroupLayout(panel_1);gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_1.createSequentialGroup().addContainerGap().addComponent(textArea, GroupLayout.DEFAULT_SIZE, 296,Short.MAX_VALUE).addGap(19)));gl_panel_1.setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_1.createSequentialGroup().addGap(38).addComponent(textArea, GroupLayout.DEFAULT_SIZE, 320,Short.MAX_VALUE).addContainerGap()));panel_1.setLayout(gl_panel_1);}public static UIManager getUi() {return ui;}public void setUi(UIManager ui) {this.ui = ui;}}Figure 1:Thème par défaut
  8. 8. Cheick Ismael MAIGACheick.ismo@gmail.com 8Screenshots de quelques lookAndFeels de JTatooFigure 2 Thème AcrylFigure 3 thème textureFigure 4 thème aero

×