ERROR
[Bookshop is not an abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent)in java.awt.event.ActionListener] -
import javax.swing.*;
-
import java.awt.*;
-
import java.awt.event.*;
-
public class Bookshop extends JFrame implements ActionListener
-
{
-
-
JTextField productIdText;
-
JTextField productNameText;
-
JTextField productCostText;
-
JTextField productyearOfPublicationText;
-
JTextField productpublishingHouseText;
-
-
JButton submit;
-
Product [] productList = new Product [100];//productList array to store Person objects
-
int numberOfproduct = 0;// counter to know how many objects are in the array
-
public static void main(String []args)
-
{
-
new Bookshop();
-
}
-
-
class Product
-
{
-
private int productId;
-
private String productName;
-
private double cost;
-
private int yearOfPublication;
-
private String publishingHouse;
-
-
-
public Product(int productId,String productName,double cost,int yearOfPublication,String publishingHouse)
-
{
-
this.productId = productId;
-
this.productName = productName;
-
this.cost = cost;
-
this.yearOfPublication = yearOfPublication;
-
this.publishingHouse = publishingHouse;
-
-
-
setSize(400,400);
-
setLayout(new FlowLayout());
-
-
productIdText = new JTextField(5);
-
add(productIdText);
-
-
productNameText = new JTextField(5);
-
add(productNameText);
-
-
productCostText = new JTextField(5);
-
add(productCostText);
-
-
productyearOfPublicationText = new JTextField(5);
-
add(productyearOfPublicationText);
-
-
productpublishingHouseText = new JTextField(5);
-
add(productpublishingHouseText);
-
-
submit = new JButton("press");
-
submit.addActionListener(this);
-
add(submit);
-
-
-
setVisible(true);
-
-
}
-
-
public void actionPerformed(ActionEvent e)
-
{
-
if(e.getSource() == submit)// get the data from textfields
-
{
-
int id = Integer.parseInt(productIdText.getText());
-
String name = productNameText.getText();
-
double cost = productCostText.getText();
-
int yearOfPublication = productyearOfPublicationText.getText();
-
String publishingHouse = productpublishingHouseText.getText();
-
//System.out.println(id);
-
//System.out.println(name);
-
-
// put new object into array
-
productList[numberOfProduct] = new Product(id,name,cost,yearOfPublication,publishingHouse);
-
numberOfProduct++;
-
}
-
-
}
-
-
public void setSize(int x,int y)
-
{
-
}
-
-
public void setproductIdText(int productIdText)
-
{
-
this.productIdText=productIdText;
-
}
-
-
public void setproductNameText(String productNameText)
-
{
-
this.productNameText = productNameText;
-
}
-
public void setId(int productId)
-
{
-
this.productId = productId;
-
}
-
-
public int getproductId()
-
{
-
return productId;
-
}
-
public void setproductName(String productName)
-
{
-
this.productName = productName;
-
}
-
-
public String getproductName()
-
{
-
return productName;
-
}
-
-
public void setcost(double cost)
-
{
-
this.cost = cost;
-
}
-
-
public double getcost()
-
{
-
return cost;
-
}
-
-
public void setyearOfPublication(int yearOfPublication)
-
{
-
this.yearOfPublication = yearOfPublication;
-
}
-
-
public int getyearOfPublication()
-
{
-
return yearOfPublication;
-
}
-
-
public void setpublishingHouse(String publishingHouse)
-
{
-
this.publishingHouse = publishingHouse;
-
}
-
-
public String getpublishingHouse()
-
{
-
return publishingHouse;
-
}
-
}
-
-
class Book extends Product
-
{
-
private String author;
-
private int isbn;
-
private int numberOfPages;
-
-
-
public Book(String author, int isbn, int numberOfPages, int productId, String productName, double cost,
-
int yearOfPublication, String publishingHouse)
-
{
-
super(productId,productName,cost,yearOfPublication,publishingHouse);
-
this.author = author;
-
this.isbn = isbn;
-
this.numberOfPages = numberOfPages;
-
}
-
}
-
-
class Software extends Product
-
{
-
private int RAM;
-
private int processor;
-
-
-
-
public Software(int ram,int processor,int productId, String productName, double cost,
-
int yearOfPublication, String publishingHouse)
-
{
-
super(productId,productName,cost,yearOfPublication,publishingHouse);
-
this.ram = ram;
-
this.processor = processor;
-
}
-
-
}
-
-
}
-
error section is marked in the attachment.thank in advance.
The error essage means that your class Bookshop needs the method actionPerformed, but you did not provide one. Instead, you provided one for class Product that does not need one. So just move the method actionPerformed to the right class.
BookShop extends JFrame, and jFrame defines the abstract method actionPerformed. So the error message says that all classes that extend JFrame must either define an own abstract method actionPerformed, or implement this method.
2 1388
The error essage means that your class Bookshop needs the method actionPerformed, but you did not provide one. Instead, you provided one for class Product that does not need one. So just move the method actionPerformed to the right class.
BookShop extends JFrame, and jFrame defines the abstract method actionPerformed. So the error message says that all classes that extend JFrame must either define an own abstract method actionPerformed, or implement this method.
Thanks a million.
Your are great.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Philip D Heady |
last post by:
What is with this error message?????? First part validates, second part
fails...
getimagesize (filename...) failed to open stream: No such file or directory
} elseif ($photo) {
$ext =...
|
by: Falk Fassmann |
last post by:
Hello people,
I have some problem with Debugging in MS Visual C++.
I want to generate a TCP/IP-Socket. The compiling-process is fine but
when I debugg the project there's occuring some errors...
|
by: juli jul |
last post by:
Hello,
I am trying to compile a project and get the following error:
A project with an Output Type of Class Library cannot be started
directly
Can somebody explain me why?
Thank you very much!
|
by: Steve |
last post by:
I am only trying to create a DataView, and I get the following error
message.
The dataset is on a Template form. The form where I get the error message
inherits from the template form where all of...
|
by: swtstrawberry |
last post by:
I wrote the program and the complier at school is Microsoft Visual 6.0.......but i keep getting one error message and i have no idea what it means...i bolded the line where it occurs n the error...
|
by: Willow |
last post by:
Hi
I hope you can help me with this it is driving me nuts.
I've created a database which I needed to give multiple people access
to but didn't want them messing so I created an MDE file. I...
|
by: martin |
last post by:
Hello,
Today I fetched the standard Access-2003 template "orders management db"
from
http://office.microsoft.com/en-au/templates/TC010185481033.aspx?pid=CT101426031033
In de openingform one...
|
by: Tonio Tanzi |
last post by:
I have the following problem in a Win 2000 Server + SQL Server 2000
environment and I hope somewhat can help me to resolve it (after many
days of useless attempts I am desperate).
In my database...
|
by: Jonathan Wood |
last post by:
The following code raises the error "Specified cast is not valid."
MembershipUser user = Membership.GetUser(userId);
DataSet ds = DataLayer.ExecQueryData("SELECT * FROM mc_Clients WHERE...
|
by: babs115 |
last post by:
ERROR
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Bookshop extends JFrame implements ActionListener
{
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| | |