Results 1 to 6 of 6
  1. #1
    vjoseph is offline Member
    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0

    Default To prevent the user to close JOPTIONPANE USING the X button IN IT

    I want to prevent the user to close the Joptionpane by clicking the X in the right end corner. I am attching my code for your reference. The requirement is even if the user click the X in optionpane it should not close.

    Code:
    optionsConfirm[0] = new String(EJbundle.getString("YES"));
    optionsConfirm[1] = new String(EJbundle.getString("NO"));
    int answer = JOptionPane.showOptionDialog(getEJSummTablePanel() , ejRes.getString("161"), ejRes .getString("WARNING_MESSAGE"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, optionsConfirm, optionsConfirm[0])

    if (answer== JOptionPane.YES_OPTION) { int selectedRow = EJEPanTable.getSelectedRow(); setSelRow(selectedRow); EJNumberHolder ejNumberHolder = getEjNumHolderList().get(getSelRow()); correctSelectedTableRow(correctRequest(ejNumberHol der)); }

    if (answer == JOptionPane.CLOSED_OPTION) { If the user click the X button of the JOPTIONPANE it should not close. setdefaultclose operation is in JDialog. I dont know how to implement in JOptionPane }

  2. #2
    vjoseph is offline Member
    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0

    Default

    Please help me to resolve this issue

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

  4. #4
    vjoseph is offline Member
    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0

    Default

    I thought the code posted makes clear abt my doubt and the problem. My query is about the JOptionPane.CLOSED_OPTION. I appreciate your thoughts..Going forward i will do the same.

  5. #5
    vjoseph is offline Member
    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0

    Default

    if (answer == JOptionPane.CLOSED_OPTION)

    {
    If the user click the X button of the JOPTIONPANE it should not close.
    setdefaultclose operation is in JDialog.
    The docs doesnt show how to go for implementation or any in JOptionPane

    }

  6. #6
    vjoseph is offline Member
    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0

    Default

    Thanks camickr for the problem resolution. Once again thanks

Similar Threads

  1. remove close button
    By silversurfer2in in forum AWT / Swing
    Replies: 9
    Last Post: 07-02-2013, 08:05 PM
  2. override the close button
    By shaay in forum AWT / Swing
    Replies: 4
    Last Post: 08-29-2010, 03:42 PM
  3. How do I close a frame with a button?
    By Psyclone in forum AWT / Swing
    Replies: 7
    Last Post: 02-19-2010, 10:43 PM
  4. Replies: 1
    Last Post: 02-01-2010, 01:47 PM
  5. Refresh Button Resubmitting Data - How To Prevent This?
    By Tirka in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-09-2009, 09:22 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
  •