Results 1 to 3 of 3
  1. #1
    mew
    mew is offline Member
    Join Date
    Nov 2007
    Posts
    70
    Rep Power
    0

    Default How to alter the title of JOptionPane

    I am taking name of the user through JOptionPane. How can I display some text in the title of JOptionPane.

    Java Code:
    String name;
    name= JOptionPane.showInputDialog(null, "What is your name?");

  2. #2
    revathi17 is offline Member
    Join Date
    Aug 2007
    Posts
    26
    Rep Power
    0

    Default

    There is a method in JOptionPane as
    JOptionPane.showInputDialog(parentComponent, message, title, messageType)

    where you can specify the title of the dialog too.
    In your case you can do something like this:

    String name = JOptionPane.showInputDialog(null, "Enter your name", "Enter name", JOptionPane.PLAIN_MESSAGE);

  3. #3
    mew
    mew is offline Member
    Join Date
    Nov 2007
    Posts
    70
    Rep Power
    0

Similar Threads

  1. String Title case
    By bugger in forum New To Java
    Replies: 6
    Last Post: 01-31-2012, 01:21 PM
  2. Replies: 6
    Last Post: 10-23-2008, 11:21 AM
  3. String manipulation example (Title case)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 09:04 AM
  4. Hiding the frameís title bar
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-21-2007, 08:41 AM
  5. How can I add an ICON on a JDialog's Title-Bar?
    By iimasd in forum AWT / Swing
    Replies: 2
    Last Post: 11-06-2007, 12:54 PM

Posting Permissions

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