Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Adriano 'Stanley'

Há algum problema em usar InternalFrames em um applet????

Recommended Posts

E ae pessoal. É o seguinte... tenho uma classe que fica responsável por lançar InternalFrames. Ela funciona como aplicativo perfeitamente! Mas ao chamá-la em um applet os InternalFrames não aparecem! Segue os códigos... se puderem me ajudar! :)

 

//esse é o método dentro da classe DesktopFrame que lança os internal frames:public void lancarMapa(){	   JInternalFrame frame = new JInternalFrame( 			   "Internal Frame", true, true, true, true );	   MyJPanel panel = new MyJPanel(); // create new panel	   frame.add( panel, BorderLayout.CENTER ); // add panel	   frame.pack(); // set internal frame to size of contents	   theDesktop.add( frame ); // attach internal frame	   frame.setVisible( true ); // show internal frame	   frame.setSize(500,380);	   frame.setResizable( false );	   frame.setMaximizable( false );}
import java.awt.BorderLayout;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JApplet;import javax.swing.JButton;import javax.swing.JPanel;public class appletJF extends JApplet{	private Container container;	private JButton botao = new JButton();	private JPanel panelPrincipal = new JPanel();		private DesktopFrame desktopFrame = new DesktopFrame();		/**	 * Construtor appletJF;	 *	 */	public appletJF()	{		//setLayout( new BorderLayout() );				//botao.setBounds(250, 10, 80, 40);		botao.setText("adicionar");		botao.addActionListener(				new ActionListener() // anonymous inner class				{  					//display new internal window					public void actionPerformed( ActionEvent event ) 					{						desktopFrame.lancarMapa();					} // end method actionPerformed				} // end anonymous inner class		);				panelPrincipal.add( botao );				container = getContentPane();		container.setLayout( new BorderLayout() );		container.add( panelPrincipal, BorderLayout.EAST );	}	}
Vlw pessoal!

 

Os erros que aparecem:

 

Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.net.SocketPermission 200.131.219.53:8080 connect,resolve)	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.checkConnect(Unknown Source)	at sun.awt.SunToolkit.createImage(Unknown Source)	at MyJPanel.atualizaMapa(DesktopFrame.java:142)	at MyJPanel.<init>(DesktopFrame.java:114)	at DesktopFrame.lancarMapa(DesktopFrame.java:80)	at appletJF$1.actionPerformed(appletJF.java:37)	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)	at java.awt.Component.processMouseEvent(Unknown Source)	at javax.swing.JComponent.processMouseEvent(Unknown Source)	at java.awt.Component.processEvent(Unknown Source)	at java.awt.Container.processEvent(Unknown Source)	at java.awt.Component.dispatchEventImpl(Unknown Source)	at java.awt.Container.dispatchEventImpl(Unknown Source)	at java.awt.Component.dispatchEvent(Unknown Source)	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)	at java.awt.Container.dispatchEventImpl(Unknown Source)	at java.awt.Component.dispatchEvent(Unknown Source)	at java.awt.EventQueue.dispatchEvent(Unknown Source)	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)	at java.awt.EventDispatchThread.run(Unknown Source)

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ou melhor, pessoal, se alguém tiver um exemplo, por mais simples que seja; até mesmo de um internal frame vazio abrindo em um applet, se pudesse me enviar (adrianostanley@gmail.com) eu ficaria muito grato!!Obrigado!

E ae pessoal. É o seguinte... tenho uma classe que fica responsável por lançar InternalFrames. Ela funciona como aplicativo perfeitamente! Mas ao chamá-la em um applet os InternalFrames não aparecem! Segue os códigos... se puderem me ajudar! :)

//esse é o método dentro da classe DesktopFrame que lança os internal frames:public void lancarMapa(){	   JInternalFrame frame = new JInternalFrame( 			   "Internal Frame", true, true, true, true );	   MyJPanel panel = new MyJPanel(); // create new panel	   frame.add( panel, BorderLayout.CENTER ); // add panel	   frame.pack(); // set internal frame to size of contents	   theDesktop.add( frame ); // attach internal frame	   frame.setVisible( true ); // show internal frame	   frame.setSize(500,380);	   frame.setResizable( false );	   frame.setMaximizable( false );}
import java.awt.BorderLayout;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JApplet;import javax.swing.JButton;import javax.swing.JPanel;public class appletJF extends JApplet{	private Container container;	private JButton botao = new JButton();	private JPanel panelPrincipal = new JPanel();		private DesktopFrame desktopFrame = new DesktopFrame();		/**	 * Construtor appletJF;	 *	 */	public appletJF()	{		//setLayout( new BorderLayout() );				//botao.setBounds(250, 10, 80, 40);		botao.setText("adicionar");		botao.addActionListener(				new ActionListener() // anonymous inner class				{  					//display new internal window					public void actionPerformed( ActionEvent event ) 					{						desktopFrame.lancarMapa();					} // end method actionPerformed				} // end anonymous inner class		);				panelPrincipal.add( botao );				container = getContentPane();		container.setLayout( new BorderLayout() );		container.add( panelPrincipal, BorderLayout.EAST );	}	}
Vlw pessoal!Os erros que aparecem:
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.net.SocketPermission 200.131.219.53:8080 connect,resolve)	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.checkConnect(Unknown Source)	at sun.awt.SunToolkit.createImage(Unknown Source)	at MyJPanel.atualizaMapa(DesktopFrame.java:142)	at MyJPanel.<init>(DesktopFrame.java:114)	at DesktopFrame.lancarMapa(DesktopFrame.java:80)	at appletJF$1.actionPerformed(appletJF.java:37)	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)	at java.awt.Component.processMouseEvent(Unknown Source)	at javax.swing.JComponent.processMouseEvent(Unknown Source)	at java.awt.Component.processEvent(Unknown Source)	at java.awt.Container.processEvent(Unknown Source)	at java.awt.Component.dispatchEventImpl(Unknown Source)	at java.awt.Container.dispatchEventImpl(Unknown Source)	at java.awt.Component.dispatchEvent(Unknown Source)	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)	at java.awt.Container.dispatchEventImpl(Unknown Source)	at java.awt.Component.dispatchEvent(Unknown Source)	at java.awt.EventQueue.dispatchEvent(Unknown Source)	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)	at java.awt.EventDispatchThread.run(Unknown Source)

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ou melhor, pessoal, se alguém tiver um exemplo, por mais simples que seja; até mesmo de um internal frame vazio abrindo em um applet, se pudesse me enviar (adrianostanley@gmail.com) eu ficaria muito grato!!Obrigado!

