Questions tagged [imageicon]

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

An ImageIcon is an implementation of the Icon interface in Java Swing. ImageIcon paints an icon from GIF, JPEG, or PNG files1 2 or a java.awt.Image.

  1. Sources for images might be constructed from
    • File (rarely useful)
    • String denoting the path to a File (N.B. often leads to the 'loading resource error mentioned below').
    • URL (typically used for )
    • Image
    • InputStream that is from/of an image.
  2. The image formats you can rely on the J2SE to handle is as above, JPG, PNG & GIF. OTOH Java based image I/O formats are provided by Service Provider Interface. Any particular JRE might support more formats.

Resources

FAQ

  1. What's an easy way to display an Image in Java/Scala?
  2. Loading Icon resource error
  3. How to turn ImageIcon to gray on Swing
  4. Use animated GIF in desktop application
  5. Getting label icon to appear above text
  6. Image Scaling
1040 questions
-4
votes
1 answer

I want to get the current position of an ImageIcon on a JPanel(Java)

I want to get the coordinate of an image so I can change the background color of the JPanel relative to the coordinates. Here is what I have so far. The code allows the user to move a arrow up, down, right and left, so if the arrow if a the first…
-4
votes
2 answers

How to make the program continues even if the value is null

I have a program here in java and MySQL for database. However the problem is: when the data for IMAGE in the SQL is null, the program stops loading picture. It shows "java.lang.IllegalArgumentException: input == null!". My question is how will I…
Zero Serum
  • 39
  • 10
-4
votes
3 answers

java.lang.NullPointerException error message

ImgSet[0] = new ImageIcon("bandeira-portugal.png", "Portugal"); ImgSet[1] = new ImageIcon("south_korea-32.png", "South_Korea"); ImgSet[2] = new ImageIcon("China-icon.png", …
-5
votes
1 answer

Java SwingGUI is broken

My code is very simple, really there is no problem in writing my code. I'm getting the file not found error as an error, but I'm 100% sure the file path is correct, I've checked hundreds of times. There are no other errors. Some different image…
-7
votes
3 answers

Add a picture to a JFrame

All I am trying to do is add a picture to a JFrame. I am really confused and don't really understand... I have looked up every possible question on this site, looked on other java stuff, such as forums. I tried my best and now I must ask guys for…
1 2 3
69
70