Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

applet bail, notinited or even just dead

807591Jun 16 2008 — edited Jun 20 2008
Hello,

I'm currently writing a little JApplet but it doesn't like to run correctly on some machines.
I tested several combinations of Windows 2000 and XP with FF2, Safari, IE6 and 7 and
some Opera I think too. All these run ok.
But on Linux Ubuntu 8.04 (unfortunatley brings FF3RC1, but also with Epiphany 2.22.2)
the Applet shows bad behaviour after reloading to page. And A friend also tells me that
was not able to run it on some MacOSX machine unsing Safari and FF ("gives a little
red cross").
So under Linux the Browser tells me either the Applet would be "bail", "notinited" or
even "dead". In the Java Console I can read things about an InterruptedException. And
there was also one time another exception about "Thread" and "dead" or something,
I cant remember exactly what it was and I can't bring up the same error message again.

So I made a little test applet:
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.*;

import javax.swing.*;


public class testcase extends JApplet implements KeyListener, ActionListener
{
	public static final long serialVersionUID = 1L;

	JPanel panel1;
	JTextArea eingabe;

	public static void main(String[] args) {
		JApplet applet = new testcase();
		applet.init();
		final JFrame frame = new JFrame("TestCase");
		frame.setContentPane(applet.getContentPane());
		frame.addWindowListener(new WindowAdapter() { 
			public void windowClosing(WindowEvent e) {
				frame.dispose();
				System.exit(0);
			}
		});
		frame.setSize(600,600);
		frame.setLocation(0,0);
		frame.setVisible(true);
		applet.start();
	}
	public void build_window_layout() {
		panel1 = new JPanel();
		panel1.setLayout(new BorderLayout());
		eingabe=new JTextArea("moin");
		eingabe.addKeyListener(this);
		panel1.add(eingabe);
		getContentPane().add(panel1);
	}

	public void init() {
		System.out.println("init");
		build_window_layout();
	}
	
	public void start() {
	    System.out.println("start");
	}

	public void stop() {
	    System.out.println("stop");
	}

	public void destroy() {
	    System.out.println("destroy");
	}

	public void keyPressed(KeyEvent ev) { 
	    System.out.println("key pressed");
	}
	
	public void keyReleased(KeyEvent ev) {
	    System.out.println("key released");
	}
	
	public void keyTyped(KeyEvent ev) {
	    System.out.println("key typed");
	}

	public void actionPerformed(ActionEvent e) {
	    System.out.println("action");
	}

} 
I'd be happy if someone could give me a hint about where the problem is.

Thanks a lot,
your Leander

ps. most of the test machines run 1.6 only the Mac/Safari was on 1.5 afaik,
also the Mac/FF gave 1.6 as version info in the agent field of the httpd's log
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2008
Added on Jun 16 2008
5 comments
132 views