use of javax.swing.ImageIcon in project SIMRacingApps by SIMRacingApps.
the class MessagesForm 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 SIMRacingApps by SIMRacingApps.
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);
}
use of javax.swing.ImageIcon in project SIMRacingApps by SIMRacingApps.
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 SIMRacingApps by SIMRacingApps.
the class VersionInfoForm 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 ACS by ACS-Community.
the class BeanGrouper method getDelScriptMenuItem.
private JMenuItem getDelScriptMenuItem() {
if (delScriptMenuItem == null) {
delScriptMenuItem = new JMenuItem();
delScriptMenuItem.setText("Delete script");
delScriptMenuItem.setEnabled(false);
delScriptMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
script = null;
delScriptMenuItem.setEnabled(false);
getAddScriptMenuItem().setEnabled(true);
getStartButton().setIcon(new ImageIcon(getClass().getClassLoader().getResource("cl/utfsm/samplingSystemUI/img/player_play.png")));
getStartButton().setToolTipText("Start the sampling, and also start the configurated script.\nThe sampling will end with the script.");
getTimeSampSpinner().setEnabled(true);
}
});
}
return delScriptMenuItem;
}
Aggregations