Top "Imageicon" questions

An ImageIcon is an implementation of the Icon interface in Java Swing.

Java adding ImageIcon to JLabel

I am trying to make a very basic game with Java and I am having trouble displaying an image on …

java swing jframe jpanel imageicon
Scale the ImageIcon automatically to label size

On my JFrame, I am using the following code to display an image on the Panel : ImageIcon img= new ImageIcon("…

java swing size imageicon
Java in Eclipse: Where do I put files on the filesystem that I want to load using getResource? (e.g. images for an ImageIcon)

I know the file needs to be where the getClass().getResource(filename) can find it, but I don't know where …

java eclipse filesystems imageicon
Displaying an image in Java Swing

public class MinesweeperMenu extends MinesweeperPanel{ private JPanel picture = new JPanel(); private JButton play = new JButton("Play"); private JButton highScores = new …

java swing icons imageicon
How to add an ImageIcon to a JFrame?

I'm trying to add an image to one frame but it seems it does not working. The image created by …

java swing jframe jlabel imageicon
How to set Icon to a JLabel from an image from a folder?

I am trying to set an icon to a JLabel from a folder of images whenever an item is selected …

java swing jlabel jcombobox imageicon
Convert BufferedImage to ImageIcon

How can I convert a BufferedImage to an ImageIcon? I can not find any documentation on this.

java swing bufferedimage imageicon image-conversion
Java - Convert Image to Icon/ImageIcon?

I have an Image object that I would like to convert to an Icon or ImageIcon to add to a …

java image imageicon
Java getClass().getResource("file") leads to NullPointerException

I am following the zetcode Snake java games tutorial and always get this error: ImageIcon iid = new ImageIcon(this.getClass().…

java nullpointerexception embedded-resource imageicon
What is the correct path to display an ImageIcon png file for Windows 7?

I wanted to test having a program with a simple png image on it. I wrote a short program that …

java swing path embedded-resource imageicon