Dolemite88's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
44 (0.03 per day)
Joined:
27-December 10
Profile Views:
598
Last Active:
User is offline Sep 02 2012 02:52 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   Dolemite88 has not set their status

Posts I've Made

  1. In Topic: Automated text entry into text area

    Posted 27 Jul 2012

    Sorry about that, run method;
    public void run() 
        {
            try{
                while ((character = in.read()) != -1) {
                    chars[0] = (char)character;
                    textarea1.append(new String(chars));
                }
            }
            catch(Exception ex)
                {textarea1.setText(ex.getMessage());}
        }
    
    


    server side...
    public void run() 
        {
            String instring;
            try {    
           
                BufferedReader in = new BufferedReader (new 
                    InputStreamReader(insocket.getInputStream()));
                while((instring = in.readLine()) != null){
                    textarea1.append(instring + "\n");
                }
            }catch (Exception e) 
            {
                textarea1.setText(e.getMessage());
            } 
    
        }
    
  2. In Topic: Automated text entry into text area

    Posted 27 Jul 2012

    Its a basic chat program, client, server, this is the conection for the server...
    public void actionPerformed(ActionEvent event)
        {
            if(event.getSource() == button1){
                try{
                    socket = new Socket(textfield1.getText(), 8765);
                    textfield1.setText("Connecting....");
    
                    in = socket.getInputStream();
                    out = socket.getOutputStream();
    
                    thread = new Thread(this);
                    thread.start();
                }
                catch (IOException ioe){
                    textarea1.setText("ERROR: Server must be running and\n"
                    + "accessible before running the client.");
                    textfield1.setText("Not connected");
                }
                catch (Exception e){
                    textarea1.setText(e.getMessage());
                }
    
                if(socket != null && socket.isConnected()){
                    textfield1.setText("Connected");
                }
            }
    
  3. In Topic: Automated text entry into text area

    Posted 27 Jul 2012

    Ammended to;
    if(event.getSource() == button2){
                try{
                    String str = b.sendText() + "\n";
                    byte buffer[] = str.getBytes();
                    out.write(buffer);
                    out.flush();
                    textarea2.setText("");
                    textarea2.requestFocus();
                }
    

    still doesn't work...
  4. In Topic: Automated text entry into text area

    Posted 27 Jul 2012

    What am i doing wrong?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Dolemite88 hasn't added any friends yet.

Comments

Dolemite88 has no profile comments yet. Why not say hello?