6 Replies - 417 Views - Last Post: 22 February 2017 - 10:55 AM Rate Topic: -----

#1 naveen kuppan1167   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 3
  • Joined: 22-February 17

can't solve error

Posted 22 February 2017 - 10:18 AM

import java.io.*;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

class frame1 extends Frame
{
  frame1(String title)
  {
     super(title);
     MyWindowAdapter ad = new MyWindowAdapter(this);
     addWindowListener(ad);
   }
  public void paint(Graphics g)
  {
     g.drawString("Bank Online",10,40);
   }
}

class MyWindowAdapter extends WindowAdapter
{
  frame1 f1;
  public MyWindowAdapter(frame1 f1)
  {
   this.f1 = f1;
   }
   public void windowClosing(WindowEvent e)
   {
    f1.setVisible(false);
   }
}

pulic class bank extends Applet implements ActionListener,ItemListener 
{
  Label name,deposit,accno,withdraw;
  TextField cust,dept,number,draw;
  TextArea t;
  Choice type;
  Checkbox yes,nu;
  CheckboxGroup te;
 
  Frame f;
  Button b;
  
  public void init()
  {
   f = new frame1("A frame window");
   f.setSize(250,250);
   f.setVisible(true);
   
   setBackground(Color.yellow);
   setForeground(Color.red);

   name = new Label("Name");
   deposit = new Label("Deposit");
   accno = new Label("Account number");
   withdraw = new Label("Withdraw");
   
   cust = new TextField(20);
   dept = new TextField(20);
   number = new TextField(20);
   draw = new TextField(20);

   type = new Choice();
   type.add("Fixed");
   type.add("RD");
   type.add("second class");
   
   t = new TextArea(40,45);

   b = new Button("Submit");

   add(name);
   add(cust);

   add(accno);
   add(number);
   
   add(deposit);
   add(dept);
   
   add(withdraw);
   add(draw);

   add(type);
   add(B)/>/>;
 
   add(yes);
   add(nu);

   add(t);

   b.addActionListener(this);
   type.addItemListener(this);
}

public void actionPerformed(ActionEvent ae)
{
  if(ae.getActionCommand().equals("Submit"))
  {
   t.setText("Name:"+name.getText()+" "+"ACCOUNT NUMBER:"+number.getText()+" "+"DEPOSIT AMOUNT:"+dept.getText()+" "+"TYPE OF ACCOUNT:"+type.getSelectedItem());
  }  
}

  public void ItemStateChanged(ItemEvent ie)
  {

error: import java.io.*;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

class frame1 extends Frame
{
  frame1(String title)
  {
     super(title);
     MyWindowAdapter ad = new MyWindowAdapter(this);
     addWindowListener(ad);
   }
  public void paint(Graphics g)
  {
     g.drawString("Bank Online",10,40);
   }
}

class MyWindowAdapter extends WindowAdapter
{
  frame1 f1;
  public MyWindowAdapter(frame1 f1)
  {
   this.f1 = f1;
   }
   public void windowClosing(WindowEvent e)
   {
    f1.setVisible(false);
   }
}

pulic class bank extends Applet implements ActionListener,ItemListener 
{
  Label name,deposit,accno,withdraw;
  TextField cust,dept,number,draw;
  TextArea t;
  Choice type;
  Checkbox yes,nu;
  CheckboxGroup te;
 
  Frame f;
  Button b;
  
  public void init()
  {
   f = new frame1("A frame window");
   f.setSize(250,250);
   f.setVisible(true);
   
   setBackground(Color.yellow);
   setForeground(Color.red);

   name = new Label("Name");
   deposit = new Label("Deposit");
   accno = new Label("Account number");
   withdraw = new Label("Withdraw");
   
   cust = new TextField(20);
   dept = new TextField(20);
   number = new TextField(20);
   draw = new TextField(20);

   type = new Choice();
   type.add("Fixed");
   type.add("RD");
   type.add("second class");
   
   t = new TextArea(40,45);

   b = new Button("Submit");

   add(name);
   add(cust);

   add(accno);
   add(number);
   
   add(deposit);
   add(dept);
   
   add(withdraw);
   add(draw);

   add(type);
   add(B)/>/>;
 
   add(yes);
   add(nu);

   add(t);

   b.addActionListener(this);
   type.addItemListener(this);
}

public void actionPerformed(ActionEvent ae)
{
  if(ae.getActionCommand().equals("Submit"))
  {
   t.setText("Name:"+name.getText()+" "+"ACCOUNT NUMBER:"+number.getText()+" "+"DEPOSIT AMOUNT:"+dept.getText()+" "+"TYPE OF ACCOUNT:"+type.getSelectedItem());
  }  
}

  public void ItemStateChanged(ItemEvent ie)
  {
   }
}
  

error: import java.io.*;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

class frame1 extends Frame
{
  frame1(String title)
  {
     super(title);
     MyWindowAdapter ad = new MyWindowAdapter(this);
     addWindowListener(ad);
   }
  public void paint(Graphics g)
  {
     g.drawString("Bank Online",10,40);
   }
}

class MyWindowAdapter extends WindowAdapter
{
  frame1 f1;
  public MyWindowAdapter(frame1 f1)
  {
   this.f1 = f1;
   }
   public void windowClosing(WindowEvent e)
   {
    f1.setVisible(false);
   }
}

pulic class bank extends Applet implements ActionListener,ItemListener 
{
  Label name,deposit,accno,withdraw;
  TextField cust,dept,number,draw;
  TextArea t;
  Choice type;
  Checkbox yes,nu;
  CheckboxGroup te;
 
  Frame f;
  Button b;
  
  public void init()
  {
   f = new frame1("A frame window");
   f.setSize(250,250);
   f.setVisible(true);
   
   setBackground(Color.yellow);
   setForeground(Color.red);

   name = new Label("Name");
   deposit = new Label("Deposit");
   accno = new Label("Account number");
   withdraw = new Label("Withdraw");
   
   cust = new TextField(20);
   dept = new TextField(20);
   number = new TextField(20);
   draw = new TextField(20);

   type = new Choice();
   type.add("Fixed");
   type.add("RD");
   type.add("second class");
   
   t = new TextArea(40,45);

   b = new Button("Submit");

   add(name);
   add(cust);

   add(accno);
   add(number);
   
   add(deposit);
   add(dept);
   
   add(withdraw);
   add(draw);

   add(type);
   add(B)/>/>;
 
   add(yes);
   add(nu);

   add(t);

   b.addActionListener(this);
   type.addItemListener(this);
}

public void actionPerformed(ActionEvent ae)
{
  if(ae.getActionCommand().equals("Submit"))
  {
   t.setText("Name:"+name.getText()+" "+"ACCOUNT NUMBER:"+number.getText()+" "+"DEPOSIT AMOUNT:"+dept.getText()+" "+"TYPE OF ACCOUNT:"+type.getSelectedItem());
  }  
}

  public void ItemStateChanged(ItemEvent ie)
  {
   }
}
:code:
error : bank is not abstract and does not override abstract method itemStateChanged(java.awt.event.ItemEvent) in java.awt.event.ItemListener

This post has been edited by modi123_1: 22 February 2017 - 10:19 AM
Reason for edit:: In the future, please use the [code] tag button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: can't solve error

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14423
  • View blog
  • Posts: 57,819
  • Joined: 12-June 08

Re: can't solve error

Posted 22 February 2017 - 10:19 AM

What's the full error with the line number, etc on it?
Was This Post Helpful? 0
  • +
  • -

#3 naveen kuppan1167   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 3
  • Joined: 22-February 17

Re: can't solve error

Posted 22 February 2017 - 10:25 AM

View Postmodi123_1, on 22 February 2017 - 10:19 AM, said:

What's the full error with the line number, etc on it?


error is with line 33
Was This Post Helpful? 0
  • +
  • -

#4 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 709
  • View blog
  • Posts: 5,420
  • Joined: 25-December 13

Re: can't solve error

Posted 22 February 2017 - 10:35 AM

Quote

does not override abstract method itemStateChanged(

Does that class define the method required by the interface it implements?
Copy the name of the method from the error message and do a search with that name in your code to see if the method is defined.
Was This Post Helpful? 0
  • +
  • -

#5 naveen kuppan1167   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 3
  • Joined: 22-February 17

Re: can't solve error

Posted 22 February 2017 - 10:37 AM

it would be awesome if someone tried figuring out the solution
Was This Post Helpful? -1
  • +
  • -

#6 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 709
  • View blog
  • Posts: 5,420
  • Joined: 25-December 13

Re: can't solve error

Posted 22 February 2017 - 10:41 AM

Quote

it would be awesome if someone tried figuring out the solution

I think you are capable of finding the solution. It's important that you know how to solve compiler errors so you won't need to come here for help.

Did you do the search in your code for the name of the method as I suggested?

The reason I suggested doing the search is because that is the technique I use to find the problem.

This post has been edited by NormR: 22 February 2017 - 10:55 AM

Was This Post Helpful? 0
  • +
  • -

#7 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14423
  • View blog
  • Posts: 57,819
  • Joined: 12-June 08

Re: can't solve error

Posted 22 February 2017 - 10:55 AM

It would be awesome if you refreshed yourself on the rules for asking people to do your work for you.

:^: ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1