Erros de exception continuos - help

2 respostas
P

SEGUE ABAIXO O CODIGO E O ERRO, ESTA ACONTECENDO COM TODAS AS CLASSES Q EXECUTO!

8O - CODIGO

import java.awt.<em>;

import java.awt.event.</em>;

import javax.swing.*;

public class TexImag extends JFrame{

JLabel L1,L2,L3,L4;
ImageIcon icone = new ImageIcon("c:/Adriano/Adriano/Minhas Imagens/celular.jpeg");

TexImag()
{
	setTitle("Inserindo Labels e Imagens na Janela");
	setSize(350,120);
	setLocation(50,50);
	getContentPane().setBackground(new Color(220,220,220));
	L1 = new JLabel("Aprendendo",JLabel.LEFT);
	L1.setForeground(Color.RED);
	L2 = new JLabel(icone);
	L3 = new JLabel("Inserir",JLabel.RIGHT);
	L3.setForeground(Color.BLUE);
	L4 = new JLabel("Labels e imagens",icone,JLabel.CENTER);
	L4.setFont(new Font("Verdana",Font.BOLD,20));
	L4.setForeground(Color.BLACK);
	getContentPane().setLayout(new GridLayout(4,1));
	getContentPane().add(L1);
	getContentPane().add(L2);
	getContentPane().add(L3);
	getContentPane().add(L4);
}

public static void main(String[] args) {
	JFrame Janela = new TexImag();
	Janela.show();
	WindowListener x = new WindowAdapter()
	{
		public void windowClosing(WindowEvent e)
		{
			System.exit(0);
		}
	};
	Janela.addWindowListener(x);
}

}

ERRO

load: TexImag.class is not public or has no public constructor.

java.lang.IllegalAccessException: Class sun.applet.AppletPanel can not access a member of class TexImag with modifiers “”

at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at sun.applet.AppletPanel.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

2 Respostas

F

pelo codigo parece ser uma aplicacao stand-alone, mas pelo erro parace q vc esta tentando executar como se fosse um applet… sera se n eh isso?

P

:grin: - eh isso mesmo estava executando uma APPLET e não a aplicação… obrigado!!

Criado 26 de novembro de 2004
Ultima resposta 26 de nov. de 2004
Respostas 2
Participantes 2