Sagewire Logo

Problem with MainFrame class in JApplet

5 Message(s) by 3 Author(s) originally posted in 3d java


From: Japs Date:   Monday, May 08, 2006
Hi all!
I'm new to this NG so I will try to explain my problem.
I'm using JAVA3D int o 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);


}

}
[/CODE]

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

JAVA.security.Access ControlException: 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 do not know where is the problem.
I tried to use a JPanel instead of MainFrame: the errors disappears but I
do not see the canvas3d.
Please help me!:)

Thanks to all!
(sorry for my bad english)


From: Oliver Wong Date:   Wednesday, May 10, 2006
Hi all!
I'm new to this NG so I will 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


From: Japs Date:   Thursday, May 11, 2006
wrote in message:

[CUT]
Have you tried signing your applet?
- Oliver



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


From: Thomas Hawtin Date:   Friday, May 12, 2006
wrote in message:
wrote in message:
[CUT]
Have you tried signing your applet?

- Oliver
No, but just a few mintutes ago I solved the problem. Thanks however! :)
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/


From: Japs Date:   Saturday, May 13, 2006
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 );

}
[/CODE]

I hope this could help you! Thanks to all :-)



Next Message: Shapes with unique surfaces



Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional