AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with MainFrame class in JApplet

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> 3D Graphics API's for Java
View previous topic :: View next topic  
Author Message
Japs
Guest





PostPosted: Mon May 08, 2006 8:07 pm    Post subject: Problem with MainFrame class in JApplet Reply with quote



Hi all!
I'm new to this NG so I'll try to explain my problem.
I'm using JAVA3D into a JApplet. This is the code

Code:

import java.util.*;
import java.net.*;

import java.awt.*;

import javax.swing.*;

import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;

import javax.media.j3d.*;
import javax.vecmath.*;

....

public class OSESKeyNav extends JApplet
{
        private static final int WINDOW_WIDTH = 800;
        private static final int WINDOW_HEIGHT = 700;
       
        private static URL url = null;
       
        private int simulationStage = 0; // 0->init, 1->prima visualizzazione
       
        private Receiver receiver;
        private Sender sender;
        private ObjectsUpdater updater;
       
        private HashMap objList;
       
        private UniverseManager universe;
       
        private Camera camera;
       
        public OSESKeyNav() { }
       
    public OSESKeyNav( String host )
    {
        receiver = new Receiver( host );

        objList = new HashMap();
       
        setLayout(new BorderLayout());
       
            GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
       
            Canvas3D canvas3D = new Canvas3D( config );
        canvas3D.setSize( WINDOW_WIDTH, WINDOW_HEIGHT );
        add("North", canvas3D);
               
        universe = new UniverseManager();
       
        createSceneGraph();
       
        updater = new ObjectsUpdater( objList, receiver );
                updater.start();
               
                addCamera( canvas3D );
               
        universe.makeLive();
    }

    private void createSceneGraph()
    {
        ...
    }
   
    private void addCamera( Canvas3D canvas )
    {
        ....
    }
   
       
        public void init()
        {
                url = getCodeBase();
        String host = url.getHost();
       
        OSESKeyNav applet = new OSESKeyNav( host );
        new MainFrame(applet, WINDOW_WIDTH, WINDOW_HEIGHT);
           
           
        }

}


When I try to view this applet with my browser JVM returns this exception

java.security.AccessControlException: access denied
(java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertiesAccess(Unknown Source)
at java.lang.System.getProperties(Unknown Source)
at com.sun.j3d.utils.applet.MainFrame.build(Unknown Source)
at com.sun.j3d.utils.applet.MainFrame.<init>(Unknown Source)
at OSESKeyNav.init(OSESKeyNav.java:186)//-------------------------new
MainFrame(applet, WINDOW_WIDTH, WINDOW_HEIGHT);
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

I don't know where is the problem.
I tried to use a JPanel instead of MainFrame: the errors disappears but I
don't see the canvas3d.
Please help me!:)

Thanks to all!
(sorry for my bad english)
Back to top
Oliver Wong
Guest





PostPosted: Wed May 10, 2006 7:07 pm    Post subject: Re: Problem with MainFrame class in JApplet Reply with quote



"Japs" <aaa (AT) aaa (DOT) no> wrote in message
news:v7N7g.114298$A83.2710577 (AT) twister1 (DOT) libero.it...
Quote:
Hi all!
I'm new to this NG so I'll try to explain my problem.
I'm using JAVA3D into a JApplet. This is the code

[code snipped]
When I try to view this applet with my browser JVM returns this exception

java.security.AccessControlException: access denied
(java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(Unknown
Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertiesAccess(Unknown Source)
at java.lang.System.getProperties(Unknown Source)
at com.sun.j3d.utils.applet.MainFrame.build(Unknown Source)
at com.sun.j3d.utils.applet.MainFrame.<init>(Unknown Source)
at
OSESKeyNav.init(OSESKeyNav.java:186)//-------------------------new
MainFrame(applet, WINDOW_WIDTH, WINDOW_HEIGHT);
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Have you tried signing your applet?

- Oliver
Back to top
Japs
Guest





PostPosted: Thu May 11, 2006 8:07 am    Post subject: Re: Problem with MainFrame class in JApplet Reply with quote



Oliver Wong wrote:

[CUT]
Quote:

Have you tried signing your applet?

- Oliver

No, but just a few mintutes ago I solved the problem. Thanks however! Smile
Japs
Back to top
Thomas Hawtin
Guest





PostPosted: Fri May 12, 2006 6:07 pm    Post subject: Re: Problem with MainFrame class in JApplet Reply with quote

Japs wrote:
Quote:
Oliver Wong wrote:

[CUT]
Have you tried signing your applet?

- Oliver

No, but just a few mintutes ago I solved the problem. Thanks however! Smile
Japs

Could you share with the rest of us what your problem was and how you
solved it? Other people are likely to come across the same issue.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
Back to top
Japs
Guest





PostPosted: Sat May 13, 2006 11:07 am    Post subject: Re: Problem with MainFrame class in JApplet Reply with quote

Instead of using

new MainFrame(applet, WINDOW_WIDTH, WINDOW_HEIGHT);

I use the add() inherited method. The init() method becomes like this

Code:

public void init()
        {
                url = getCodeBase();
        String host = url.getHost();

        OSESKeyNav applet = new OSESKeyNav( host );
        add( applet );

        }


I hope this could help you! Thanks to all Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> 3D Graphics API's for Java All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.