Applets, icons and JFrame

Hi!
I'm an applet's begginer ... So I really want you to help me.
Well, I've made a text editor using a JFrame. So, now I want to put it into an applet.
This editor contains many icons, when I run the application it works fine, but when I run the applet an error ocurrs ... A security error
This is the error:
java.security.AccessControlException: access denied (java.io.FilePermission icons/copy.gif read)
     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
     at java.security.AccessController.checkPermission(AccessController.java:401)
     at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
     at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
     at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:408)
     at sun.awt.SunToolkit.getImage(SunToolkit.java:422)
     at javax.swing.ImageIcon.<init>(ImageIcon.java:81)
     at javax.swing.ImageIcon.<init>(ImageIcon.java:107)
     at TriangleEditor.makeActionsPretty(TriangleEditor.java:435)
     at TriangleEditor.<init>(TriangleEditor.java:44)
     at EditorApplet.init(EditorApplet.java:6)
     at sun.applet.AppletPanel.run(AppletPanel.java:341)
     at java.lang.Thread.run(Thread.java:536)
I was wondering if you could help me!!
Thank you so much

It looks like you're trying to read your icons from the local disk--that's a no-no for (unsigned) applets.
Change your applet to fetch the icons from the same host from which the applet comes.

Similar Messages

  • How do you make an array of image icons and then call them?

    How do you make an array of image icons and then call them, i have searched all over the internet for making an array of icons, but i have
    found nothing. Below is my attempt at making an array of icons, but i cant seem to make it work. Basically, i want the image to match the value of the roll of the dice (rollVal)
    Any help would be greatly appreciated, some code or link to tuturial, ect.
    /** DiceRoller.java
    * Roll, print, Gui
    import javax.swing.*;
    public class DiceRoller extends JFrame
         private ImageIcon[] image  ;
         public String[] images = { "empty", "dice1.jpg",
                   "dice2.jpg", "dice3.jpg", "dice4.jpg",
                   "dice5.jpg", "dice6.jpg" };
         public Dice die;
         private int rollVal;
         public int rollNum;
         private JLabel j1;
         public DiceRoller(){
              j1= new JLabel("");
           die =new Dice();
           int rollVal;
           rollVal = die.roll();     
           image = new  ImageIcon[images.length];
         for(int i = 0; i < images.length; i++){
          image[i] = new ImageIcon(images);
         if (image!=null){
              j1.setIcon(image[rollVal]);
         System.out.println("Roll = "+die.roll());

    Demo:
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class IconExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch();
        static void launch() {
            try {
                Icon[] icons = new Icon[6];
                for(int i=0; i<icons.length; ++i) {
                    String url = "http://www.eureka-puzzle.be/cast/images/dice" + (i + 1) + ".jpg";
                    icons[i] = new ImageIcon(new URL(url));
                display(icons);
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
        static void display(Icon[] icons) {
            JPanel cp = new JPanel();
            for(Icon icon : icons) {
                cp.add(new JLabel(icon));
            JFrame f = new JFrame();
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Heavyweight object of an Icon and JLabel

    Hi there,
    I would like to know how can I create a heavyweight object that has a JLabel and an Icon and then add it to a JFrame. this heavyweight object would be something like this
    public class TestObject extends JPanel
    ..public TestObject( String LabelName )
    ....theLabel = new JLabel( LabelName );
    ....add( theIcon ); // I cant add the Icon here, because it's not a Component
    ....add( theLabel );
    ..private JLabel theLabel;
    ..private Icon theIcon = new ImageIcon( "littleIcon.gif" );
    Thanks,
    Andre

    Using the following class I could draw a JLabel that has an ImageIcon, but it doesn't matter what the value of the horizontalAlignment ( LEFT, CENTER, RIGHT, LEADING or TRAILING ) the icon was always at the left side and the string at the right. Is there a way to put the Icon on the top and the String at the button of the Label?
    public class TestObject extends JPanel
    public TestObjectent( String LabelName )
    theIcon = new ImageIcon( "littleIcon.gif" );
    theLabel = new JLabel( LabelName theIcon, SwingConstants.TRAILING );
    add( theLabel );
    private Icon theIcon;
    private JLabel theLabel;
    Thanks,
    Andre

  • Gnome applet Icons Missing

    I installed a fresh arch linux on another pc.  I installed gnome and gnome-extras. There is one problem:
    The icons on the "system tray" are missing. The applets are there but the icons are not shown:
    I already rebuilt the hicolor and gnome icons (and re-logged) with no result. Am I missing something?

    Ok here is something weird I found out.
    I am using xorg without xorg.conf. Since I have a Voodoo3 card I installed the xf86-video-tdfx driver. After a xorg restart the icons are working but the mouse flickers when I move it and there are graphic bugs when restoring windows.
    So I removed the tdfx driver and reverted to the vesa driver. The mouse does not flicker anymore but the applet icons are gone.

  • Admin Applet icons not visible

    Hi Guys,
    I have installed UCM on server with apache as web server and java 1.5.
    UCM installed successfully..but what i found is admin applet icons are visible if i open my content server from local system but when i use server system IP and try to open UCM from remote desktop admin applet icon are not visible.
    Is this java version error. How can i resolve it?
    Thanks & Regards,
    Sunil

    Hi Sunil,
    I might sound like I'm repeating but you said you have Java 1.5 on your desktop which is fine cause you can see it from there but.. do you have 1.5 for the <u>browser you're using in the remote desktop</u>? Because this is surely a browser JRE issue.
    Go to the browser properties and look for the JRE your browser is using:
    i.e IE explorer: Internet Options->Advanced Tab-> scroll down until you find the Java option and make sure JRE 1.5 (or later) is being used.
    Let us know

  • JLabel Icon and Text

    Hi,
    I am creating a JLabel and setting an ICon with setIcon method. The label has a square border and a text. The Icon covers the the label with "X" form corner to corner on the square border. I can't see the text after setting the Icon. I tried to set the text after Icon, still it is hidden.
    So what should I do to display the Icon and Text at the same time and want the text to be visible.
    thanks,
    NT

    public static void main(String[] args)
    JFrame jf = new JFrame();
    jf.setSize(500, 250);
    JPanel jp = new JPanel();
    jp.setSize(250, 250);
    jp.setLayout(null);
    ImageIcon im = new ImageIcon("4.gif");
    JLabel jl = new JLabel();
    jl.setOpaque(true);
    jl.setBounds(0, 0, 150, 16);
    jl.setBorder(new LineBorder(Color.BLACK));
    jl.setText("NAME");
    jl.setIcon(im);
    jp.add(jl);
    jf.add(jp);
    jf.setVisible(true);
    this sets the icon and the text, but the icon is first and then the text. I want the icon on top of Text.
    thanks,
    NT

  • Asking about icon and mouselistener

    i think i post this thread before but it was gone. so i post it again.
    anybody knows how to insert icon in JFrame? so far, it can only implemented in JPanel. and somebody help me how to make icon larger than before and show some tooltip when mouse select it? in my mind, we just add listener when mouse over image, then setTooltips. is it right?

    i think i post this thread before but it was gone. so i post it again. Quit cluttering the forum with multiple postings and learn how to use the forum properly.
    You can find you postings by:
    a) displaying your "Watch List" which can be found on the left of the forum when you are logged in
    b) searching the forum for any posting that contains your userid
    Also, Swing related questions should be posted in the Swing forum, but there is no need to create a third posting because you already got an answer in your first posting so all you need to do is find it.

  • Problem when setting icon for Jframe.....

    Hi.....
    Iam trying to change the icon of jframe.Iam using the following code.
    Toolkit tk = frame.getToolkit();
    Image ic = tk.getImage("icons/abc.ico");
    frame.setIconImage(ic);
    But iam unable to see the icon.In the place of icon empty box is coming.
    Any help regarding this will be highly appreciated.
    Thanks and Regards,
    Kumar.

    dunno if you can use an ico format, try gif, tif et al
    thomas

  • I click on my g-mail icon and now it won't open.  Why?

    I click on my g-mail icon and it refuses to open - respond?

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • I downloaded the latest update for my ipad and now it won't open.  the screen shows the itunes icon and a pic of the usb cable

    I downloaded the latest update for my ipad and now it won't open.  the screen shows the itunes icon and a pic of the usb cable

    That message means that you have to restore the iOS software because something went wrong. Follow the instructions here. I hope that you have a backup.
    iTunes: Restoring iOS software - Support - Apple

  • Lost SMS Icon and get error message Uncaught exception Index 20 = 20

    Dear All
    I have lost my SMS Icon and looking at previous forums have carried out the following techniques which do not work
    1. I have gone to Messages - Options - SmS & Email Inboxes - Seperate but this does not solve anything
        Within this step i have switched off phone taken out battery etc...
    2. I have gone to Applications - menu - "show all" but my SMS icon cannot be found
    Just to note even when i go to Messages - View Folder - SMS Inbox .....i get the error message again  
    Uncaught exception Index 20 > = 20
    Anyone able to help ? Would be greatly appreciated.
    Thanks

    You may have already figured out your fix - but yesterday I went thru the same thing with my son's phone.  Overnight he lost his SMS & MMS Icon and was receiving Uncaught Exception Index 28 >= 28.  I called Verizon Tech Support and was told there was a corrupt file in the calendar. 
    We backed up the phone using the Desktop Manager - performed a security wipe and restored his phone. 
    His phone is back up and running as it should be.  Hope this helps.
     Laura

  • The app icons and font on my iPhone 4 just went to massive making it difficult to even scroll how can I change it back, where do I go which menu? Thanks in advance

    The app icons and font on my iPhone 4 just went to massive making it difficult to even scroll how can I change it back, where do I go which menu? Thanks in advance

    Next time you accidentally use 3 fingers it will zoom again. Unless you need the feature you're better to turn it off

  • Apple TV does not work after trying to update software. Main light keeps blinking and on the screen shows itunes icon and a usb cable. What does that means?

    My Apple TV does not work after trying to install the new software update. The main light keeps blinking rapidly and on the screen it shows the itunes icon and a USB cable. What does that mean?

    The Apple TV is in recovery mode. Try to restore the Apple TV. Follow the link for instructions on the restore process.
    http://support.apple.com/kb/HT4367

  • I have installed Adobe Premiere Pro cc on my laptop, but I cant find a way to start the program. No Icon, and it is not showing up in the start meny. It is showing up in add/remove programs, but nt anywhere else.

    I have installed Adobe Premiere Pro cc on my laptop, but I cant find a way to start the program. No Icon, and it is not showing up in the start meny. It is showing up in add/remove programs, but nt anywhere else.

    If you are using a Mac, simply hit Command-Spacebar to bring up Spotlight Search.  Begin typing the name of the application and when you see what you are looking for, press enter.  You should get a hit by the second or third letter you type.  Great way to launch apps on computers that you are not familiar with.
    Windows 7 and 8 should have something similar.  I think you simply press the Windows key and begin typing.  Press enter when you see a match.
    Both Mac and Windows search tools can be customized to search for applications, files, emails and so forth.  For Windows, look for Taskbar and Start Menu Properties.  For Mac, go to Preferences Spotlight.  Turn off items you know you won't need to speed up searches.
    Make Windows 7 Start Menu Search Find Your Applications Faster

  • Photoshop CC icons and text are too small: how to adjust so they're readable? [was: Joanne]

    I have just downloaded Creative Cloud on a new computer.  The new photoshop icons and text are too small for me to see or work with.  I cannot seem to adjust this so its "useable"

    Hey Bob,
    Ive put feature requests for this in before and I know many others have as well. Is there any way to see if Adobe is actually working on this? I dont really consider this a feature request, it should be standard with the software. A feature request would be something like creative cloud libraries, not the ability to make font sizes and icons bigger.

Maybe you are looking for

  • Remove a background job

    Hi, I have a background job scheduled. This i have done for testing purpose. Now i want to stop the job from executing as it was only for testing purpose. I have tried using SM36 and SM37 but was not able to delete the job. Please tell me what to do

  • Problem viewing TV through HDMI cable- displays unavailable

    I am unable to see my mac on my TV (Samsung Smart TV), I have a Macbook Pro from mid 2010, connected with a Belkin Mini DisplayPort to HDMI cable, and the latest software update, OSX 10.9.1, when I go to Displays I can not see gather windows, or any

  • All is good on my end Plzs read

    Why all of   You are having  a lot of bugs going on from upgrading too ios 6 then doing a  retore too when you 1st got it out of the box my new iPad and my new iPhone 4S is all working well with out any bugs at all. In fac doing a restore from out of

  • Problem with text in Brush Stroke motion menu

    Hi, I am using the Brush Stroke motion menu, which is designed to have the text within the brushstoke appear gradually as the brushstroke moves across the screen. That worked fine, until I went to change the color of the fonts. Something happened, an

  • Flash issue:  Contribute does not put the  id property in the object tag.

    Notice the id property in the object tag. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="550" height="400" id="source2"> Well Contri