Results 1 to 3 of 3

Thread: writing to gui

  1. #1
    rob is offline Member
    Join Date
    Feb 2009
    Rep Power

    Default writing to gui

    Hi, I have a class a server class and a serverGUI class. Now the server class creates sockets etc and I need to display messages in the serverGUI (in a texfield), as soon as the socket is created. However, since I cant access the texfield from the server class I can't do this.

    Any help pls?

  2. #2
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Rep Power


    You should have the GUI being ran and using the server class, not vice versa. Think a bit that way.
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Perhaps the ServerGui object can load a ChangeListener into the Server class, whereby the Server object can notify the gui when changes are made. Then when the gui has been notified, it can call a public method in the server object that gets the text in the string: the observer pattern.

Similar Threads

  1. Writing an XML output
    By JThangiah in forum XML
    Replies: 2
    Last Post: 03-27-2008, 04:15 PM
  2. Writing to a file (at the end)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-08-2008, 09:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts