Search in sources :

Example 1 with ImageIcon

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

Example 2 with ImageIcon

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

Example 3 with ImageIcon

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

Example 4 with ImageIcon

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

Example 5 with ImageIcon

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

Aggregations

ImageIcon (javax.swing.ImageIcon)372 JButton (javax.swing.JButton)94 ActionEvent (java.awt.event.ActionEvent)71 JLabel (javax.swing.JLabel)60 ActionListener (java.awt.event.ActionListener)59 Dimension (java.awt.Dimension)43 JPanel (javax.swing.JPanel)43 BufferedImage (java.awt.image.BufferedImage)36 IOException (java.io.IOException)27 BorderLayout (java.awt.BorderLayout)25 Insets (java.awt.Insets)24 JMenuItem (javax.swing.JMenuItem)23 Image (java.awt.Image)22 URL (java.net.URL)22 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)20 GridBagLayout (java.awt.GridBagLayout)20 Color (java.awt.Color)18 JScrollPane (javax.swing.JScrollPane)17 FlowLayout (java.awt.FlowLayout)16 JFrame (javax.swing.JFrame)15