Dear Readers, I know we can set Glass Panes for containers like JFrame but why can't we do the same for JPanel. I have a Map Zone in a JPanel and I wanted "objects" to be placed on an image that is already there in the JPanel. The idea that occured to me was to set a glass pane on the JPanel and then place those "objects" there. But it seems we are not allowed to add glass panes for JPanel. Is there any workaround this?
Dear Michael, Thanks for your reply. But, I also wanted to set an alpha channel to these objects. Do you think it will be a good idea, if I set a glass pane for the main JFrame and then work in only that section of the glass pane that overlays the MapZone?
Dear Readers, Out of many classes, I have got two classes namely; MapZone (subclass of JRootPane) and SpriteLayer (subclass of JPanel). Now, I set the glass pane of MapZone as SpriteLayer. I now do the following:
Everything works fine if I call the setVisible() method of SpriteLayer from that class itself. But if I remove the comments from the above code fragment, then the glass pane does NOT appear. It seems that we cannot call this method from outside the class. Why is this so?
With Best Regards,
Shyam Prasad Murarka
It's a tiny ad. At least, that's what she said.
SKIP - a book about connecting industrious people with elderly land owners