• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting a background image through ImageIO gives a `save problem` upon compilation  RSS feed

 
Sophia Green
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to set a background image for this window and I have tried multiple ways but I am compiling/saving it, it's giving an error as shown in the first pic.


Here is my code:



I have added images on the window using `setIcon` but I didn't get this problem upon compilation. Even when I am commenting out all the lines added for the background image, I am getting the same error. Only when I remove it that I am able run it.

Can someone give me alternative ways of how I can set a background image for this?

Screenshot-(245).png
[Thumbnail for Screenshot-(245).png]
The `save` problem upon compilation
Screenshot-(247).png
[Thumbnail for Screenshot-(247).png]
When I clicked on `save as UTF-8`, it threw an exception
Screenshot-(246).png
[Thumbnail for Screenshot-(246).png]
A pic to get an idea of how the window is
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sophia Green wrote:I have added images on the window using `setIcon` but I didn't get this problem upon compilation.


Look at the quote characters you used in that sentence. Those aren't standard characters which appear in CP-1252, which is a standard Western European character set which you chose (by default probably) to express your code in. So probably you used non-standard quote characters like that somewhere in your code.

If your code compiled correctly, then maybe your non-standard characters are in comments, or something like that. Anyway you should search them out and replace them.
 
Sophia Green
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is how it worked for me:
I loaded the image(simple-blue.jpg) I used in another new program and it didn't work at first, then added a new image in the same program and it worked. Then I added the first image to the same new program and somehow it worked. I added the image path simple-blue.jpg in the program which I posted here again and I don't know how but it worked!
 
Carey Brown
Saloon Keeper
Posts: 3328
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sophia Green wrote:Here is how it worked for me:
I loaded the image(simple-blue.jpg) I used in another new program and it didn't work at first, then added a new image in the same program and it worked. Then I added the first image to the same new program and somehow it worked. I added the image path simple-blue.jpg in the program which I posted here again and I don't know how but it worked!
When I pasted your first posting of code into Eclipse it complained about the first set of double quotes. I re-typed them and everything was ok.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!