Search in sources :

Example 71 with ImageIcon

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);
}
Also used : ImageIcon(javax.swing.ImageIcon)

Example 72 with ImageIcon

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);
}
Also used : ImageIcon(javax.swing.ImageIcon)

Example 73 with ImageIcon

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);
}
Also used : ImageIcon(javax.swing.ImageIcon)

Example 74 with ImageIcon

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);
}
Also used : ImageIcon(javax.swing.ImageIcon)

Example 75 with ImageIcon

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;
}
Also used : ImageIcon(javax.swing.ImageIcon) JMenuItem(javax.swing.JMenuItem) ActionEvent(java.awt.event.ActionEvent)

Aggregations

ImageIcon (javax.swing.ImageIcon)427 JButton (javax.swing.JButton)109 ActionEvent (java.awt.event.ActionEvent)83 ActionListener (java.awt.event.ActionListener)70 JLabel (javax.swing.JLabel)67 Dimension (java.awt.Dimension)62 BufferedImage (java.awt.image.BufferedImage)51 JPanel (javax.swing.JPanel)48 Insets (java.awt.Insets)42 Image (java.awt.Image)31 BorderLayout (java.awt.BorderLayout)28 IOException (java.io.IOException)28 URL (java.net.URL)26 GridBagLayout (java.awt.GridBagLayout)23 JMenuItem (javax.swing.JMenuItem)23 Color (java.awt.Color)21 Point (java.awt.Point)21 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)20 JToggleButton (javax.swing.JToggleButton)20 JScrollPane (javax.swing.JScrollPane)19