• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Icons

 
Tessa Harm
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! This compiles with no errors but the icon doesn't display?



Thanks!
Tessa
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The image type is the problem. You can only use either of gif,jpg or png.
 
Tessa Harm
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that worked very well...

is there a way to say, I dunno, make just the pic come up if I attach it to the jLabel and have no text? If I try to remove text in design view the jLabel disappears and if I create my own label like this:



It says something about cannot find symbol. My textbook on the other hand believes that line of code should be possible. ;)

Thanks!
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
......remove text in design view..........something about cannot find symbol......

Looks like you are using a designer kind of IDE. Bad idea. I would recommend you hand code. Search the Swing forums. You will find past discussions on this.

If you want to display just the Icon, you can use the JLabel(Icon image) constructor.
Without seeing your code, difficult to tell why the cannot find symbol. The full stack trace will actually tell you the class, line number and even character where the problem was encountered.

This post would be more suitable on the Swing forum.
Moving thread.
 
Tessa Harm
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's what compiles, but now it's again not displayed. If I attach the image to a label in the designer with text it works, but then it must have text.

 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to write a small application by hand

1) Build a frame
2) Build a label
3) Add the label to the frame
4) Launch the frame

This should be easy enough with just a handful lines of code.
When it works as expected, try and figure out why your IDE built code is not working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic