This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,794 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

Action Listener Cpu Time

941495
941495 Member Posts: 3
edited Jun 14, 2012 11:00AM in Abstract Window Toolkit (AWT)
I'm looking for a comparison of cpu time for different kinds of interface. The main ideas I have are:

1. Have one event listener in the frame and check by x/y position which GUI object is interacted with via an if, else if structure.
2. Have an event listener for every GUI object.
3. Have one motion listener in the frame.

I know that motion listeners are the most cpu consuming, by how much? Between 1 & 2 what would the difference be with a few objects, with many objects?

Answers

  • gimbal2
    gimbal2 Senior software engineer NetherlandsMember Posts: 11,949 Gold Trophy
    CPU consumption does not rely on which listeners you use or on how many objects, it depends on what the listeners actually DO. If you have a listener that does nothing more than output some data to a text field, it is not going to use much. If you create a listener that recalculates the entire lighting model of a 3D scene each time it fires, it is not going to do so well.
This discussion has been closed.