use of javax.swing.ImageIcon in project cogtool by cogtool.
the class ClassPathForm method loadImage.
/**
* Helper method to load an image file from the CLASSPATH
* @param imageName the package and name of the file to load relative to the CLASSPATH
* @return an ImageIcon instance with the specified image file
* @throws IllegalArgumentException if the image resource cannot be loaded.
*/
public ImageIcon loadImage(String imageName) {
try {
ClassLoader classloader = getClass().getClassLoader();
java.net.URL url = classloader.getResource(imageName);
if (url != null) {
ImageIcon icon = new ImageIcon(url);
return icon;
}
} catch (Exception e) {
e.printStackTrace();
}
throw new IllegalArgumentException("Unable to load image: " + imageName);
}
use of javax.swing.ImageIcon in project cogtool by cogtool.
the class ConfigForm method loadImage.
/**
* Helper method to load an image file from the CLASSPATH
* @param imageName the package and name of the file to load relative to the CLASSPATH
* @return an ImageIcon instance with the specified image file
* @throws IllegalArgumentException if the image resource cannot be loaded.
*/
public ImageIcon loadImage(String imageName) {
try {
ClassLoader classloader = getClass().getClassLoader();
java.net.URL url = classloader.getResource(imageName);
if (url != null) {
ImageIcon icon = new ImageIcon(url);
return icon;
}
} catch (Exception e) {
e.printStackTrace();
}
throw new IllegalArgumentException("Unable to load image: " + imageName);
}
use of javax.swing.ImageIcon in project cogtool by cogtool.
the class EnvironmentVarsForm method loadImage.
/**
* Helper method to load an image file from the CLASSPATH
* @param imageName the package and name of the file to load relative to the CLASSPATH
* @return an ImageIcon instance with the specified image file
* @throws IllegalArgumentException if the image resource cannot be loaded.
*/
public ImageIcon loadImage(String imageName) {
try {
ClassLoader classloader = getClass().getClassLoader();
java.net.URL url = classloader.getResource(imageName);
if (url != null) {
ImageIcon icon = new ImageIcon(url);
return icon;
}
} catch (Exception e) {
e.printStackTrace();
}
throw new IllegalArgumentException("Unable to load image: " + imageName);
}
use of javax.swing.ImageIcon in project cogtool by cogtool.
the class JreForm method loadImage.
/**
* Helper method to load an image file from the CLASSPATH
* @param imageName the package and name of the file to load relative to the CLASSPATH
* @return an ImageIcon instance with the specified image file
* @throws IllegalArgumentException if the image resource cannot be loaded.
*/
public ImageIcon loadImage(String imageName) {
try {
ClassLoader classloader = getClass().getClassLoader();
java.net.URL url = classloader.getResource(imageName);
if (url != null) {
ImageIcon icon = new ImageIcon(url);
return icon;
}
} catch (Exception e) {
e.printStackTrace();
}
throw new IllegalArgumentException("Unable to load image: " + imageName);
}
use of javax.swing.ImageIcon in project cogtool by cogtool.
the class SingleInstanceForm method loadImage.
/**
* Helper method to load an image file from the CLASSPATH
* @param imageName the package and name of the file to load relative to the CLASSPATH
* @return an ImageIcon instance with the specified image file
* @throws IllegalArgumentException if the image resource cannot be loaded.
*/
public ImageIcon loadImage(String imageName) {
try {
ClassLoader classloader = getClass().getClassLoader();
java.net.URL url = classloader.getResource(imageName);
if (url != null) {
ImageIcon icon = new ImageIcon(url);
return icon;
}
} catch (Exception e) {
e.printStackTrace();
}
throw new IllegalArgumentException("Unable to load image: " + imageName);
}
Aggregations