Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Icons not visible in applet

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,

I have a created a JTree where every node has an icon. One class is that extends JPanel is being used for the tree, and everything works fine and the icons show correctly. However, when I create an instance of that class and add it to my Applet(which contains several other components), the icons are not visible.

Anyone has any idea why?

Any suggestions will be appreciated.

Regards,

Dani
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> ... Applet... the icons are not visible.

google

getCodeBase()
 
dani abdallah
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Michael Dunn wrote:> ... Applet... the icons are not visible.

google

getCodeBase()



Thank you for your assistant. However I am still confused on how to use this. Are you assuming I need a reference to the icon so that I can use it directly in the applet?

If so, that is not the case(sorry i didn't explain everything so clearly at first) I am creating an instance of the JTreeComponent class that extends JPanel in MAIN class that also extends JPanel and that includes instances of all the other components I have created. This mainGUI is presented in an applet. When I run the JTreeComponent class separately I see the JTree with icons etc as i should, however when I run my applet (which creates a mainGUI instance) I cannot see the icon.

Apologies for the confusion, or maybe I am still missing something?

Regards,

Dani
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for an applet the icons need to be read via a URL

find some applet sample code that uses getCodeBase() to understand
 
dani abdallah
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Michael Dunn wrote:for an applet the icons need to be read via a URL

find some applet sample code that uses getCodeBase() to understand



Thanks, I see the problem, appreciate your assistance.

Regards,

Dani
 
Popeye has his spinach. I have this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic