Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What's ActionListener best practice?

Ren Shao
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?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic