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 / General / October 2006

Tip: Looking for answers? Try searching our database.

how do Java handle JFrames from applet..

Thread view: 
JTapio - 16 Oct 2006 20:15 GMT
Hei!

i have a simple applet..
my applet only creates one JFrame with Canvas on nothing else..

my problem is that my applet and JFrame both work just fine on my netbeans
IDE applet viewer..
but, when i browse my homesite with opera9 i end up resulting 'applet
crashed'..

so my question is, is there somekind of a rule for opening JFrames from
webpages or why my applet crashes..

:: my 'very simple' code ::

import java.applet.Applet;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import javax.swing.JFrame;

public class NewApplet extends Applet
{
   JFrame frame;

   public void init()
   {
       frame.setDefaultLookAndFeelDecorated(true);
       frame = new JFrame("my very first frame..");

       BSMCanvas region = new BSMCanvas();

       frame.add(region);
       frame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.setVisible(true);

   }

   public void stop ()
   {}
   public void destroy ()
   {}

   public void run ()
   {

   }
}

class BSMCanvas extends Canvas
{
       public BSMCanvas ()
       {
           setSize(800, 800);
           setBackground(Color.blue);
       }

       public void paint(Graphics g){
               update(g);
}

public void update(Graphics g){
               Graphics2D g2 = (Graphics2D)g;
       }
 }

Yours : JariTapio
Homepage : www.EuroJari.net
EMail : JariTapio@EuroJari.net
Andrew Thompson - 17 Oct 2006 04:16 GMT
....
> i have a simple applet..
> my applet only creates one JFrame with Canvas on nothing else..

You seem to have an obsession with canvas's, despite
that an AWT canvas does not sit well in a Swing JFrame
(go on - try some menus - I dare you)

> my problem is that my applet and JFrame both work just fine on my netbeans
> IDE applet viewer..
> but, when i browse my homesite with opera9 i end up resulting 'applet
> crashed'..

Please be specific and clear with all errors and exceptions.
Copy/paste at least the first few lines of them.

> so my question is, is there somekind of a rule for opening JFrames from
> webpages or why my applet crashes..

Rule 1 wold be 'read and understand the exception
in the console'

java.security.AccessControlException: access denied
 (java.lang.RuntimePermission exitVM)
.....
    at NewApplet.init(NewApplet.java:26)

Andrew T.


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.