The Artima Developer Community
Sponsored Link

Joystick Bean

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Joystick Bean

Posted by Andrew Semprebon on 22 Sep 1998, 1:28 PM

> Nice use of the factory pattern to abstract construction. I like it.
> What I'd do in this case, Andrew, is create a JoyBean class
> that accesses that JoystickFactory class and asks it for its
> list of JoyStick objects. If there aren't any, the JoyBean
> disables itself; if there is only one JoyStick, it uses it, and if there
> are more than one, it uses the "default" JoyStick (something
> statically defined in the JoyStickFactory class itself), but provides
> a Customizer that allows you to override which one is being used.

Great minds think alike. That's basically the solution I came
up with. Since most PCs only have one joystick, I made the default no-arg constructor use it. I hadn't thought of a customizer to let you pick the joystick you want - right now, if you want something other than the default, you have to use a constructor that has a parameter that identifies the desired joystick.




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us