Adding images for black and white desktop
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 13 Sep 2010 21:02:55 +0200
branchdesktop
changeset 261cf7e6b8259e1
parent 260 8ebffb5aa10e
child 262 6427ae4c4ef2
Adding images for black and white
desktop/desktop-sample/src/main/java/cz/xelfi/quoridor/desktop/sample/KukTopComponent.form
desktop/desktop-sample/src/main/java/cz/xelfi/quoridor/desktop/sample/KukTopComponent.java
desktop/desktop-sample/src/main/resources/cz/xelfi/quoridor/desktop/sample/Bundle.properties
desktop/desktop-sample/src/main/resources/cz/xelfi/quoridor/desktop/sample/black.png
desktop/desktop-sample/src/main/resources/cz/xelfi/quoridor/desktop/sample/white.png
     1.1 --- a/desktop/desktop-sample/src/main/java/cz/xelfi/quoridor/desktop/sample/KukTopComponent.form	Mon Sep 13 16:27:07 2010 +0200
     1.2 +++ b/desktop/desktop-sample/src/main/java/cz/xelfi/quoridor/desktop/sample/KukTopComponent.form	Mon Sep 13 21:02:55 2010 +0200
     1.3 @@ -1,6 +1,15 @@
     1.4  <?xml version="1.1" encoding="UTF-8" ?>
     1.5  
     1.6  <Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     1.7 +  <NonVisualComponents>
     1.8 +    <Component class="javax.swing.JLabel" name="jLabel1">
     1.9 +      <Properties>
    1.10 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
    1.11 +          <ResourceString bundle="cz/xelfi/quoridor/desktop/sample/Bundle.properties" key="KukTopComponent.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
    1.12 +        </Property>
    1.13 +      </Properties>
    1.14 +    </Component>
    1.15 +  </NonVisualComponents>
    1.16    <AuxValues>
    1.17      <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    1.18      <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
    1.19 @@ -16,25 +25,25 @@
    1.20    <Layout>
    1.21      <DimensionLayout dim="0">
    1.22        <Group type="103" groupAlignment="0" attributes="0">
    1.23 -          <EmptySpace min="0" pref="450" max="32767" attributes="0"/>
    1.24 -          <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
    1.25 -              <Group type="102" attributes="0">
    1.26 -                  <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
    1.27 -                  <Component id="boardPane1" min="-2" max="-2" attributes="0"/>
    1.28 -                  <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
    1.29 -              </Group>
    1.30 +          <Group type="102" alignment="0" attributes="0">
    1.31 +              <Component id="jButton1" min="-2" max="-2" attributes="0"/>
    1.32 +              <EmptySpace pref="225" max="32767" attributes="0"/>
    1.33            </Group>
    1.34 +          <Group type="102" alignment="0" attributes="0">
    1.35 +              <Component id="jButton2" min="-2" max="-2" attributes="0"/>
    1.36 +              <EmptySpace max="-2" attributes="0"/>
    1.37 +          </Group>
    1.38 +          <Component id="boardPane1" alignment="1" pref="312" max="32767" attributes="0"/>
    1.39        </Group>
    1.40      </DimensionLayout>
    1.41      <DimensionLayout dim="1">
    1.42        <Group type="103" groupAlignment="0" attributes="0">
    1.43 -          <EmptySpace min="0" pref="450" max="32767" attributes="0"/>
    1.44 -          <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
    1.45 -              <Group type="102" attributes="0">
    1.46 -                  <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
    1.47 -                  <Component id="boardPane1" min="-2" max="-2" attributes="0"/>
    1.48 -                  <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
    1.49 -              </Group>
    1.50 +          <Group type="102" alignment="0" attributes="0">
    1.51 +              <Component id="jButton1" min="-2" max="-2" attributes="0"/>
    1.52 +              <EmptySpace max="-2" attributes="0"/>
    1.53 +              <Component id="boardPane1" pref="282" max="32767" attributes="0"/>
    1.54 +              <EmptySpace max="-2" attributes="0"/>
    1.55 +              <Component id="jButton2" min="-2" max="-2" attributes="0"/>
    1.56            </Group>
    1.57        </Group>
    1.58      </DimensionLayout>
    1.59 @@ -42,5 +51,31 @@
    1.60    <SubComponents>
    1.61      <Component class="cz.xelfi.quoridor.visidor.BoardPane" name="boardPane1">
    1.62      </Component>
    1.63 +    <Component class="javax.swing.JButton" name="jButton1">
    1.64 +      <Properties>
    1.65 +        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
    1.66 +          <Image iconType="3" name="/cz/xelfi/quoridor/desktop/sample/black.png"/>
    1.67 +        </Property>
    1.68 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
    1.69 +          <ResourceString bundle="cz/xelfi/quoridor/desktop/sample/Bundle.properties" key="KukTopComponent.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
    1.70 +        </Property>
    1.71 +      </Properties>
    1.72 +      <Events>
    1.73 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
    1.74 +      </Events>
    1.75 +    </Component>
    1.76 +    <Component class="javax.swing.JButton" name="jButton2">
    1.77 +      <Properties>
    1.78 +        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
    1.79 +          <Image iconType="3" name="/cz/xelfi/quoridor/desktop/sample/white.png"/>
    1.80 +        </Property>
    1.81 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
    1.82 +          <ResourceString bundle="cz/xelfi/quoridor/desktop/sample/Bundle.properties" key="KukTopComponent.jButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
    1.83 +        </Property>
    1.84 +      </Properties>
    1.85 +      <Events>
    1.86 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
    1.87 +      </Events>
    1.88 +    </Component>
    1.89    </SubComponents>
    1.90  </Form>
     2.1 --- a/desktop/desktop-sample/src/main/java/cz/xelfi/quoridor/desktop/sample/KukTopComponent.java	Mon Sep 13 16:27:07 2010 +0200
     2.2 +++ b/desktop/desktop-sample/src/main/java/cz/xelfi/quoridor/desktop/sample/KukTopComponent.java	Mon Sep 13 21:02:55 2010 +0200
     2.3 @@ -4,6 +4,7 @@
     2.4   */
     2.5  package cz.xelfi.quoridor.desktop.sample;
     2.6  
     2.7 +import cz.xelfi.quoridor.webidor.Game;
     2.8  import org.openide.util.NbBundle;
     2.9  import org.openide.windows.TopComponent;
    2.10  //import org.openide.util.ImageUtilities;
    2.11 @@ -24,16 +25,22 @@
    2.12  
    2.13      public KukTopComponent() {
    2.14          initComponents();
    2.15 -        
    2.16 -        setName(NbBundle.getMessage(KukTopComponent.class, "CTL_KukTopComponent"));
    2.17 -        setToolTipText(NbBundle.getMessage(KukTopComponent.class, "HINT_KukTopComponent"));
    2.18 -//        setIcon(ImageUtilities.loadImage(ICON_PATH, true));
    2.19 -        
    2.20      }
    2.21      
    2.22      public void setGameId(String id) {
    2.23          this.id = id;
    2.24 -        boardPane1.setBoard(Quoridor.getDefault().getGame(id).getBoard());
    2.25 +        final Game g = Quoridor.getDefault().getGame(id);
    2.26 +        boardPane1.setBoard(g.getBoard());
    2.27 +        setName(
    2.28 +            NbBundle.getMessage(KukTopComponent.class, "CTL_KukTopComponent",
    2.29 +                g.getId().getWhite(), g.getId().getBlack()
    2.30 +            )
    2.31 +        );
    2.32 +        setToolTipText(
    2.33 +            NbBundle.getMessage(KukTopComponent.class, "HINT_KukTopComponent",
    2.34 +                g.getId().getWhite(), g.getId().getBlack()
    2.35 +            )
    2.36 +        );
    2.37      }
    2.38  
    2.39      /** This method is called from within the constructor to
    2.40 @@ -44,32 +51,65 @@
    2.41      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    2.42      private void initComponents() {
    2.43  
    2.44 +        jLabel1 = new javax.swing.JLabel();
    2.45          boardPane1 = new cz.xelfi.quoridor.visidor.BoardPane();
    2.46 +        jButton1 = new javax.swing.JButton();
    2.47 +        jButton2 = new javax.swing.JButton();
    2.48 +
    2.49 +        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(KukTopComponent.class, "KukTopComponent.jLabel1.text")); // NOI18N
    2.50 +
    2.51 +        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/xelfi/quoridor/desktop/sample/black.png"))); // NOI18N
    2.52 +        org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(KukTopComponent.class, "KukTopComponent.jButton1.text")); // NOI18N
    2.53 +        jButton1.addActionListener(new java.awt.event.ActionListener() {
    2.54 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
    2.55 +                jButton1ActionPerformed(evt);
    2.56 +            }
    2.57 +        });
    2.58 +
    2.59 +        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cz/xelfi/quoridor/desktop/sample/white.png"))); // NOI18N
    2.60 +        org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(KukTopComponent.class, "KukTopComponent.jButton2.text")); // NOI18N
    2.61 +        jButton2.addActionListener(new java.awt.event.ActionListener() {
    2.62 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
    2.63 +                jButton2ActionPerformed(evt);
    2.64 +            }
    2.65 +        });
    2.66  
    2.67          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    2.68          this.setLayout(layout);
    2.69          layout.setHorizontalGroup(
    2.70              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    2.71 -            .addGap(0, 450, Short.MAX_VALUE)
    2.72 -            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    2.73 -                .addGroup(layout.createSequentialGroup()
    2.74 -                    .addGap(0, 0, Short.MAX_VALUE)
    2.75 -                    .addComponent(boardPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    2.76 -                    .addGap(0, 0, Short.MAX_VALUE)))
    2.77 +            .addGroup(layout.createSequentialGroup()
    2.78 +                .addComponent(jButton1)
    2.79 +                .addContainerGap(225, Short.MAX_VALUE))
    2.80 +            .addGroup(layout.createSequentialGroup()
    2.81 +                .addComponent(jButton2)
    2.82 +                .addContainerGap())
    2.83 +            .addComponent(boardPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
    2.84          );
    2.85          layout.setVerticalGroup(
    2.86              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    2.87 -            .addGap(0, 450, Short.MAX_VALUE)
    2.88 -            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    2.89 -                .addGroup(layout.createSequentialGroup()
    2.90 -                    .addGap(0, 0, Short.MAX_VALUE)
    2.91 -                    .addComponent(boardPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    2.92 -                    .addGap(0, 0, Short.MAX_VALUE)))
    2.93 +            .addGroup(layout.createSequentialGroup()
    2.94 +                .addComponent(jButton1)
    2.95 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    2.96 +                .addComponent(boardPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 282, Short.MAX_VALUE)
    2.97 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    2.98 +                .addComponent(jButton2))
    2.99          );
   2.100      }// </editor-fold>//GEN-END:initComponents
   2.101  
   2.102 +    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
   2.103 +        setGameId(id);
   2.104 +    }//GEN-LAST:event_jButton2ActionPerformed
   2.105 +
   2.106 +    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
   2.107 +        setGameId(id);
   2.108 +    }//GEN-LAST:event_jButton1ActionPerformed
   2.109 +
   2.110      // Variables declaration - do not modify//GEN-BEGIN:variables
   2.111      private cz.xelfi.quoridor.visidor.BoardPane boardPane1;
   2.112 +    private javax.swing.JButton jButton1;
   2.113 +    private javax.swing.JButton jButton2;
   2.114 +    private javax.swing.JLabel jLabel1;
   2.115      // End of variables declaration//GEN-END:variables
   2.116  
   2.117      @Override
     3.1 --- a/desktop/desktop-sample/src/main/resources/cz/xelfi/quoridor/desktop/sample/Bundle.properties	Mon Sep 13 16:27:07 2010 +0200
     3.2 +++ b/desktop/desktop-sample/src/main/resources/cz/xelfi/quoridor/desktop/sample/Bundle.properties	Mon Sep 13 21:02:55 2010 +0200
     3.3 @@ -1,6 +1,9 @@
     3.4  CTL_Hello=Hello
     3.5  CTL_KukAction=Kuk
     3.6 -CTL_KukTopComponent=Kuk Window
     3.7 +CTL_KukTopComponent={0}/{1}
     3.8  CTL_OpenGameAction=Open a game
     3.9  CTL_ShowGames=Show Games
    3.10 -HINT_KukTopComponent=This is a Kuk window
    3.11 +HINT_KukTopComponent=White {0} against black {1}
    3.12 +KukTopComponent.jLabel1.text=
    3.13 +KukTopComponent.jButton1.text=
    3.14 +KukTopComponent.jButton2.text=
     4.1 Binary file desktop/desktop-sample/src/main/resources/cz/xelfi/quoridor/desktop/sample/black.png has changed
     5.1 Binary file desktop/desktop-sample/src/main/resources/cz/xelfi/quoridor/desktop/sample/white.png has changed