[Adfconverter-commit] adfconverter-dev/src/uk/ac/ebi/adfconverter/usermode/gui GUIUtils.java,1.4,1.5
Status: Beta
Brought to you by:
pierreebi
|
From: pierre <pie...@us...> - 2005-08-23 14:25:07
|
Update of /cvsroot/adfconverter/adfconverter-dev/src/uk/ac/ebi/adfconverter/usermode/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13210 Modified Files: GUIUtils.java JAddeablePropertyFrame.java ResourceUpdateFrame.java Log Message: fix icon path -> use resource Index: JAddeablePropertyFrame.java =================================================================== RCS file: /cvsroot/adfconverter/adfconverter-dev/src/uk/ac/ebi/adfconverter/usermode/gui/JAddeablePropertyFrame.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JAddeablePropertyFrame.java 1 Aug 2005 17:11:12 -0000 1.3 --- JAddeablePropertyFrame.java 23 Aug 2005 14:24:56 -0000 1.4 *************** *** 60,63 **** --- 60,64 ---- import java.awt.event.MouseEvent; import java.awt.event.MouseListener; + import java.io.File; import java.util.ArrayList; import java.util.Enumeration; *************** *** 288,292 **** if(this.addButton == null) { ! this.addButton = new JLocalizedButton(AddeabelPropertyResourceBundle,"addbutton",GUIUtils.createImageIcon("images/right.gif")); this.addButton.addActionListener(this); this.addButton.setActionCommand(addButtonAction); --- 289,293 ---- if(this.addButton == null) { ! this.addButton = new JLocalizedButton(AddeabelPropertyResourceBundle,"addbutton",GUIUtils.createImageIcon("/right.gif"));//"images"+File.separator+"right.gif")); this.addButton.addActionListener(this); this.addButton.setActionCommand(addButtonAction); *************** *** 306,310 **** if(this.removeButton == null) { ! this.removeButton = new JLocalizedButton(AddeabelPropertyResourceBundle,"removebutton",GUIUtils.createImageIcon("images/left.gif")); this.removeButton.addActionListener(this); this.removeButton.setActionCommand(removeButtonAction); --- 307,311 ---- if(this.removeButton == null) { ! this.removeButton = new JLocalizedButton(AddeabelPropertyResourceBundle,"removebutton",GUIUtils.createImageIcon("/left.gif"));//"images"+File.separator+"left.gif")); this.removeButton.addActionListener(this); this.removeButton.setActionCommand(removeButtonAction); Index: GUIUtils.java =================================================================== RCS file: /cvsroot/adfconverter/adfconverter-dev/src/uk/ac/ebi/adfconverter/usermode/gui/GUIUtils.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GUIUtils.java 22 Aug 2005 22:04:31 -0000 1.4 --- GUIUtils.java 23 Aug 2005 14:24:56 -0000 1.5 *************** *** 3,6 **** --- 3,8 ---- import java.awt.Component; import java.awt.Container; + import java.awt.Image; + import java.awt.Toolkit; import java.awt.Window; import java.util.Enumeration; *************** *** 145,148 **** --- 147,151 ---- if (imgURL != null) { + if (isDEBUGMODE()) log.Applidebug("Cfound imgURL: " + imgURL); return new ImageIcon(imgURL); } *************** *** 150,153 **** --- 153,183 ---- return new ImageIcon(path); } + + /** Returns an ImageIcon, or null if the path was invalid. + * <dt><b> Requires</b><code> + * </code><b>fmtOk</b> path!=null + * <dt><b> Ensures</b><code> + * </code> + * @param path the path to an Icon to load + * @param description description of the icon + * @return the ImageIcon created with the file in path + */ + public static ImageIcon createImageIcon(String path, String description) + { + java.net.URL imgURL = GUIUtils.class.getResource(path); + if (imgURL != null) + { + if (isDEBUGMODE()) log.Applidebug("Cfound imgURL: " + imgURL); + return new ImageIcon(imgURL, description); + } + Image img = Toolkit.getDefaultToolkit().createImage(path); + if (img != null) + { + if (isDEBUGMODE()) log.Applidebug("find file: " + path); + return new ImageIcon(img,description); + } + if (isDEBUGMODE()) log.Applidebug("Couldn't find file: " + path); + return new ImageIcon(path); + } /** Index: ResourceUpdateFrame.java =================================================================== RCS file: /cvsroot/adfconverter/adfconverter-dev/src/uk/ac/ebi/adfconverter/usermode/gui/ResourceUpdateFrame.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ResourceUpdateFrame.java 22 Aug 2005 23:26:58 -0000 1.4 --- ResourceUpdateFrame.java 23 Aug 2005 14:24:56 -0000 1.5 *************** *** 204,208 **** JLabel updateableresourcesLabel = new JLocalizedLabel(ResourceBundleName); updateableresourcesLabel.setText("updateableresources"); ! updateableresourcesLabel.setIcon(GUIUtils.createImageIcon("images"+File.separator+"Globe.gif")); updateableresourcesLabel.setAlignmentX(Component.LEFT_ALIGNMENT); updateableresourcesLabel.setAlignmentY(Component.CENTER_ALIGNMENT); --- 204,208 ---- JLabel updateableresourcesLabel = new JLocalizedLabel(ResourceBundleName); updateableresourcesLabel.setText("updateableresources"); ! updateableresourcesLabel.setIcon(GUIUtils.createImageIcon("/Globe.gif"));//"images"+File.separator+"Globe.gif")); updateableresourcesLabel.setAlignmentX(Component.LEFT_ALIGNMENT); updateableresourcesLabel.setAlignmentY(Component.CENTER_ALIGNMENT); |