aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Icons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Icons" Watch "Icons" New topic
Author

Icons

Tessa Harm
Greenhorn

Joined: Oct 12, 2010
Posts: 10
Hi! This compiles with no errors but the icon doesn't display?



Thanks!
Tessa
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

The image type is the problem. You can only use either of gif,jpg or png.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Tessa Harm
Greenhorn

Joined: Oct 12, 2010
Posts: 10
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

Joined: Jul 26, 2007
Posts: 10535
    
    9

......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

Joined: Oct 12, 2010
Posts: 10
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

Joined: Jul 26, 2007
Posts: 10535
    
    9

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Icons