java - How can I design User Preferences module in my Swing application? -
i have dialog storing user preferences of application developed using java swing. there 20+ preferences , notify other modules when particular preference changes. know can hold list of listeners , notify them whenever preferences change. however, know 2 issues:
- how can bind swing components bean object,
- how can fire event when preferences change,
dependending experience, how resolve architecture? best practices follow?
thanks
i developed swing application user modify parameters change functionality or graphic of application.
i approached way:
- a general
setting
abstract class represent single value user can change. - a subclass created different types of value, in case: boolean, integer, floating points, colors, etc.
- i use map keep track of created
setting
,preferences
object store values.
for actual settings, create static attribute somewhere (in case, dedicated classes different logical groups of settings) , use attribute read , change values fo settings.
pro: settings
keeps track of settings instantiated, don't need code frame changing them twice, did once in indipendent way number of settings
cons: requires changing code add new setting. while in case not issue because new setting needed because of other changes in code, in case might be.
Comments
Post a Comment