Results 1 to 4 of 4
  1. #1
    mike101 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default MVC + JOptionPane.showConfirmDialog

    I don't know if someone can help but I am trying to see if its possible to use the JOptionPane.showConfirmDialog and when the user anwser the yes or no question my controller is call trough the action listener of the JOptionPane.showConfirmDialog and transfert the info to the model so I can process the info??

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,310
    Blog Entries
    7
    Rep Power
    20

    Default Re: MVC + JOptionPane.showConfirmDialog

    The showConfirmDialog( ... ) method returns an int value indicating how the user dismissed the dialog (yes, no or cancel). You can do with that value what you want, there is no need for ActionListeners.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    mike101 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Re: MVC + JOptionPane.showConfirmDialog

    Thank you but I know that. The problem is, since I am using the MVC design pattern, once the user has anwsered I need to go to the model to do the logic. I juste don't know how to trigger the controller to get the info from the view and pass it to the model.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,310
    Blog Entries
    7
    Rep Power
    20

    Default Re: MVC + JOptionPane.showConfirmDialog

    The MVC pattern doesn't imply that you have to use ActionListeners; if it was the View that instantiates the JOptionPane, it can receive its return value and pass it on to the Conroller part ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. JOptionPane
    By louiedogg418 in forum New To Java
    Replies: 3
    Last Post: 07-03-2011, 06:04 PM
  2. JOptionPane
    By thorobred in forum Eclipse
    Replies: 4
    Last Post: 04-19-2011, 04:15 AM
  3. [SOLVED] JOptionPane.ShowConfirmDialog() problem
    By jon80 in forum New To Java
    Replies: 15
    Last Post: 06-03-2009, 02:37 AM
  4. JOptionPane
    By whosadork in forum New To Java
    Replies: 2
    Last Post: 10-23-2008, 02:17 AM
  5. JOptionPane - showConfirmDialog(...) options
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-17-2007, 09:38 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
  •