Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

co jest nie tak?

0 views
Skip to first unread message

guit

unread,
Mar 27, 2001, 2:01:42 AM3/27/01
to
hej
udalo mi sie wreszcie skompilowac pliki aplikacji mini-chat
server po odpaleniu dziala i nasluchuje
ale problem jest z klientem
po odpaleniu
appletviewer chat.html
pokazuje sie komunikat:
applet not initialized (w okienku appletviewera)
i
java.lang.NullPointerException
at Client.init(Client.java:25) //fragment kodu do tego miejsca
umieszcze nizej
at sun.applet.AppletPanel.run(AppletPanel.java:344)
at java.lang.Thread.run(Thread.java:484)
(to w okienku ms-dos)

a tu jest fragment kodu Client.java

import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.*;
import java.lang.*;

public class Client extends Applet implements Runnable
{
protected DataInputStream input;
protected DataOutputStream output;
protected Socket Sock;
protected String host;
protected int port;
protected String userName;
protected boolean firstTime; //flaga, czy to pierwsza wiadomosc

java.awt.TextArea txtChatPane; //deklaracja komponentow interfejsu
uzyt.
java.awt.TextField txtInput;

protected Thread listener;

public void init() {
setLayout(null);
setSize(320,196);
//tu jest blad(?)txtChatPane.setText("Wpisz swoj NICKNAME i wcisnij
Enter");
txtChatPane.setBounds(2,1,304,154);
add(txtChatPane);
txtInput.requestFocus(); //parametry z appletu

this.host = this.getParameter("host");
this.port = Integer.parseInt(this.getParameter("port"));

firstTime = true;
userName = "New User";
txtInput.setText(userName);

listener = new Thread (this);
}

poradzcie cos :)
pozdr
guit

Artur Wisniewski

unread,
Mar 27, 2001, 2:10:49 AM3/27/01
to


Nie tworzysz elementu "txtChatPane", np.

txtChatPane= new TextArea();

podobnie z pozostałymi elementami awt


--

Artur

0 new messages