Can Anyone please take a loo at this code and tell me whats wrong???

Sorry.................for the indentation is screwed :(

import java.applet.*;
import java.awt.*;
import java.net.*;
import java.awt.event.*;
import java.util.*;

public class Pritish extends Applet implements ActionListener implements Runnable
{
Thread t,t1;
public void init()
{
String link1 = "yahoo";
Button b1 = new Button(link1);
b1.addActionListener(this);
add(b1);

String link2 = "google";
Button b2 = new Button(link2);
b2.addActionListener(this);
add(b2);

String link3 = "vidyalankarlive";
Button b3 = new Button(link3);
b3.addActionListener(this);
add(b3);

String link4 = "facebook";
Button b4 = new Button(link4);
b4.addActionListener(this);
add(b4);

}
public void start()
{
t = new Thread(this);
t.start();
}
public void run()
{
t1 = Thread.currentThread();
while(t1 == t)
{
repaint();
try
{
t1.sleep(1000); 
}
catch(InterruptedException e){}
}
}
public void paint(Graphics g)
{
g.setFont(new Font("ARIAL",Font.BOLD,18));
Calendar cal = new GregorianCalendar();
String hour = String.valueOf(cal.get(Calendar.HOUR));
String minute = String.valueOf(cal.get(Calendar.MINUTE));
String second = String.valueOf(cal.get(Calendar.SECOND));
g.drawString(hour + ":" + minute + ":" + second, 100, 100);
}
public void actionPerformed(ActionEvent ae)
{
Button src1 = (Button)ae.getSource();
String link1 = "http://www."+src1.getLabel()+".com";

Button src2 = (Button)ae.getSource();
String link2 = "http://www."+src2.getLabel()+".com";

Button src3 = (Button)ae.getSource();
String link3 = "http://www."+src3.getLabel()+".com";

Button src4 = (Button)ae.getSource();
String link4 = "http://www."+src4.getLabel()+".com";

try
{
AppletContext a1 = getAppletContext();
URL u1 = new URL(link1);
a1.showDocument(u1,"_self");

AppletContext a2 = getAppletContext();
URL u2 = new URL(link2);
a2.showDocument(u2,"_self");

AppletContext a3 = getAppletContext();
URL u3 = new URL(link3);
a3.showDocument(u3,"_self");

AppletContext a4 = getAppletContext();
URL u4 = new URL(link4);
a4.showDocument(u4,"_self");
}
catch (MalformedURLException e)
{
System.out.println(e.getMessage());
}

}
}

Can you explain what the problem is? If you are getting errors, please post the full text of the error message.

Hi, simple error I spotted straight away is your class declaration:

public class Pritish extends Applet implements ActionListener implements Runnable
{
}

You have the implements keyword twice! To implement multiple interfaces, you just use the " , " character.

 public class Pritish extends Applet implements ActionListener,Runnable
 {
 }

Thanks all

But Akill,
i use netbeans and it shows me that
Pritish is a duplicate class
why so???

do you have another file called Pritish.java ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.