<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6734956107283292312</id><updated>2024-12-04T12:58:53.766-08:00</updated><title type='text'>Attractive Java</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6734956107283292312.post-7691274601009194668</id><published>2011-03-09T16:36:00.000-08:00</published><updated>2011-03-09T16:36:35.906-08:00</updated><title type='text'>RIF JAVA USER GROUP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Je viens de mettre en place le site web pour &quot;RIF JAVA USER GROUP&quot;, que je rappel qu´il s´agit du premier JUG pour la communauté Rifine, dont le rôle principal est d´aider les gens dans le langage de programmation JAVA, des&amp;nbsp;séminaires&amp;nbsp;seront également organisés à côté des formations gratuites.&lt;br /&gt;
&lt;br /&gt;
Le site est accessible via le lien suivant :&amp;nbsp;&lt;a href=&quot;http://rifjug.kenai.com/&quot;&gt;http://rifjug.kenai.com&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
J´encourage les Rifins à rejoindre ce site communautaire, et d´y participer d´avantage.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/7691274601009194668/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://attractive-java.blogspot.com/2011/03/rif-java-user-group.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/7691274601009194668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/7691274601009194668'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/2011/03/rif-java-user-group.html' title='RIF JAVA USER GROUP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6734956107283292312.post-2640824004428054415</id><published>2010-12-28T23:29:00.000-08:00</published><updated>2010-12-28T23:29:16.775-08:00</updated><title type='text'>Tutoriels Android</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; font-weight: bold;&quot;&gt;&lt;a class=&quot;UIShareStage_InlineEdit inline_edit&quot; href=&quot;&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; color: black; cursor: pointer; display: inline; width: auto;&quot;&gt;Joyeux Noël à tous !&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 12px; font-weight: bold;&quot;&gt;&lt;a class=&quot;UIShareStage_InlineEdit inline_edit&quot; href=&quot;&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: #ffff99; background-image: initial; background-origin: initial; color: black; cursor: pointer; display: inline; text-decoration: underline; width: auto;&quot;&gt;&lt;/a&gt;&lt;/span&gt;Je suis penché ces&amp;nbsp;derniers&amp;nbsp;jours sur&amp;nbsp;l’écriture&amp;nbsp;d&#39;un tutoriel sur Android, l&#39;OS de Google pour les téléphones portables. Il s&#39;agit en fait un tutoriel pour les débutants, mais d&#39;autres tutoriels abordant des&amp;nbsp;techniques&amp;nbsp;plus avancées serons publiés dans un future proche.&lt;br /&gt;
&lt;br /&gt;
Je vous invite à me proposer quelques thèmes dont je vais écrire dessus.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;br /&gt;
&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/2640824004428054415/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://attractive-java.blogspot.com/2010/12/tutoriels-android.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/2640824004428054415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/2640824004428054415'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/2010/12/tutoriels-android.html' title='Tutoriels Android'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6734956107283292312.post-9010065660816482974</id><published>2010-12-25T18:33:00.000-08:00</published><updated>2010-12-26T09:01:59.775-08:00</updated><title type='text'>Je suis committer au projet Faceboard</title><content type='html'>Le 22/10/2010:&lt;br /&gt;
Je viens d&#39;être accepté par &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Nicolas Pihan&lt;/span&gt;&lt;/b&gt;&amp;nbsp;dans le projet &lt;u&gt;&lt;b&gt;Faceboard&lt;/b&gt;&lt;/u&gt;, il s&#39;agit d&#39;une application Java/Swing permettant de s&#39;interfacer avec &lt;b&gt;Facebook&lt;/b&gt;, sans besoin d&#39;y accéder par le biais d&#39;un Browser.&lt;br /&gt;
&lt;br /&gt;
Nous avons plein d&#39;idées, dont nous espérons de produire une application de très haute qualité,&amp;nbsp;notamment&amp;nbsp;l’intégration&amp;nbsp;de &lt;b&gt;&lt;u&gt;JavaFX&lt;/u&gt;&lt;/b&gt;, tout en le mixant avec les composants Swing, qui nous propose quelques effets, et surtout il y est ajouté un type de donnée nommé &lt;i style=&quot;background-color: yellow;&quot;&gt;Duration&lt;/i&gt;, visant à créer des variables temporelles&amp;nbsp;qui ont des valeurs de type &lt;i style=&quot;background-color: yellow;&quot;&gt;ms, s, m, et h&lt;/i&gt;,&amp;nbsp;servant&amp;nbsp;à&amp;nbsp;implémenter&amp;nbsp;les animations.&lt;br /&gt;
&lt;br /&gt;
Nous allons également, introduire le IoC par &lt;b&gt;&lt;u&gt;Google Guice&lt;/u&gt;&lt;/b&gt;, qui va nous permettre de développer une application&amp;nbsp;modulaire, et&amp;nbsp;pourquoi&amp;nbsp;pas du &lt;b&gt;&lt;u&gt;OSGi&lt;/u&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Bon, je vous invite à contribuer à cette application, qui va être une véritable école.</content><link rel='replies' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/9010065660816482974/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://attractive-java.blogspot.com/2010/12/je-suis-committer-au-projet-faceboard.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/9010065660816482974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/9010065660816482974'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/2010/12/je-suis-committer-au-projet-faceboard.html' title='Je suis committer au projet Faceboard'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6734956107283292312.post-1495197691404644630</id><published>2010-12-11T04:07:00.000-08:00</published><updated>2010-12-11T04:07:44.604-08:00</updated><title type='text'>iBatis dans un contexte multi-utilisateur grâce à la technique Optimistic locking</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Dans les logiciels en réseau, dont l&#39;utilisation est soumise à de nombreux utilisateurs l&#39;utilisant en même temps,&amp;nbsp;sauvant&amp;nbsp;le problème&amp;nbsp;d’accès&amp;nbsp;concurrent est&amp;nbsp;évoqué.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Dans cet article je vais vous montrer comment&amp;nbsp;implémenter&amp;nbsp;un tel&amp;nbsp;mécanisme&amp;nbsp;en iBatis, dont il n y a pas de standard comme le cas d&#39;hibernate, alors il faut&amp;nbsp;l’implémenter&amp;nbsp;par soit même comme suite :&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;ul style=&quot;list-style-image: initial; list-style-position: initial; list-style-type: disc; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 2.5em; padding-right: 2.5em; padding-top: 0px;&quot;&gt;&lt;li style=&quot;border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 21px;&quot;&gt;Implémenter&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 1.4;&quot;&gt;&amp;nbsp;son propre OptimisticLockException qui doit dérivé RuntimeException ou&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 21px;&quot;&gt;réutiliser&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 1.4;&quot;&gt;&amp;nbsp;celui du&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 21px;&quot;&gt;Package&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 1.4;&quot;&gt;&amp;nbsp;JPA : javax.persistence.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 1.4;&quot;&gt;Ajouter &lt;i&gt;une colonne nommée&amp;nbsp;version de type numérique non nulle&amp;nbsp;dans la table&lt;/i&gt; et&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 21px;&quot;&gt;définir&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 1.4;&quot;&gt;&amp;nbsp;sa &lt;b&gt;default value&lt;/b&gt; à 1.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 1.4; margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;&quot;&gt;Ajouter un &lt;i&gt;champs nommé version à la classe&lt;/i&gt; de type int.&lt;/li&gt;
&lt;li style=&quot;border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 1.4;&quot;&gt;Modifier l&#39;interface&amp;nbsp;DAO pour&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 21px;&quot;&gt;déclencher&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; line-height: 1.4;&quot;&gt;&amp;nbsp;une OptimisticLockException comme suite :&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;pre class=&quot;syntaxhighlighter  java&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;i&gt;public interface EntityDao {
           void createEntity(Entity entity);
           Entity selectEntryById(Long id);
           void updateEntity(Entity entity) &lt;/i&gt;&lt;i&gt;&lt;b&gt;throws OptimisticLockException&lt;/b&gt;&lt;/i&gt;&lt;i&gt;;
           void deleteEntity(Entity entity);
     }&lt;/i&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 1.4; list-style-image: initial; list-style-position: initial; list-style-type: disc; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 2.5em; padding-right: 2.5em; padding-top: 0px;&quot;&gt;&lt;li style=&quot;border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-color: initial; border-top-style: none; border-top-width: initial; border-width: initial; margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: arial, sans-serif; font-size: 16px; line-height: normal;&quot;&gt;Modifier la&amp;nbsp;classe&amp;nbsp;DAO pour traiter les champs version&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;public class EntityDaoImpl extends SqlMapClientDaoSupport implements EntityDao {

     @Override
     public void createEntity(final Entity entity) {
         getSqlMapClientTemplate().insert(&quot;insertEntity&quot;, entity);
         entity.setVersion(1);
     }


     @Override
     public Entity selectEntryById(final Long id) {
        return (Entity) getSqlMapClientTemplate().queryForObject(&quot;findEntityById&quot;, id);
     }


    @Override
    public void updateEntity(final Entity entity) &lt;/span&gt;&lt;b style=&quot;color: #cc0000;&quot;&gt;throws OptimisticLockException&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt; {
        &lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;final int oldVersion = entity.getVersion();
        final int newVersion = oldVersion + 1;

        final Map&lt;/span&gt;&lt;/i&gt;&lt;string, object=&quot;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt; params = new HashMap&lt;/span&gt;&lt;/i&gt;&lt;string, object=&quot;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;();
        params.put(&quot;entity&quot;, entity);
        params.put(&quot;oldVersion&quot;, oldVersion);
        params.put(&quot;newVersion&quot;, newVersion);

        int updateCount = getSqlMapClientTemplate().update(&quot;updateEntity&quot;, params);

        if (updateCount == 0) {
             &lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f1c232;&quot;&gt;throw new OptimisticLockException(&quot;Erreur lors de la mise à jour, un autre utilisateur est entrai de modifier cet enregistrement, veuillez valider vos modification plus tard&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/string,&gt;&lt;/string,&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f1c232;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: arial, sans-serif; font-size: 16px; font-style: normal; line-height: normal; white-space: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;string, object=&quot;&quot;&gt;&lt;string, object=&quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;        }

        entity.setVersion(newVersion);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;
    }


    @Override
    public void deleteEntity(Entity entity) {
        getSqlMapClientTemplate().delete(&quot;deleteEntity&quot;, entity);
    }
  }&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;
