Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application blocked by security settings?

Status
Not open for further replies.

gatorbrown

Programmer
Jun 6, 2013
1
US
My java applet yields the "Application blocked by security settings" dialog. It occurs whether I use FireFox or IExplorer. I've tried adjusting all the security settings I can find and the browsers' Java applet appears to be enabled. This same behavior occurs on my desktop computer running Xp, or my laptops running Vista. The applet is pretty simple:
"
import javax.swing.*;
import java.awt.event.*;

public class LottoApplet extends JApplet implements ActionListener
{
// Components.
JPanel pnl = new JPanel();
ClassLoader ldr = this.getClass().getClassLoader();
java.net.URL imageURL = ldr.getResource("Lotto.png");
ImageIcon icon = new ImageIcon( imageURL );
JLabel img = new JLabel(icon);
JTextField txt = new JTextField( "", 18 );
JButton btn = new JButton("Get My Lucky Numbers");

// Applet entry point.
public void init()
{

pnl.add( img );
pnl.add( txt );
pnl.add( btn );
btn.addActionListener( this );

// Background color selecter.
String bgStr = getParameter("BgColor");
int bgHex = Integer.parseInt( bgStr, 16 );
pnl.setBackground( new java.awt.Color( bgHex ));

add( pnl );
}

// Event-handler.
public void actionPerformed( ActionEvent event )
{
if( event.getSource() == btn )
{
// Declare working variables.
int[] nums = new int[50];
String str = "";

// Fill elements 1-49 with integers 1-49.
for( int i = 1; i < 50; i++ ) { nums = i; }

// Shuffle the values in elements 1-49.
for( int i = 1; i < 50; i++ )
{
int r = (int) Math.ceil(Math.random() * 49) ;
int temp=nums; nums=nums[r]; nums[r]=temp;
}

// Display the values in elements one to six.
for ( int i = 1; i < 7; i++ )
{
str += " " + Integer.toString(nums[ i ]) + " ";

}
txt.setText( str );
}
}
}
"
Any suggestions?

 
Well, the problem is with the net access. Is the applet signed? If not you can try modifying the java.policy file as shown here

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top