This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
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

SecurityException in IE Browser

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
The porblem is in the double buffering (createImage(int x,int y) method).
The problem occur when i closed and open the Applet again and again and it sometime give the SecurityException.the java Console message is.
java.lang.SecurityException: Too many images
at com/ms/awt/image/ImageRepresentation.incNativeCount
at com/ms/awt/image/ImageRepresentation.offscreenInit
at com/ms/awt/image/Image.<init>
at com/ms/awt/ImageX.<init>
at com/ms/awt/WComponentPeer.createImage
at java/awt/Component.createImage
at PoolTable_Canvas.doPaint
at PoolTable_Canvas.update
at com/ms/awt/WComponentPeer.doUpdate
at com/ms/awt/WComponentPeer.doUpdate
at com/ms/awt/WUpdate.run
at com/ms/ui/windowmanager/RunnableMessage.run
at com/ms/awt/WSystemQueue.getMessage
at com/ms/awt/WEventQueue.getNextEvent
at java/awt/EventDispatchThread.run
.please give ur suggestios too prevent this Exception as early as possible.
Thanks
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This simply means that the VM's GC is not doing a proper job... What you should dois try to nullyfy all the reference & dispose () all the frame not used.
You probably should spend some tedious time (but also quiet exciting ) in trapping all the WindowEvent to add some code to do that !
I should really help the VM doing it's job !
One question though,
I sthis always after a fixed number of Open / close or the faster the sooner.
In the first case you really have some de-allocation problem. In the latter, the trick should definitively help !
Complete explainationis here.
Thomas,
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that the Image you use for double-buffering is kept in a member variable of the class and is only created once, not everytime you enter the paint method. I usually have something like this:

You might think that the checking if bufferImage and imageGraphics are null is superfluous, but it is possible for these to end up as being null if the system is running low on resources. Of course, you would probably want to display an error of some sort in this case.
 
If you have a bad day in October, have a slice of banana cream pie. And 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