Results 1 to 4 of 4
  1. #1
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default MVC event classes

    I'm about to design the largest Swing app I've ever written, and I'm studying the MVC design pattern.

    Is it generally recommended to use standard event classes such as PropertyChangeEvent, or is it common to develop your own event class hierarchy?
    Get in the habit of using standard Java naming conventions!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: MVC event classes

    I don't know the canonical answer to this, but I do know that there is a SwingPropertyChangeSupport built specifically for Swing apps that ensures that listeners are all notified on the EDT.

  3. #3
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: MVC event classes

    Hmm. If I understand this correctly, say I have a JPA Entity class modeling some data, and a Swing component displaying it. The Swing component would register a PropertyChangeListener on a SwingPropertyChangeSupport object, and the Entity class (or its enclosing logic) could fire events on that SwingPropertyChangeSupport to update the UI. Right?

    If it seems like I'm going about this backwards, it's because my app is primarily not UI-driven. Most of the UI updates will be triggered by data changes, which themselves will be triggered by parsing a data stream from a game server.
    Get in the habit of using standard Java naming conventions!

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Classes Help!!! two classes with object question.
    By stuckonjava in forum New To Java
    Replies: 16
    Last Post: 02-10-2012, 02:39 AM
  2. Use classes inside of other classes
    By BlankFile in forum New To Java
    Replies: 2
    Last Post: 02-06-2012, 02:51 PM
  3. Event Handling with Separate Classes
    By newbie123 in forum New To Java
    Replies: 9
    Last Post: 05-26-2011, 06:12 AM
  4. event handling between classes
    By newbie123 in forum New To Java
    Replies: 3
    Last Post: 03-25-2010, 01:38 PM
  5. checking for an event during an event
    By infinity in forum AWT / Swing
    Replies: 22
    Last Post: 04-09-2009, 02:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •