Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
  1. #21
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Posts
    65
    Rep Power
    0

    Default Re: Add action listener to server

    I see, so
    while(a)
    {system.output.println("hi)"}

    would run with less ram than having it wait?

    while(a)
    {wait(1000);system.output.println("hi");}

    I suppose this method would be running two loops so that must be the reason?

    Would you think that the performance of that loop could compare to a action listener or other viable substitute or should it be changed to some other way of detection?
    **sorry about the crappy coding it didnt directly copy and paste into site so I hand modified it a little, not nearly enough though
    Last edited by kevinn205; 12-14-2011 at 07:04 PM.

  2. #22
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: Add action listener to server

    would run with less ram
    Why print out that useless message thousands of times?

    Would you think that the performance of that loop could compare to a action listener
    An action listener does NOT use any cycles waiting for the event like an infinite loop would.

    What is the purpose of your using an infinite loop?

  3. #23
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Posts
    65
    Rep Power
    0

    Default Re: Add action listener to server

    That was just for demonstartion purposes, Im actually using it to process a variable from a class withhin the jvm then determine if it has a true or a false value
    it then updates if true and sets to false
    haha ghetto homemade action listener, sounds like you realize that with your updated post though,

    That piece of code allows my entire program to work, so I guess what i need now is a way to substitute it with a action listener

    is it simple to have a action listener listen for a message?

  4. #24
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: Add action listener to server

    You should read the tutorials about what listeners do and how to use them.
    Lesson: Writing Event Listeners (The Java™ Tutorials > Creating a GUI With JFC/Swing)

  5. #25
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Posts
    65
    Rep Power
    0

    Default Re: Add action listener to server

    Fair enough, sorry for taking up alot of your time

    I really appreciate the help

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 2
    Last Post: 12-11-2011, 10:44 PM
  2. Problem in action listener
    By cool in forum AWT / Swing
    Replies: 4
    Last Post: 11-16-2010, 07:44 AM
  3. Action Listener
    By greatmajestics in forum AWT / Swing
    Replies: 8
    Last Post: 03-25-2010, 05:39 PM
  4. Action Listener? how to use this?
    By jeffrey in forum New To Java
    Replies: 2
    Last Post: 10-12-2009, 08:51 AM
  5. action listener on jcombobox
    By chkm8 in forum New To Java
    Replies: 2
    Last Post: 02-05-2009, 10:14 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
  •