E ae pessoal. É o seguinte... tenho uma classe que fica responsável por lançar InternalFrames. Ela funciona como aplicativo perfeitamente! Mas ao chamá-la em um applet os InternalFrames não aparecem! Segue os códigos... se puderem me ajudar! :)

//esse é o método dentro da classe DesktopFrame que lança os internal frames:public void lancarMapa(){	   JInternalFrame frame = new JInternalFrame( 			   "Internal Frame", true, true, true, true );	   MyJPanel panel = new MyJPanel(); // create new panel	   frame.add( panel, BorderLayout.CENTER ); // add panel	   frame.pack(); // set internal frame to size of contents	   theDesktop.add( frame ); // attach internal frame	   frame.setVisible( true ); // show internal frame	   frame.setSize(500,380);	   frame.setResizable( false );	   frame.setMaximizable( false );}
import java.awt.BorderLayout;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JApplet;import javax.swing.JButton;import javax.swing.JPanel;public class appletJF extends JApplet{	private Container container;	private JButton botao = new JButton();	private JPanel panelPrincipal = new JPanel();		private DesktopFrame desktopFrame = new DesktopFrame();		/**	 * Construtor appletJF;	 *	 */	public appletJF()	{		//setLayout( new BorderLayout() );				//botao.setBounds(250, 10, 80, 40);		botao.setText("adicionar");		botao.addActionListener(				new ActionListener() // anonymous inner class				{  					//display new internal window					public void actionPerformed( ActionEvent event ) 					{						desktopFrame.lancarMapa();					} // end method actionPerformed				} // end anonymous inner class		);				panelPrincipal.add( botao );				container = getContentPane();		container.setLayout( new BorderLayout() );		container.add( panelPrincipal, BorderLayout.EAST );	}	}
Vlw pessoal!Os erros que aparecem:
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.net.SocketPermission 200.131.219.53:8080 connect,resolve)	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.checkConnect(Unknown Source)	at sun.awt.SunToolkit.createImage(Unknown Source)	at MyJPanel.atualizaMapa(DesktopFrame.java:142)	at MyJPanel.<init>(DesktopFrame.java:114)	at DesktopFrame.lancarMapa(DesktopFrame.java:80)	at appletJF$1.actionPerformed(appletJF.java:37)	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)	at java.awt.Component.processMouseEvent(Unknown Source)	at javax.swing.JComponent.processMouseEvent(Unknown Source)	at java.awt.Component.processEvent(Unknown Source)	at java.awt.Container.processEvent(Unknown Source)	at java.awt.Component.dispatchEventImpl(Unknown Source)	at java.awt.Container.dispatchEventImpl(Unknown Source)	at java.awt.Component.dispatchEvent(Unknown Source)	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)	at java.awt.Container.dispatchEventImpl(Unknown Source)	at java.awt.Component.dispatchEvent(Unknown Source)	at java.awt.EventQueue.dispatchEvent(Unknown Source)	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)	at java.awt.EventDispatchThread.run(Unknown Source)
É o seguinte mano , dá uma lida neste artigo que eu achei na net.Estou com o mesmo problema que você , pelo que eu decobri tenho que primeiro assinar o applet e depois configurar o java.policy dando permissão de acesso.No seu caso vai ser fácil pq este link dá permissão para uma url como você quer, no meu caso o erro é de diretório.Assinando AppletSe funcionar me avise..... http://forum.imasters.com.br/public/style_emoticons/default/thumbsup.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

e ae rapaz... vlw! eu consegui assinar o applet de acordo com este e um outro tutorial usado.porém, o applet assinado fica armazenado em um .jar.como eu faço pra carregar esse .jar em um documento .html????? é diferente de chamar um .class!vlw rapaz!

Compartilhar este post


Link para o post
Compartilhar em outros sites

e ae rapaz... vlw! eu consegui assinar o applet de acordo com este e um outro tutorial usado.

 

porém, o applet assinado fica armazenado em um .jar.

 

como eu faço pra carregar esse .jar em um documento .html????? é diferente de chamar um .class!

 

vlw rapaz!

Vou colocar a sintaxe do htm aqui ....

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Título da Página</title><applet archive=SeuArquivo.jar code=pacote\Classe principal da aplicação.class width=800 height=450></applet><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><h1>

Completo ...para a minha aplicação

 

<html><head><title>Método de Newton</title><applet archive=MetodoNewton.jar code=br\com\davidson\principal\MetodoNewton.class width=800 height=450></applet><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
Entendeu ? :unsure:

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.