Results 1 to 4 of 4
- 10-22-2008, 06:03 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 1
- Rep Power
- 0
Converting netbeans app to applet
Hi, i'm writing a tictactoe game for uni course and am trying to implement it in a browser to run as an applet. The Java console produces there errors..
ava.lang.ClassCastException: gui.Frame cannot be cast to java.applet.Applet
at sun.plugin2.applet.Plugin2Manager.createApplet(Unk nown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassCastException: gui.Frame cannot be cast to java.applet.Applet
I have changed the closeonexitprocedure to none, this was causing a problem with security violation. I believe my problem now is that i need to extend my frame class with Applet, but not quite sure how :( Any help would be great, i'll post only a section of my code as i think the problem lies with defining the class inheritence.
package gui;
import javax.swing.*;
import logic.*;
import java.applet.Applet;
public class Frame extends javax.swing.JFrame
{
boolean playerOne = true;
private Facade facade;
int p1score = 0;
int p2score = 0;
private boolean[ ][ ] clicked;
/** Creates new form Frame */
public Frame() {
initComponents();
setLocation(100,100);
setSize(400, 300);
facade = new Facade();
clicked = new boolean[ 3 ][ 3 ];
for( int row = 0; row < 3; row++ )
{
for( int column = 0; column < 3; column++ )
{
clicked[ row ][ column ] = false;
}
}
}
- 10-22-2008, 06:07 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You cannot do this. As error message says JFrame cannot convert into an Applet. Implement your code in an Applet. Since you are working on NetBeans it's so easy.
- 10-23-2008, 05:09 AM #3
Once you have it working as an applet, convert it to something vaguely useful, like Javascript. Applets are so last century
- 10-23-2008, 11:25 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
converting jar to .class or .java
By marmara95 in forum New To JavaReplies: 12Last Post: 10-06-2012, 10:49 PM -
Converting a Collection to an Array
By Java Tip in forum java.langReplies: 0Last Post: 04-14-2008, 08:44 PM -
Converting URL to URI
By Java Tip in forum Java TipReplies: 0Last Post: 12-26-2007, 10:15 AM -
Converting a byte[] into Sound
By savage82 in forum Advanced JavaReplies: 1Last Post: 11-21-2007, 11:57 PM -
help with converting to JApplet
By Simmy in forum AWT / SwingReplies: 2Last Post: 08-09-2007, 08:45 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks