Revision 584 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StatusLabel.java

View differences:

StatusLabel.java
41 41
import java.awt.Insets;
42 42
import java.net.URL;
43 43

  
44
import javax.swing.Icon;
45 44
import javax.swing.ImageIcon;
46 45
import javax.swing.JComponent;
47 46
import javax.swing.JLabel;
......
124 123
        }
125 124
    }
126 125

  
127
    /**
128
     * @param notValidated
129
     * @return
130
     */
131
    private Icon getIcon(String iconName, String description) {
132
        URL res = org.gvsig.tools.swing.impl.dynobject.StatusLabel.class.getResource(iconName);
133
        if (res == null) {
134
            return null;
135
        }
136
        String path = res.getPath();
137
        if ((path == null) || (path.equals(""))) {
138
            return null;
139
        }
140
        ImageIcon icon = new ImageIcon(path);
141
        icon.setDescription(description);
142
        icon.setImageObserver(fieldLabel);
143
        return icon;
144
    }
126
	private ImageIcon getIcon(String name, String description) {
127
		URL iconurl = this.getClass().getResource(name);
128
		ImageIcon icon = null;
129
		if (iconurl == null) {
130
			icon = new ImageIcon();
131
		} else {
132
			icon = new ImageIcon(iconurl);
133
		}
134
		icon.setDescription(description);
135
		icon.setImageObserver(fieldLabel);
136
		return icon;
137
	}
145 138

  
146 139
    public Component getValidationLabel() {
147 140
        return this.fieldLabel;

Also available in: Unified diff