• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

What's ActionListener best practice?

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been searching for Swing best practice for a long time, but it's still not quite clear.

The most 'best practice' suggests that 'java.swing.Action' should be used to encapsulate command, and use an ActionRegistry to get references to thoese actions.

But my problem is that most of my Action has to update UI components, so my Action must have reference to those text fields, table models, which have to be passed in as constructor arguments.

Please look at the folling code segment


Is thes all right? (I personally think it's not quite elegent)

But how to update UI componenets in action listeners ? any ideas?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!