Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Java 3D / May 2006

Tip: Looking for answers? Try searching our database.

Problem with MainFrame class in JApplet

Thread view: 
Japs - 08 May 2006 20:39 GMT
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);
           
           
       }

}
[/CODE]

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)
Oliver Wong - 10 May 2006 18:11 GMT
> 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
>
[quoted text clipped - 13 lines]
>        at sun.applet.AppletPanel.run(Unknown Source)
>        at java.lang.Thread.run(Unknown Source)

   Have you tried signing your applet?

   - Oliver
Japs - 11 May 2006 08:23 GMT
[CUT]

>     Have you tried signing your applet?
>
>     - Oliver

No, but just a few mintutes ago I solved the problem. Thanks however! :)
Japs
Thomas Hawtin - 12 May 2006 17:45 GMT
> [CUT]
>>     Have you tried signing your applet?
[quoted text clipped - 3 lines]
> 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
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Japs - 13 May 2006 11:31 GMT
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 :-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.