# HG changeset patch # User Mario Torre # Date 1360616913 -3600 # Node ID 5e281961d0e30f12a5e0f5659abf8be9faca93d3 # Parent 8953d6ef1f06e5ec4712eafd9c736bfbbcbd5c38 Use new IconDescriptor API. diff -r 8953d6ef1f06 -r 5e281961d0e3 client-common/src/main/java/com/redhat/thermostat/tutorial/schedule/client/common/IconResources.java --- a/client-common/src/main/java/com/redhat/thermostat/tutorial/schedule/client/common/IconResources.java Thu Feb 07 18:33:33 2013 +0100 +++ b/client-common/src/main/java/com/redhat/thermostat/tutorial/schedule/client/common/IconResources.java Mon Feb 11 22:08:33 2013 +0100 @@ -37,6 +37,9 @@ package com.redhat.thermostat.tutorial.schedule.client.common; import com.redhat.thermostat.client.ui.IconDescriptor; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Class to hold {@link IconDescriptor} for the icons used by the plugin GUI. @@ -54,14 +57,22 @@ public static IconDescriptor getLoadFileIcon() { if (loadFile == null) { - loadFile = IconDescriptor.loadIcon("com/redhat/thermostat/tutorial/schedule/client/common/load.png"); + try { + loadFile = IconDescriptor.loadIcon(IconResources.class.getClassLoader(), "com/redhat/thermostat/tutorial/schedule/client/common/load.png"); + } catch (IOException ex) { + Logger.getLogger(IconResources.class.getName()).log(Level.SEVERE, null, ex); + } } return loadFile; } public static IconDescriptor getPresentationIcon() { if (presentation == null) { - presentation = IconDescriptor.loadIcon("com/redhat/thermostat/tutorial/schedule/client/common/presentation.png"); + try { + presentation = IconDescriptor.loadIcon(IconResources.class.getClassLoader(), "com/redhat/thermostat/tutorial/schedule/client/common/presentation.png"); + } catch (IOException ex) { + Logger.getLogger(IconResources.class.getName()).log(Level.SEVERE, null, ex); + } } return presentation; } diff -r 8953d6ef1f06 -r 5e281961d0e3 client-swing/src/main/java/com/redhat/thermostat/tutorial/schedule/client/swing/impl/SwingSchedulerView.java --- a/client-swing/src/main/java/com/redhat/thermostat/tutorial/schedule/client/swing/impl/SwingSchedulerView.java Thu Feb 07 18:33:33 2013 +0100 +++ b/client-swing/src/main/java/com/redhat/thermostat/tutorial/schedule/client/swing/impl/SwingSchedulerView.java Mon Feb 11 22:08:33 2013 +0100 @@ -39,6 +39,7 @@ import com.redhat.thermostat.client.swing.SwingComponent; import com.redhat.thermostat.client.swing.components.ActionButton; import com.redhat.thermostat.client.swing.components.HeaderPanel; +import com.redhat.thermostat.client.swing.components.Icon; import com.redhat.thermostat.client.swing.components.ToolbarButton; import com.redhat.thermostat.tutorial.schedule.client.common.ClockView; import com.redhat.thermostat.tutorial.schedule.client.common.IconResources; @@ -48,7 +49,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; -import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; @@ -62,7 +62,7 @@ public SwingSchedulerView() { uiComponent = new HeaderPanel(ClockUtils.localize(LocaleResources.HEADER_LABEL)); - ToolbarButton loadSchedule = new ActionButton(new ImageIcon(IconResources.getLoadFileIcon().getData().array()), + ToolbarButton loadSchedule = new ActionButton(new Icon(IconResources.getLoadFileIcon()), ClockUtils.localize(LocaleResources.LOAD_SCHEDULE)); loadSchedule.getToolbarButton().addActionListener(new ActionListener() { @Override