Netbeans e Java Applet

0 respostas
kunigas

Olá pessoal,

Estou tendo um problema estranho: quando vou testar meu applet no Netbeans, a chamada de uma função causa uma exceção de segurança. Quando testo no Browser (firefox) roda normalmente.

Já identifiquei que a função que dá pau é esta:

private void automaticExecution () {
          
        
        int initialDelay = 0;
        int period = 300;   
        
        timer = new Timer();
        TimerTask task = new TimerTask() {
            public void run() {
                stage++;
                steped = true;
                repaint();    
                if (show_hull == false) timer.cancel();
            }
        };
        timer.scheduleAtFixedRate(task, initialDelay, period);     
      
    }
O erro que dá é:
Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
        at java.security.AccessController.checkPermission(AccessController.java:546)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at sun.applet.AppletSecurity.checkAccess(AppletSecurity.java:235)
        at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:288)
        at java.lang.Thread.init(Thread.java:332)
        at java.lang.Thread.<init>(Thread.java:377)
        at java.util.TimerThread.<init>(Timer.java:456)
        at java.util.Timer.<init>(Timer.java:71)
        at java.util.Timer.<init>(Timer.java:106)
        at ComputationalGeometry.Jarvis2.automaticExecution(Jarvis2.java:373)
        at ComputationalGeometry.Jarvis2.actionPerformed(Jarvis2.java:411)
        at java.awt.Button.processActionEvent(Button.java:392)
        at java.awt.Button.processEvent(Button.java:360)
        at java.awt.Component.dispatchEventImpl(Component.java:4413)
        at java.awt.Component.dispatchEvent(Component.java:4243)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Alguém saberia me dizer porque está acontecendo isso e como arrumar?

Grato,

Criado 28 de janeiro de 2009
Respostas 0
Participantes 1