The program can't complied as abstract class?
Dear all
Nice to meet you. I am Billy and come from Hong Kong. I would like to write a program as following:
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
publicclass ListModHompageimplements ActionListener{
String meg =new String();
public ListModHompage(String name){
inputWebdataFile(name);
System.out.println(this.outputWebdataModified());
createGUIUpdateFile(name);
}
publicvoid inputWebdataFile(String name){
try{
FileInputStream in =new FileInputStream(name);
meg = name;
int i = 0;
while (in.available() != 0)
meg += (char) in.read();
in.close();
}
catch (Exception e){
System.out.println("Unexpected " + e);
}
}
public String outputWebdataModified(){
int i=meg.indexOf("Last Modified: ");//Find first space
String date=meg.substring(i+15, i+43);
return date;
}
publicstaticvoid main(String args[]){
new ListModHompage("webdata.txt");
}
publicvoid createGUIUpdateFile(String name){
try{
// FileOutputStream out = new FileOutputStream(name);
JFrame frame =new JFrame("");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel =new JPanel(new GridLayout(3, 1));
Button btnOK =new Button("OK");
Button exit =new Button("Exit");
JTextField field1 =new JTextField();
JTextField field2 =new JTextField();
JLabel label1 =new JLabel("What URL do you need to update?");
JLabel label2 =new JLabel("What date of URL do you modified?");
panel.add(label1);
panel.add(field1);
panel.add(label2);
panel.add(field2);
panel.add(btnOK);
panel.add(exit);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
publicvoid windowClosing(WindowEvent e){
System.exit(0);
}
});
// out.close();
}catch (Exception e){
System.out.println(e);
}
}
}
The purpose of the program is that can fetch all of the web pages specified in the file, one by one, and
display the corresponding last modified date. And then, it can update the file about the last modified dates whenever necessary. After then, it can send email to the specified users about the change if there is any
update in the specified URLs.
When I complied the program, the complied time error would be occured by following:
ListModHompage.java:7: ListModHompage is not abstract and does not override abst
ract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.Action
Listener
public class ListModHompage implements ActionListener {
^
1 error
I know that what is abstract class but I don't understand why doesn't it complied. Would you mind tell me? Thanks for you help.
Billy