&lt;/span&gt;&lt;/string,&gt;&lt;/string,&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;ul style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 1.4; list-style-image: initial; list-style-position: initial; list-style-type: disc; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 2.5em; padding-right: 2.5em; padding-top: 0px;&quot;&gt;&lt;li style=&quot;border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-color: initial; border-top-style: none; border-top-width: initial; border-width: initial; margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;&quot;&gt;Modifier le fichier de configuration d&#39;iBatis&lt;/li&gt;
&lt;/ul&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;
&amp;lt;!DOCTYPE sqlMap PUBLIC &quot;-//ibatis.apache.org//DTD SQL Map 2.0//EN&quot; &quot;http://ibatis.apache.org/dtd/sql-map-2.dtd&quot;&amp;gt;
&amp;lt;sqlMap&amp;gt;

 &amp;lt;typeAlias alias=&quot;Entity&quot; type=&quot;votrePackage.domain.Entity&quot;/&amp;gt;

 &amp;lt;resultMap id=&quot;EntityMap&quot; class=&quot;Entity&quot;&amp;gt;
     &amp;lt;result column=&quot;id&quot; property=&quot;id&quot;/&amp;gt;
     &amp;lt;result column=&quot;value&quot; property=&quot;value&quot;/&amp;gt;
     &amp;lt;result column=&quot;version&quot; property=&quot;version&quot;/&amp;gt;
 &amp;lt;/resultMap&amp;gt;

 &amp;lt;insert id=&quot;insertEntity&quot; parameterClass=&quot;Entity&quot;&amp;gt;
     INSERT INTO entity (id, value, version) VALUES (#id#, #value#, 1)
 &amp;lt;/insert&amp;gt;

 &amp;lt;select id=&quot;findEntityById&quot; parameterClass=&quot;java.lang.Long&quot; resultClass=&quot;Entity&quot; resultMap=&quot;EntityMap&quot;&amp;gt;
         SELECT id, value, version FROM entity WHERE id=#value#
 &amp;lt;/select&amp;gt;

 &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #674ea7;&quot;&gt;&lt;b&gt;&amp;lt;update id=&quot;updateEntity&quot; parameterClass=&quot;java.util.Map&quot;&amp;gt;
     UPDATE entity
     SET
         value=#entity.value#
         version=#newVersion#
     WHERE
         id=#entity.id#
         AND version=#oldVersion#
 &amp;lt;/update&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;

 &amp;lt;delete id=&quot;deleteEntity&quot; parameterClass=&quot;Entity&quot;&amp;gt;
     DELETE FROM entity WHERE id=#id#
 &amp;lt;/delete&amp;gt;

&amp;lt;/sqlMap&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;Et voilà votre entité est prête à être utiliser dans un contexte multi urilisateur.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;N&#39;hésitez pas à me laisser vos commentaires.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/1495197691404644630/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://attractive-java.blogspot.com/2010/12/optimistic-locking-en-ibatis.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/1495197691404644630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/1495197691404644630'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/2010/12/optimistic-locking-en-ibatis.html' title='iBatis dans un contexte multi-utilisateur grâce à la technique Optimistic locking'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6734956107283292312.post-3940770204533588862</id><published>2010-12-11T03:25:00.000-08:00</published><updated>2010-12-11T04:02:25.614-08:00</updated><title type='text'>Attractive JTable</title><content type='html'>Dans le présent article je vais vous montrer comment créer une JTable totalement attractive (jolie).&lt;br /&gt;
Dans un premier temps, vous devez&amp;nbsp;récrire&amp;nbsp;votre &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;DefaultTableCellRenderer&lt;/span&gt;&lt;/b&gt; qui est le responsable d&#39;afficher les lignes de notre JTable bel et bien nous somble, d&#39;y ajouter des bouton, des JComponents, des images ...&lt;br /&gt;
&lt;br /&gt;
Alors dans un premier temps vous devez Copier/Coller le code suivant dans un fichier nommé&amp;nbsp;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;XTableCellRenderer&lt;/span&gt;&lt;/b&gt;&amp;nbsp;:&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import com.jgoodies.forms.factories.Borders;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import java.awt.Color;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import java.awt.Component;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import java.awt.Font;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import java.awt.Graphics;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import java.awt.Graphics2D;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import java.awt.LinearGradientPaint;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import javax.swing.JLabel;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import javax.swing.JTable;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import javax.swing.table.DefaultTableCellRenderer;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;import javax.swing.table.TableCellRenderer;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;* @author Arafat Bouchafra&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;* @Date 1 sept. 2010&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;* @Time 01:23:40&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;public class XTableCellRenderer extends DefaultTableCellRenderer {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private JLabel renderer;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private boolean left, right;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public XTableCellRenderer(boolean left, boolean right) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.left = left;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.right = right;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Override&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, final int row, int column) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (renderer == null) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer = new JLabel() {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@Override&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;protected void paintComponent(Graphics g) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Graphics2D g2d = (Graphics2D) g.create();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Boolean selected = (Boolean) getClientProperty(&quot;table.selected&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if ((selected != null) &amp;amp;&amp;amp; (selected.booleanValue())) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;g2d.setPaint(new LinearGradientPaint(0, 0, 0, getHeight(),&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new float[]{0f, 0.48f, 0.481f, 1f},&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new Color[]{new Color(135, 155, 187), new Color(35, 77, 145), new Color(6, 47, 117), new Color(31, 66, 131)}));&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} else {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Integer row = (Integer) getClientProperty(&quot;table.row&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (row == null) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;row = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Color c = (row % 2 == 0) ? new Color(98, 100, 99) : new Color(83, 85, 84);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;g2d.setColor(c);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;g2d.fillRect(0, 0, getWidth(), getHeight());&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (left) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;g2d.setColor(new Color(148, 148, 146));&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;g2d.drawLine(0, 0, 0, getHeight());&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;g2d.dispose();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super.paintComponent(g);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.setFont(new Font(&quot;Arial&quot;, Font.PLAIN, 10));&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.setForeground(Color.WHITE);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.setBorder(Borders.DLU4_BORDER);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.setOpaque(false);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.putClientProperty(&quot;table.selected&quot;, isSelected);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.putClientProperty(&quot;table.row&quot;, row);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (value != null) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.setText(value.toString());&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} else {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;renderer.setText(&quot;&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return renderer;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Vous aurez impérativement besoin de télécharger le jar forms depuis&amp;nbsp;&lt;a href=&quot;http://www.jgoodies.com/download/libraries/forms/forms-1_3_0.zip&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta; font-size: large;&quot;&gt;ici&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;, puis au niveau de votre table utiliser le code suivant :&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt; &amp;nbsp; &amp;nbsp;table = new JTable(model);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; table.getColumnCount(); i++) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;final boolean left = (i &amp;gt; 0);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;final boolean right = (i &amp;lt; table.getColumnCount() - 1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;&lt;i&gt;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;table.getColumnModel().getColumn(i).setCellRenderer(new XTableCellRenderer(left, right));&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setShowGrid(false);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setRowHeight(20);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setRowMargin(0);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setIntercellSpacing(new Dimension(0, 0));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setGridColor(Color.BLACK);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//tcol = table.getColumnModel().getColumn(3);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//tcol.setCellRenderer(new MyTableCellRenderer());&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setBackground(Color.darkGray);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setForeground(Color.white);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setSelectionBackground(new Color(0x54A4DE));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setSelectionForeground(Color.white);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setOpaque(false);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.setFont(new Font(&quot;Helvana&quot;, Font.BOLD, 12));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;table.addMouseListener(new MouseAdapter() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@Override&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void mouseClicked(MouseEvent e) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// TODO Auto-generated method stub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//if(e.getClickCount() == 2)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mouseDoubleClicked(e);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;scroll = new JScrollPane();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;scroll.getViewport().setOpaque(false);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;scroll.getViewport().setView(table);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;scroll.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 6, 1));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;scroll.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;scroll.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;scroll.setOpaque(false);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;scroll.setViewportView(table);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;N&#39;oubliez pas de me laisser vos commentaires si quelque chose ne marche pas !&lt;br /&gt;
&lt;br /&gt;
Finalement je remercie ceux qui ont&amp;nbsp;attendu&amp;nbsp;la publication de cet article, et je leurs demandes de m&#39;excuser ;-)&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/3940770204533588862/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://attractive-java.blogspot.com/2010/12/attractive-jtable.html#comment-form' title='4 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/3940770204533588862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/3940770204533588862'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/2010/12/attractive-jtable.html' title='Attractive JTable'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6734956107283292312.post-1999075789291412324</id><published>2010-12-04T22:28:00.000-08:00</published><updated>2010-12-04T22:51:10.109-08:00</updated><title type='text'>Lancement du RIF Java User Group</title><content type='html'>Je viens de lancer le projet RIF Java User Group, qui aura comme objectif d&#39;encadrer les programmeur Rifin dans le cadre de développement d&#39;application en Java, il&amp;nbsp;contiendra&amp;nbsp;des articles, des tutoriels, des exemples, voir même des webcast, en essayera d&#39;organiser des conférence, des&amp;nbsp;séminaires, et des&amp;nbsp;compétitions.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9cKWCgBdL4Sj7hiXQb7Dx1WVUeCHFbwBuEc1kv88w8n7GhgBBsJC5Em9m_MUbgfT0271hMfzK38krSGRPkPTGdHvQ2ZqjVR93pIvVbuvbaZXzDIFetZL-zG-NcUv4hhai4vEy4t9-Ry6t/s1600/Rif+JUG+copy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9cKWCgBdL4Sj7hiXQb7Dx1WVUeCHFbwBuEc1kv88w8n7GhgBBsJC5Em9m_MUbgfT0271hMfzK38krSGRPkPTGdHvQ2ZqjVR93pIvVbuvbaZXzDIFetZL-zG-NcUv4hhai4vEy4t9-Ry6t/s320/Rif+JUG+copy.png&quot; width=&quot;268&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Voici le lien :&amp;nbsp;&lt;a href=&quot;http://kenai.com/projects/rifjug/&quot;&gt;http://kenai.com/projects/rifjug/&lt;/a&gt;, ou bien ici&amp;nbsp;&lt;a href=&quot;http://rifjug.kenai.com/&quot;&gt;http://rifjug.kenai.com/&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/1999075789291412324/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://attractive-java.blogspot.com/2010/12/lancement-du-rif-java-user-group.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/1999075789291412324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/1999075789291412324'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/2010/12/lancement-du-rif-java-user-group.html' title='Lancement du RIF Java User Group'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9cKWCgBdL4Sj7hiXQb7Dx1WVUeCHFbwBuEc1kv88w8n7GhgBBsJC5Em9m_MUbgfT0271hMfzK38krSGRPkPTGdHvQ2ZqjVR93pIvVbuvbaZXzDIFetZL-zG-NcUv4hhai4vEy4t9-Ry6t/s72-c/Rif+JUG+copy.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6734956107283292312.post-1648056941638218109</id><published>2010-12-03T02:00:00.000-08:00</published><updated>2010-12-03T03:03:57.749-08:00</updated><title type='text'>Créer des GUI en Swing totalement découplés par Spring IoC</title><content type='html'>&lt;div style=&quot;font-family: sans-serif;&quot;&gt;Les possibiltés offertes par le Framework Spring dans le cadre de développement des applications Swing sont peut&amp;nbsp;mises en évidence, comparaiment à celles du web. Que ce qu&#39;offre Spring dans ce contexte ? Nous allons dans ce tutoriel voir un exemple concret étape par étape, et ainsi en déduire notre conclusion.&lt;/div&gt;&lt;div style=&quot;font-family: sans-serif;&quot;&gt;Jetons un coup d&#39;oeil &amp;nbsp;sur la structure finale de notre application :&lt;/div&gt;&lt;div style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwYTsP9762VHHGjFSW6FsAWAcez2evLU_cUCeKC_WQ-wFYAvJl93Uy5RfJrTwHlLcIqvQz8h-_0_1i4ONVd6BFBk3CFK_MTVPcVym_fhGEXqsvN5QVuagXWKx3I7NLvRNkXaEDkq0gAbCt/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwYTsP9762VHHGjFSW6FsAWAcez2evLU_cUCeKC_WQ-wFYAvJl93Uy5RfJrTwHlLcIqvQz8h-_0_1i4ONVd6BFBk3CFK_MTVPcVym_fhGEXqsvN5QVuagXWKx3I7NLvRNkXaEDkq0gAbCt/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Comme vous pouvez le constater nous utilisons la bibliothèque spring-2.5.jar que vous pouvez télécharger depuis le site web : www.springsource.org, ainsi que commons-loggin.jar qui va servir pour les logs. Notez aussi&amp;nbsp;l’existence&amp;nbsp;de quelques composants Swing ordinaires tel que : JButton, JTextField, JPanel et bien sûr JFrame, nous avons aussi un ActionListener qui va être ajouté à notre bouton. Chacune des classes commençant par &lt;/span&gt;&lt;b style=&quot;font-family: sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;My&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt; hérite d&#39;un composant Swing, donc rien de spécial, sauf les deux fichiers &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta;&quot;&gt;SpringLauncher.java&lt;/span&gt; qui va servir pour lancer notre application en utilisant des classes spécifique à Spring en appelant le fichier de configuration &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta;&quot;&gt;app-context.xml&lt;/span&gt;. Au démarrage notre application aura&amp;nbsp;l’aspect&amp;nbsp;suivant :&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6UbB-Q0riBoBVseg0XYlbSeiEathbAGtmoaYXME28tq2RsddEFCNffWQEEZ1NVGoOydE8ljzBNyuUUKccHA7L7UAb6jws8rd58Y2rqH5naNXsNTcdvrQ0jBxrj8nrg8nGnmVBJVkJEU7f/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6UbB-Q0riBoBVseg0XYlbSeiEathbAGtmoaYXME28tq2RsddEFCNffWQEEZ1NVGoOydE8ljzBNyuUUKccHA7L7UAb6jws8rd58Y2rqH5naNXsNTcdvrQ0jBxrj8nrg8nGnmVBJVkJEU7f/s1600/2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;C&#39;est un résultat&amp;nbsp;pertinent. Les composant Swing ne font aucune chose de spécial. Le point ici est d&#39;ajouter tout simplement des composant Swing à l&#39;application sans ajouter aucun code java le rendant possible. Normalement à&amp;nbsp;l’absence de Spring&amp;nbsp;sa doit être fait avec du code Java, en ajoutant le JPanel à JFrame&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;à l&#39;aide de la méthode &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;add&lt;/span&gt;&lt;/b&gt;, &amp;nbsp;et d&#39;ajouter JButton, JTextField au JPanel de la même manière.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;Dans notre cas nous ne procéderons pas ainsi. En fait aucune classe&amp;nbsp;n’appellera&amp;nbsp;l&#39;autre, elles sont toutes indépendant, elles sont découplées, dont voici le code de MyJFrame :&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;package springSwinging;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import java.awt.Dimension;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import javax.swing.JFrame;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @author Arafat Bouchafra&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Date &amp;nbsp; 2 déc. 2010&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Time &amp;nbsp; 03:00:34&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;public class MyJFrame extends JFrame {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void init() {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;java.awt.EventQueue.invokeLater(new Runnable() {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void run() {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;setSize(new Dimension(300, 300));&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;setVisible(true);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Les autres classes sont similaires, ne délivrons que le code spécifique à chaque composant Swing définissant.&amp;nbsp;L’évènement&amp;nbsp;ActionListener est découplé, l&#39;ActionListener n&#39;est pas ajouté à JButton dans le code Java de la classe ci-dessous. toutes les classes sont isolées, séparées, et rendues&amp;nbsp;indépendantes.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Ceci est possible grâce à la présence des JARs Spring dans la classpath, ensembles(les JARs) avec la classe&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta; font-family: sans-serif;&quot;&gt;SpringLauncher.java&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;qui cherche le fichier de configuration Spring&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta; font-family: sans-serif;&quot;&gt;app-context.xml&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;qui définie comme suite :&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6Pl6sdA__hqigKVw0-wnQSgNQTOgIvttRGjg0dejMgUX56ZCkCt5A4f_3LJrlEzOAPc6UHawCMuj8GAvUmHTG6yRS_5AOShO9a5V_mUrcFbALE1tkPou7LW_0d_uh01iUtzlQHcwS6sVV/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6Pl6sdA__hqigKVw0-wnQSgNQTOgIvttRGjg0dejMgUX56ZCkCt5A4f_3LJrlEzOAPc6UHawCMuj8GAvUmHTG6yRS_5AOShO9a5V_mUrcFbALE1tkPou7LW_0d_uh01iUtzlQHcwS6sVV/s1600/3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Après les six premières lignes, qui sont l&#39;en-tête de notre fichier de configuration, voici la&amp;nbsp;description&amp;nbsp;détaillée de chaque&amp;nbsp;élément:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;Lignes 8-15&lt;/b&gt;:&amp;nbsp;définisses la classe MyJFrame, en spécifiant sa&amp;nbsp;propriété&quot;&lt;i&gt;title&lt;/i&gt;&quot; et sa&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;propriété&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&quot;&lt;i&gt;contentPane&lt;/i&gt;&quot;. Notez la définition de l&#39;attribut &quot;&lt;i&gt;init-method&lt;/i&gt;&quot;, dont la valeur est le nom la méthode &quot;&lt;i&gt;init&lt;/i&gt;&quot; de la classe MyJFrame que nous utiliserons pour l&#39;instanciation de la classe.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;Lignes&lt;/b&gt; &lt;b&gt;17-26&lt;/b&gt;:&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Définisse le&lt;i&gt; &lt;u&gt;mainPanel&lt;/u&gt;&lt;/i&gt;, qui va contenir deux JTextField et une autre instance de lui nommée &lt;i&gt;&lt;u&gt;buttonPanel&lt;/u&gt;&lt;/i&gt;, définie dans les &lt;b&gt;lignes&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;28-35&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;. Nous fixons aussi la&amp;nbsp;propriété&amp;nbsp;nommée &quot;axis&quot; et &amp;nbsp;la&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;pr&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;opriété nommée &quot;panelComponents&quot;. Les deux panels sont construits à partir de la classe JPanel. Le premier d&#39;entre eux est utilisé afin de définir sa propriété &quot;&lt;i&gt;axis&lt;/i&gt;&quot; du layout utilisé par la classes MyJPanel qui un BoxLayout. En revanche la&amp;nbsp;propriété&amp;nbsp;&quot;&lt;i&gt;panelComponents&lt;/i&gt;&quot; va être remplié par nos trois composant Swing à savoir les deux JTextField et le buttonPanel. Un iterator dans la classe MyJPanel va bouclé autour des composant reçu, en les y ajoutant. Tout ça aura lieu dans la méthode &quot;&lt;i&gt;init&lt;/i&gt;&quot;, qui est définie comme valeur de l&#39;attribut &quot;&lt;i&gt;init-method&lt;/i&gt;&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;Lignes&lt;/b&gt; &lt;b&gt;28-35&lt;/b&gt;:&amp;nbsp;Définisses le panel du bas qui contient seulement la classes MyJButton. Notez que ce panel est définit par la même classes définissant le mainPanel. Donc nous&amp;nbsp;réutilisons&amp;nbsp;la classe MyJPanel par le biais du fichier de configuration Spring.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;Ligne&lt;/b&gt; &lt;b&gt;37&lt;/b&gt;:&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Définie le premier JTextField.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;Ligne&lt;/b&gt; &lt;b&gt;38&lt;/b&gt;: Définie le deuxième JTextField.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;Lignes 40-47&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: sans-serif;&quot;&gt;:&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;Définisses&amp;nbsp;&amp;nbsp;le JButton, avec ses deux&amp;nbsp;propriétés&amp;nbsp; &quot;&lt;/span&gt;&lt;i style=&quot;font-family: sans-serif;&quot;&gt;text&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&quot; et &quot;&lt;/span&gt;&lt;i style=&quot;font-family: sans-serif;&quot;&gt;actionListener&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&quot;. Notez que nous n&#39;avons pas&amp;nbsp;définit&amp;nbsp;les propriétés &quot;text&quot; des JTextFields que nous pouvons le faire. Vous pouvez définir la propriété &quot;&lt;i&gt;text&lt;/i&gt;&quot; et les autres dans le fichier de configuration Spring,le choix est le votre.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;b&gt;Ligne 49:&lt;/b&gt;&amp;nbsp;Définie l&#39;ActionListener.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Voici le fichier de configuration complet qui est&amp;nbsp;facile&amp;nbsp;à lire, pas de grandes surprises. Maintenant voyant à quoi ces classes ressembles exactement. Le code source de la classe MyJFrame a été montrer ci-haut. voici le code source des autres classes&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;package springSwinging;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import java.awt.Component;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import java.util.Iterator;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import java.util.List;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import javax.swing.BoxLayout;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import javax.swing.JPanel;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @author Arafat Bouchafra&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Date &amp;nbsp; 2 déc. 2010&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Time &amp;nbsp; 03:09:26&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;public class MyJPanel extends JPanel {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private List panelComponents;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private int axis;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setAxis(int axis) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.axis = axis;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setPanelComponents(List panelComponents) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.panelComponents = panelComponents;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void init() {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;setLayout(new BoxLayout(this, axis));&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (Iterator iter = panelComponents.iterator(); iter.hasNext();) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Component component = (Component) iter.next();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add(component);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;package springSwinging;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import javax.swing.JTextField;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @author Arafat Bouchafra&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Date &amp;nbsp; 2 déc. 2010&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Time &amp;nbsp; 03:10:58&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;public class MyJTextField extends JTextField {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void init() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;setText(&quot;hello world&quot;);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;package springSwinging;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import java.awt.event.ActionListener;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import javax.swing.JButton;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @author Arafat Bouchafra&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Date &amp;nbsp; 2 déc. 2010&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Time &amp;nbsp; 03:11:32&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;public class MyJButton extends JButton {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private ActionListener actionListener;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setActionListener(ActionListener actionListener) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.actionListener = actionListener;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void init() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.addActionListener(actionListener);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;package springSwinging;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import java.awt.event.ActionEvent;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import java.awt.event.ActionListener;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import javax.swing.JOptionPane;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @author Arafat Bouchafra&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Date &amp;nbsp; 2 déc. 2010&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Time &amp;nbsp; 03:12:22&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;public class MyActionListener implements ActionListener {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void actionPerformed(ActionEvent e) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JOptionPane.showMessageDialog(null, &quot;Hello from Spring!&quot;);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Nous avons ajouté un ActionListener à MyJButton, mais nous n&#39;avons pas spécifié &lt;b&gt;lequel&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;. Pour changer l&#39;ActionListener, modifiez seulement la &lt;b&gt;ligne 49&lt;/b&gt; du fichier de configuration Spring. Changez seulement l&#39;attribut &quot;&lt;i&gt;classname&lt;/i&gt;&quot; vers un autre ActionListener que vous devez définir. Clairement, il n&#39;y a pas de code Java connectant la classe &quot;MyActionListener&quot; à la classe &quot;MyJButton&quot;. Similairement, il n&#39;y a pas de code Java connectant les composants Swing entre eux. De point de vue utilisateur final, il n&#39;y a pas de difference. Mais de point de vue développeur, toutes les connexions entres les composants seront faites dans le fichier de configuration Spring, et voir même entre composants et leurs actions (MyJButton et MyActionListener) .&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Finalement, jetons un coup d&#39;oeil sur la classe&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta; font-family: sans-serif;&quot;&gt;SpringLauncher.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;, qui utilise un code spécifique à Spring:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;package springSwinging;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;import org.springframework.context.support.ClassPathXmlApplicationContext;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @author Arafat Bouchafra&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Date &amp;nbsp; 2 déc. 2010&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;* @Time &amp;nbsp; 03:12:59&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;public class SpringLauncher {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String[] contextPaths = new String[]{&quot;app-context.xml&quot;};&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new ClassPathXmlApplicationContext(contextPaths);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;Maintenant, que est ce nous avons gagné? Est ce que Spring encourage vraiment une désintégration des composants Swing à ce bas niveau? Pas nécessairement , mais possible. Le point est, vous pouvez détacher autant que vous voulez. Tout dans la même application. Mais pourqoui faire ça ? Maintenant que nous avons compris le QUOI, allons voire le POURQUOI. Il y a pas mal de livre traitant le POURQUOI. le POURQUOI est &quot;&lt;a href=&quot;http://martinfowler.com/articles/injection.html&quot; style=&quot;color: black;&quot;&gt;dependency injection&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;print-footnote&quot; style=&quot;font-size: xx-small;&quot;&gt;[1]&lt;/span&gt;&quot;(l&#39;injection de dépendences) et &lt;i&gt;&quot;loose coupling&lt;/i&gt;&quot; (Accouplement desserré(libre)). Un bon avantage est celui là, Parce que vos composants sont vraiment séparés l&#39;un de l&#39;autre,il est facile de les tester. Vos tests de JUNIT (ou d&#39;autres tests) seront plus faciles à écrire parce qu&#39;il n&#39;y a aucune gêne d&#39;une classe à une autre. Aussi, en ce qui concerne le code de plomberie, c&#39;est-à-dire, le câblage(le wiring), que deviez-vous&amp;nbsp;normalement maintenir(entretenir)? Tout cela est maintenu dans le fichier de configuration Spring; Aucun de cela n&#39;est dans le code Java. Notez aussi que le fichier de configuration Spring est non-envahissant. Vous pouvez simplement le glisser dans une application existante, Écrivez un bean pour la classe principale et ajoutez ensuite le code du lanceur.&amp;nbsp;Alors vous êtes bon pour &amp;nbsp;y aller. Ainsi, l&#39;intégration avec vos applications Swing existantes peut arriver sans vous ayant besoin de changer ces classes existantes, à moins que vous ne vouliez faire, ça c&#39;est une autre chose.&lt;br /&gt;
&lt;br /&gt;
Finalement, regardant de nouveau notre JPanel. C&#39;est un composant Swing réutilisable (comme les autres composants Swing utilisés ici, comme le JTextField, que vous avez réutilisé aussi). Vous l&#39;avez utilisé deux fois dans la même application, pour des buts différents. A chaque fois, vous avez beaucoup de composant sur le layout du JPanel,&amp;nbsp;depuis le fichier de configuration Spring, bien que vous utilisiez le même JPanel, son contenu pourrait être différent chaque fois vous le réutilisez. Encore, notez l&#39;utilisation de la liste générique d&#39;objets ici. Au lieu de spécifier un composant Swing particulier, qui aurait fait le JPanel moins réutilisable,&amp;nbsp;nous avons opté pour une liste générique d&#39;objets&amp;nbsp;pour que nous ne serons&amp;nbsp;pas&amp;nbsp;limités par les composants qu&#39;elle peut manipulée. Ce qu&#39;il faut prendre en considération en créant des composants Swing détachés est, en travaillant d&#39;une façon détachée a un impact sur votre processus de design.&lt;br /&gt;
&lt;br /&gt;
J&#39;espère que cela sert d&#39;une introduction utile à Spring Framework dans le contexte de Swing.&lt;br /&gt;
&lt;br /&gt;
Dans le prochain tutoriel, Nous allons utilisé un autre Framework de IoC, cette fois ci, il s&#39;agit de Google Guice, nous allons introduire le principe de module.&lt;br /&gt;
&lt;br /&gt;
N&#39;hésitez pas à nous écrire, faire vos remarque ;-)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://attractive-java.blogspot.com/feeds/1648056941638218109/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://attractive-java.blogspot.com/2010/12/creer-des-gui-en-swing-totalement.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/1648056941638218109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6734956107283292312/posts/default/1648056941638218109'/><link rel='alternate' type='text/html' href='http://attractive-java.blogspot.com/2010/12/creer-des-gui-en-swing-totalement.html' title='Créer des GUI en Swing totalement découplés par Spring IoC'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwYTsP9762VHHGjFSW6FsAWAcez2evLU_cUCeKC_WQ-wFYAvJl93Uy5RfJrTwHlLcIqvQz8h-_0_1i4ONVd6BFBk3CFK_MTVPcVym_fhGEXqsvN5QVuagXWKx3I7NLvRNkXaEDkq0gAbCt/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>