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

    Default Custom dialogs using JOptionPane

    When I create a JDialog with a JOptionPane as its content pane, as described here, the JDialog doesn't respect the JOptionPane's message and option type. It always displays as if it were set to WARNING_MESSAGE and OK_OPTION. (There are actually a bunch of things wrong with that example code, including setLabel(String) being undefined, and the fact that optionPane.getValue() does not necessarily return an Integer. In fact, it's initialized as a String.)

    It displays correctly if I call JOptionPane.showXXXDialog(...) with my panel as the message, but then I don't know how to validate the input before the dialog closes.

    Anyone know of an up-to-date tutorial about this?

    Edit: Nevermind. I had my message and option type params reversed.
    Last edited by kjkrum; 10-21-2013 at 12:04 AM.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Add custom icon to JOptionPane
    By Return 0 in forum New To Java
    Replies: 12
    Last Post: 01-27-2012, 01:44 PM
  2. Custom graphics on dialogs, etc.
    By trader5050 in forum New To Java
    Replies: 1
    Last Post: 11-24-2010, 07:29 AM
  3. Communicating between Dialogs and Frames
    By frejon26 in forum Threads and Synchronization
    Replies: 1
    Last Post: 05-23-2010, 05:49 AM
  4. How do I get all dialogs?
    By zenteo in forum AWT / Swing
    Replies: 6
    Last Post: 03-08-2010, 10:01 PM
  5. Replies: 0
    Last Post: 12-17-2007, 09:46 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
  •