| Author |
please help...frame based application error
|
chandan kuchipudi
Greenhorn
Joined: Jun 27, 2012
Posts: 12
|
|
hi ......i'm very new to java...i'm learning core java for 2 months....i'm getting errors while devoloping a frame based checkbox application ....please look into that and help me to devolope that ...
here is the program
//CbDemo.java
import java.awt.*;
import java.awt.event.*;
class Cb extends Frame
{
Checkbox cb1;
Label l1,l2;
Cb()
{
setTitle("checkbox example");
setSize(200,200);
FlowLayout fl=new FlowLayout();
setLayout(fl);
// create the components
cb1=new Checkbox("java");
l1=new Label("select the course");
l2=new Label();
// add components to container
add(l1);add(cb1);add(l2);
// registration
Sathya so=new Sathya();
cb1.addItemListener(so);
setVisible(true);
}//cb ()
class Sathya implements ItemListener
{
public void ItemStateChanged(ItemEvent ie)
{
if(ie.getSource()==cb1)
{
if(cb1.getState())
{
l2.setText("your selected course:"+cb1.getLabel());
}
else
{
l2.setText("please select a course");
}
}//if
}//isc
}//sathya
}//cb
class CbDemo
{
public static void main (String []args)
{
Cb co=new Cb();
}
}
//it is showing that line no. 34 is an error ....
line no.34 : class Sathya implements ItemListener
Cb.Sathya is not abstract method and does not override abstract method ItemStateChanged(ItemEvent) in ItemListener
please let me know what is wrong in that .....thank you ..
|
 |
Julien Coe
Greenhorn
Joined: Jun 27, 2012
Posts: 4
|
|
is not the same as :
itemStateChanged starts with a little 'i'
|
 |
chandan kuchipudi
Greenhorn
Joined: Jun 27, 2012
Posts: 12
|
|
thank you julien coe .....i've changed "i" .....but still it is showing error like this
line no 53 error : Cb is abstract;cannot be instantiated...
Cb co =new Cb();
i've written it as a part of execution logic class....please look it once...
|
 |
Julien Coe
Greenhorn
Joined: Jun 27, 2012
Posts: 4
|
|
This is your code with some formatting
But when I write it in my IDE, no error's showing. So, it's probably something else.
|
 |
 |
|
|
subject: please help...frame based application error
|
|
|