i have written code for "chatting system". while compiling , above error occured. the sample code is as follows:
//The client program:
/*The Client program provide an graphical user interface for the clients.
The program is explained function by function.*/
/*Importing all required packages*/
import javax.swing.*;//1235
import javax.swing.border.*;//1236
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.StringTokenizer;//1243
/*The ClientApp class is the main applet class of the program. In this class an
instance of the client class is created and added to the content pane of the applet.
Every class can extended only from one class and the client class extends from the
JTabbedPane class. In order to incorporate this instance into an applet the above
said method has been employed */
public class ClientApp extends JApplet
{
Client clt;
public void init()
{ getContentPane().setBackground(new Colour(139,158,142));
getContentPane().add(new Client());
}
}
/*The class client ,carries out the actual work of enabling the user to chat. The
class implements the ActionListener and the Runnable interfaces as it makes use of
buttons and threads. It extends the JTabbedPane class as it needs to behave as
Tabbed Pane*/
class Client extends JTabbedPane implements ActionListener,Runnable
{
/*Declaration of Variables*/
/*These are the two main panels: panel1--the login panel and panel2--the main chat
panel*/
private JPanel panel1;
private JPanel panel2;
/*These variables are used throughout the program*/
/*These variables used for arranging components*/
private GridBagLayout gl;
private GridBagConstraints gbc;
/*The flags used to indicate various conditions*/
private int loginFlag=0;
private int disconFlag=1;
/*Variables used to store essential values*/
private String ourName="";
private String password;
private String room="none";
private String dec="zero";
private String requestor="no one";
private String requestee="no one";
private String tok="#";
/*The variable used to establish the actual connection with the server and
a thread which detects incoming messages*/
private Socket socket;
private DataOutputStream dout;
private DataInputStream din;
private Thread usrthrd;
/*The variables requierd for panel1 are declared below*/
and so on
the error in lines are
D:\java1.4.2\bin>javac *.java
chatcode.java:1235: 'class' or 'interface' expected
import javax.swing.*;
^
chatcode.java:1236: 'class' or 'interface' expected
import javax.swing.border.*;
^
chatcode.java:1237: 'class' or 'interface' expected
import java.applet.*;
^
chatcode.java:1238: 'class' or 'interface' expected
import java.awt.*;
^
chatcode.java:1239: 'class' or 'interface' expected
import java.awt.event.*;
^
chatcode.java:1240: 'class' or 'interface' expected
import java.io.*;
^
chatcode.java:1241: 'class' or 'interface' expected
import java.net.*;
^
chatcode.java:1242: 'class' or 'interface' expected
import java.util.*;
^
chatcode.java:1243: 'class' or 'interface' expected
import java.util.StringTokenizer;
^
9 errors
pl help me to compile
regards
Edited by Dogstopper:
paniraj
This post has been edited by Dogstopper: 04 January 2011 - 03:00 PM

New Topic/Question
Reply




MultiQuote




|