The Artima Developer Community
Sponsored Link

Java Buzz Forum
User input: Queues and Delayed Processing

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Scott Delap

Posts: 1154
Nickname: scottdelap
Registered: Sep, 2004

Client / Server application developer.
User input: Queues and Delayed Processing Posted: Oct 20, 2004 12:29 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Scott Delap.
Original Post: User input: Queues and Delayed Processing
Feed Title: ClientJava.com
Feed URL: http://www.clientjava.com/archives/wireless_mobile.rdf
Feed Description: Client/Desktop Related Java Development
Latest Java Buzz Posts
Latest Java Buzz Posts by Scott Delap
Latest Posts From ClientJava.com

Advertisement

I've ran across a number of cases that I've needed to delay mouse or keyboard input. For instance a user presses the down arrow while in a list repeatedly. Most times I do not want to fire an event for every list selection change. I do want to fire an event when the finally stop on a selection. Well it looks like there are new ways to handle this in JDK 5.0. There is now a new Queue interface that adds the following methods over collection

  • E element()
  • boolean offer(E o)
  • E peek()
  • E poll()
  • E remove()
There are a number of implementions including one called DelayQueue. The offer method can fail on some condition. An example would be that you are already processing input since the queue size is one. The poll and peek methods also fail by returning null instead of throwing exceptions. This would allow you to periodically check the queue for values without exceptions being thrown everywhere. Check out the full article on java.sun.com.

Queues and Delayed Processing

Read: User input: Queues and Delayed Processing

Topic: Spring 1.1.1 and iBATIS 2.0.7 Previous Topic   Next Topic Topic: How to Scroll an Image in MIDP

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use