changeset 970:f6fc89409e10

Add Thermostat logo to about dialog review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-February/005634.html reviewed-by: omajid, ebaron
author Mario Torre <neugens.limasoftware@gmail.com>
date Tue, 12 Feb 2013 18:37:48 +0100
parents 59c773a025b2
children eda9dc44feda
files client/swing/src/main/java/com/redhat/thermostat/client/swing/IconResource.java client/swing/src/main/java/com/redhat/thermostat/client/swing/UIResources.java client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/AboutDialog.java client/swing/src/main/resources/icons/thermostat.png
diffstat 4 files changed, 20 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/IconResource.java	Tue Feb 12 15:20:17 2013 +0100
+++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/IconResource.java	Tue Feb 12 18:37:48 2013 +0100
@@ -42,7 +42,7 @@
 import javax.swing.ImageIcon;
 
 /**
- * Provides asscess to various icons.
+ * Provides access to various icons.
  */
 public class IconResource {
     /* FIXME we need to pick up the icons dynamically */
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/UIResources.java	Tue Feb 12 15:20:17 2013 +0100
+++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/UIResources.java	Tue Feb 12 18:37:48 2013 +0100
@@ -36,8 +36,12 @@
 
 package com.redhat.thermostat.client.swing;
 
+import com.redhat.thermostat.client.ui.IconDescriptor;
 import java.awt.Color;
 import java.awt.Font;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.swing.UIManager;
 import javax.swing.plaf.ColorUIResource;
@@ -56,6 +60,8 @@
     
     private static final Font standard;
     
+    private static IconDescriptor logo = null;
+    
     static {
         Color color = UIManager.getColor("Button.darkShadow");
         if (color == null) {
@@ -75,6 +81,11 @@
             font = Font.decode(Font.DIALOG);
         }
         standard = font;
+        try {
+            logo = IconDescriptor.loadIcon(UIResources.class.getClassLoader(), "/icons/thermostat.png");
+        } catch (IOException ex) {
+            Logger.getLogger(UIResources.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
+        }
     }
     
     private static final Font header = standard.deriveFont(Font.BOLD);
@@ -115,5 +126,11 @@
     public Font standardFont() {
         return standard;
     }
+    
+    // miscellaneous
+    
+    public IconDescriptor getLogo() {
+        return logo;
+    }
 }
 
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/AboutDialog.java	Tue Feb 12 15:20:17 2013 +0100
+++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/AboutDialog.java	Tue Feb 12 18:37:48 2013 +0100
@@ -51,7 +51,6 @@
 import javax.swing.Icon;
 import javax.swing.JButton;
 import javax.swing.JDialog;
-import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.LayoutStyle.ComponentPlacement;
@@ -73,7 +72,6 @@
 
     private static final Logger logger = LoggingUtils.getLogger(AboutDialog.class);
 
-    private String name;
     private String description;
     private String version;
     private Icon icon;
@@ -91,10 +89,8 @@
         setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
         setResizable(false);
         
-        name = appInfo.getName();
         description = appInfo.getDescription();
         version = appInfo.getVersion().getVersionNumber();
-        icon = IconResource.QUESTION.getIcon();
         copyright = appInfo.getCopyright();
         license = appInfo.getLicenseSummary();
         website = appInfo.getWebsite();
@@ -107,6 +103,7 @@
         setBounds(100, 100, 450, 338);
         
         UIResources res = UIResources.getInstance();
+        icon = new com.redhat.thermostat.client.swing.components.Icon(res.getLogo());
         
         JPanel panel = new JPanel();
         panel.setBorder(new TitledBorder(""));
@@ -147,11 +144,7 @@
         JLabel versionLabel = new JLabel(version);
         versionLabel.setFont(res.footerFont());
         versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
-        
-        JLabel nameLabel = new JLabel(name);
-        nameLabel.setFont(res.headerFont());
-        nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
-        
+                
         JLabel descriptionLabel = new JLabel(description);
         descriptionLabel.setHorizontalAlignment(SwingConstants.CENTER);
         descriptionLabel.setFont(res.standardFont());
@@ -183,7 +176,6 @@
                     .addContainerGap()
                     .addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
                         .addComponent(iconLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
-                        .addComponent(nameLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
                         .addComponent(versionLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
                         .addComponent(descriptionLabel, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
                         .addComponent(copyrightLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
@@ -198,8 +190,6 @@
                     .addContainerGap()
                     .addComponent(iconLabel)
                     .addGap(4)
-                    .addComponent(nameLabel, GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
-                    .addPreferredGap(ComponentPlacement.RELATED)
                     .addComponent(versionLabel, GroupLayout.DEFAULT_SIZE, 13, Short.MAX_VALUE)
                     .addPreferredGap(ComponentPlacement.UNRELATED)
                     .addComponent(descriptionLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
Binary file client/swing/src/main/resources/icons/thermostat.png has changed