applet not initalized
I HAVE TRIED MY HEART OUT BUT THIS APPLET IS NOT GETTING INITIALIZED .....
THE FOLLOWING IS THE PROGRAM I HAVE WRITTEN:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
/*<applet code=card width=500 height=500> </applet>*/
public class card extends Applet implements ActionListener,ItemListener
{
CardLayout cc=new CardLayout();
Panel p1=new Panel();
Panel p2=new Panel();
Panel p3=new Panel();
Label l1=new Label("which movie won the best kiss awards in 2009?");
Label l2=new Label("what is the latest feature of windows 7?");
Label l3=new Label("which one is the o.s of apple?");
CheckboxGroup cg=new CheckboxGroup();
Checkbox c1=new Checkbox("twilight",cg,false);
Checkbox c2=new Checkbox("s. millionaire",cg,false);
Checkbox c3=new Checkbox("Wanted",cg,false);
Checkbox c4=new Checkbox("colour",cg,false);
Checkbox c5=new Checkbox("touchscreen",cg,false);
Checkbox c6=new Checkbox("gpedit.exe",cg,false);
Checkbox c7=new Checkbox("mac os y",cg,false);
Checkbox c8=new Checkbox("mac os 7",cg,false);
Checkbox c9=new Checkbox("mac os x",cg,false);
TextField t1=new TextField(20);
TextField t2=new TextField(20);
TextField t3=new TextField(20);
Button b1=new Button("pg1");
Button b2=new Button("pg2");
Button b3=new Button("pg3");
public void init()
{
setLayout(cc);
p1.add(l1);p1.add(c1);p1.add(c2);p1.add(c3);p1.add(t1);p1.add(b1);
add(p1);
p2.add(l2);p2.add(c4);p2.add(c5);p2.add(c6);p2.add(t2);p2.add(b2);
add(p2);
p3.add(l3);p3.add(c7);p3.add(c8);p3.add(c9);p3.add(t3);p3.add(b3);
add(p3);
add("cc 1",p1);add("cc 2",p2);
add("cc 3",p3);
c1.addItemListener(this);c2.addItemListener(this);c3.addItemListener(this);c4.addItemListener(this);c5.addItemListener(this);c6.addItemListener(this);c7.addItemListener(this);c8.addItemListener(this);
c9.addItemListener(this);b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);
}
public void itemStateChanged(ItemEvent e)
{
if(e.getItem()==c1||e.getItem()==c5||e.getItem()==c9)
{
t1.setText("right");
t2.setText("right");
t3.setText("right");
}
if(e.getItem()==c2||e.getItem()==c3||e.getItem()==c4||e.getItem()==c6||e.getItem()==c7||e.getItem()==c8)
{
t1.setText("wrong");
t2.setText("wrong");
t3.setText("wrong");
}
}
public void actionPerformed(ActionEvent r)
{
if(r.getSource()==b1)
{
cc.show(this,"cc 1");
}
if(r.getSource()==b2)
{
cc.show(this,"cc 2");
}
if(r.getSource()==b3)
{
cc.show(this,"cc 3");
}
}
}
PLEASE HELP ME OUT
View Answers
January 30, 2010 at 11:14 AM
Hi Friend,
Try it:
1)card.java:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class card extends Applet implements ActionListener,ItemListener{
Panel p1,p2,p3;
Label l1,l2,l3;
CheckboxGroup cg1,cg2,cg3;
Checkbox c1,c2,c3,c4,c5,c6,c7,c8,c9;
TextField t1, t2,t3;
Button b1,b2,b3;
public void init(){
p1=new Panel();
p2=new Panel();
p3=new Panel();
l1=new Label();
l1.setText("which movie won the best kiss awards in 2009?");
l2=new Label("what is the latest feature of windows 7?");
l3=new Label("which one is the o.s of apple?");
cg1=new CheckboxGroup();
cg2=new CheckboxGroup();
cg3=new CheckboxGroup();
c1=new Checkbox("twilight",cg1,false);
c2=new Checkbox("s. millionaire",cg1,false);
c3=new Checkbox("Wanted",cg1,false);
c4=new Checkbox("colour",cg2,false);
c5=new Checkbox("touchscreen",cg2,false);
c6=new Checkbox("gpedit.exe",cg2,false);
c7=new Checkbox("mac os y",cg3,false);
c8=new Checkbox("mac os 7",cg3,false);
c9=new Checkbox("mac os x",cg3,false);
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
b1=new Button("pg1");
b2=new Button("pg2");
b3=new Button("pg3");
p1.add(l1);p1.add(c1);p1.add(c2);p1.add(c3);p1.add(t1);p1.add(b1);
p2.add(l2);p2.add(c4);p2.add(c5);p2.add(c6);p2.add(t2);p2.add(b2);
p3.add(l3);p3.add(c7);p3.add(c8);p3.add(c9);p3.add(t3);p3.add(b3);
add(p1);
add(p2);
add(p3);
c1.addItemListener(this);c2.addItemListener(this);c3.addItemListener(this);c4.addItemListener(this);c5.addItemListener(this);c6.addItemListener(this);c7.addItemListener(this);c8.addItemListener(this);
c9.addItemListener(this);b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);
}
public void itemStateChanged(ItemEvent e)
{
if ( c1.getState() == true ){
t1.setText("right");
}
if( c5.getState() == true ){
t2.setText("right");
}
if( c9.getState() == true ){
t3.setText("right");
}
if (( c2.getState() == true )|| ( c3.getState() == true )){
t1.setText("wrong");
}
if(( c4.getState() == true )||( c6.getState() == true )){
t2.setText("wrong");
}
if(( c7.getState() == true )||( c8.getState() == true )){
t3.setText("wrong");
}
}
public void actionPerformed(ActionEvent r)
{
}
}
2)applet.html:
<html>
<body>
<applet code=card.class width=800 height=300>
</applet>
</body>
</html>
Thanks
Related Tutorials/Questions & Answers:
applet not initalized - Appletapplet not initalized I HAVE TRIED MY HEART OUT BUT THIS
APPLET...*;
/* */
public class card extends
Applet implements ActionListener,ItemListener... java.awt.event.*;
public class card extends
Applet implements ActionListener,ItemListener
AppletApplet Write an
applet to display a string in an
applet. String should be passed as a parameter to an
applet Advertisements
AppletApplet how to run an
applet on a web browser
appletapplet Explain different stages in the lifecycle of an
applet with figure.
Stages of
Applet:
Life cycle of an
Applet:
init(): This method is called to initialized an
applet
start(): This method is called after
AppletApplet Give the class hierarchy of an
Applet class
appletapplet What is the immediate superclass of the
Applet class
AppletApplet Write a ava
applet that sets blue color foreground and yellow color background at the start of an
applet AppletApplet Explain the start() and stop() methods of
applet life cycle.
Start and Start method of
Applet Life Cycle
Start () method: The start method of an
applet is called after the initialization method init
AppletApplet Write a short note on
applet life cycle
AppletApplet I have a java
applet that has a button. On clicking the button it should disappear and another
applet should appear. How to write this code???? Also in login
applet after successful login it should display admin
applet AppletApplet Draw the class hierarchy of an
Applet class. Also explain how to set background and forground colors in java
appletapplet what is
applet in java
An
applet is a small program that can be sent along with a Web page to a user. Java applets can perform... the following link:
Applet Tutorials
AppletApplet Write a Java
applet that drwas a line between 2 points. The co-ordinates of 2 points should be passed as parametrs from html file. The color of the line should be red
appletapplet
applet to open new tab not working.here's my code
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.awt.event.*;
public class NewURL extends
Applet implements ActionListener{
public void init
applet - Applet. Hi Friend,
Try the following code:
1)Create an
applet... extends
Applet{
public void paint(Graphics g){
g.drawString("Welcome in Java
Applet.",40,20);
}
}
2) Call this
applet with html code
Applet - AppletApplet what is the concept of
applet?
what is different between the
applet concept and HTML?
what is mean by swing? Hi friend,
Applet
Applet is java program that can be embedded into HTML pages. Java applets
applet - Applet*;
import java.awt.*;
public class CreateTextBox extends
Applet implements.../
applet/
Thanks
Applet - AppletApplet Namaste, I want to create a Menu, the menu name is "Display... java.awt.event.*;
public class menu2frame extends
Applet implements WindowListener...------------------------");
g.drawString("Demo of Java
Applet Window Event Program");
g.drawString("Java
applet problem - Appletapplet problem How can I create a file in client side by a java
applet . Surely it will need a signed
applet .But how can a signed
applet create a file in the client side
embedding class in an applet - Appletembedding class in an applet I have an
applet that has a set... java.awt.event.*; public class tesURL extends
Applet implements ActionListener... a remote controller). I have the
applet code for the remote controller
Servlet and Applet - AppletInvoke and run an
Applet from Servlet How can i invoke and run an
applet from servlet. Can anyone provide me the sample code
creating hyperlinks in applet - Appletcreating hyperlinks in applet Dear sir,
how can i move from one
applet to another
applet and how can i use previous
applet input data in anotherapplet(just like session tracking)
thanks
applet program code - Appletapplet program code hello sir,
i did't get the code for below problem... please help me...
1.An
applet program to draw a line graph for y=2x+5.[for suitable values of x & y
Applet JSP communication - AppletApplet JSP communication Hi..
I've an application where i need to get the data from the
applet to JSP...
How can i do this..??
can anyone explain with a sample code
applet running but no display - Appletapplet running but no display Hai,
Thanks for the post. I have... from a client, the page appears with a blank
applet part (just whitescreen..., it is showing that the "
Applet as1 started".
Please help me to solve this issue
applet Questionapplet Question Write a java
applet to display a circle in a rectangle
applet questionapplet question Write a java
applet to display a rectangle inside a circle
applet questionapplet question Write a java
applet to display atriangle inside a circle
What is Applet? - AppletWhat is
Applet? What is
Applet? Hi,Here is a little information about Applet.An
applet is a little application. Prior to the World Wide... programming language, an
applet is a small program that can be sent along with a Web
loading Java Applet - Appletloading Java Applet Hi,
I use the archive tag to download my
applet into the Browser
It takes too long to load. Can I do it in several steps... control the loading within the
applet?
thanks
java applet - Appletjava applet wants to creat address bar on my java
applet. Hi
Applet don't provide a facility to create a address bar directly. You just create a text box. In this text box if you enter any http address
Applet query - AppletApplet query i want to knw d complete detail of why does
applet... calls the
applet methods at different points depending on the stage it reached... link:
http://www.roseindia.net/java/example/java/
applet/
Thanks
Applet database access - AppletApplet database access HI...
I'm having an
applet where we should display the database values in the
applet...
It works fine in the local system...
but when its in the server, we r getting null values in the local system..
I
how to run applet - Applet in
applet program. this is executed successfully with appletviewer command
>...://www.roseindia.net/java/example/java/
applet/
http://www.roseindia.net/java/example/java/
applet/FirstApplet.shtml
Hope that it will be helpful for you.Even
applet security error - Appletapplet security error HI,
Thanks for your reply.
In the sample plugin code, the URL(nspluginurl) you have specified is for netscape navigator.
------------
-----------
Can you please tell me the same for IE url
applet servlet communication - Appletapplet servlet communication Can anybody tell me
applet - servlet... project in eclipse and writing the
applet code in ajava file which is present in src... that the
applet class is not found, but if I am copying t=all the classes
java applet - Appletjava applet I want to close
applet window which is open by another button of
applet program. plz tell me! Hi Friend,
Try... java.awt.event.*;
public class CloseWindow extends
Applet implements ActionListener
Applet code parameter - AppletApplet code parameter Hi...
I've designed an
applet where i placed the .class file in another subpackage...
i.e...if my html file is in the folder named project
then the class file is in project/WEB-INF/classes folder
problem with applet plugin - Appletproblem with
applet plugin hello friends,
iam using Eclipse IDE. i created one
applet and i want to plugin that
applet into webpage.. when i am.....
Thanks in advance.. Hi Friend,
If you want to plugin
applet methods in the applet - Applet;
public class applet1 extends
Applet
{
String m;
public void init...
applet is simular to the contructor defined in a java application. The purpose... provides the
Applet class with default implementation for all the
applet methods
drawing shapes in applet - Appletdrawing shapes in applet hi,
i need a single
applet prgm which... java.applet.Applet;
public class CubeExample extends
Applet {
Stroke...
Applet {
public void paint (Graphics g){
Graphics2D ga = (Graphics2D)g
applet programapplet program
applet to simulates a traffic signal light with short delay between states
Java Applet Java
Applet How to add Image in Java
Applet? what is getDocumentBase
applet doughtapplet dought life cycle of an
applet is init start and destroy but applets are executed by java enabled browsers like iexpl,so with out an object how these methods of an
applet are executed
Applet Error - AppletApplet Error Hi...
I had an application where i designed an
applet to get the database values into the
applet when i clicked a line...
It works...
Applet implements MouseListener{
boolean
java - Appletjava how to connect database table with scrollbar in java
applet java - Appletjava how to connect database table with scrollbar in java
applet