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 1389
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: 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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| | |