Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2014
    Posts
    15
    Rep Power
    0

    Default JOptionPane.showMessageDialog Customization

    Hello World!

    I have here a snippet of code from the end of one of my programs.
    It uses JOptionPane.showMessageDialog to display an animated .gif file, along with a calculation and some text.

    UIManager CheckThisOut = new UIManager();
    CheckThisOut.put("OptionPane.messageForeground", Color.orange);
    CheckThisOut.put("Panel.background", Color.black);
    ImageIcon icon = new ImageIcon("C:\\Users\\dillo_000\\Videos\\Cat.gif") ;
    JOptionPane.showMessageDialog(null, "The distance traveled is "
    + totalDistance + " !", "MEOW", JOptionPane.INFORMATION_MESSAGE,
    icon);

    MY Questions(2): Is it possible to center text (in this case, "The distance traveled is " + totalDistance + "!") over an ImageIcon(like the .gif file I have used)?
    Is there a way to expand my ImageIcon to fill the area or use it as a background of my MessageDialog?

    When I run my program as it is right now, the MessageDialog opens and my .gif ImageIcon doesn't fill all of the area within the MessageDialog, and this seemed to push my orange text to the far right of my MessageDialog (I was hoping to have the text centered over my ImageIcon).

    I used NetBeans IDE 7.4 if it helps at all...

    Thanks in advance
    Last edited by NoviceJavaNoob; 04-12-2014 at 12:31 PM.

Similar Threads

  1. JOptionPane.showMessageDialog use
    By camaro01 in forum New To Java
    Replies: 7
    Last Post: 04-22-2011, 05:19 AM
  2. Replies: 5
    Last Post: 07-29-2009, 07:38 PM
  3. help with JOptionPane.showMessageDialog()
    By gmn1 in forum New To Java
    Replies: 8
    Last Post: 03-30-2009, 10:31 AM
  4. About JOptionPane.showMessageDialog
    By jhetfield18 in forum AWT / Swing
    Replies: 2
    Last Post: 11-02-2007, 11:45 PM
  5. About JOptionPane.showMessageDialog
    By jhetfield18 in forum Advanced Java
    Replies: 0
    Last Post: 11-02-2007, 11:56 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
  •