Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Need help with changing color of JOptionPane

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    5
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need help with changing color of JOptionPane

    Hello,

    I need to change the color of output box to white. I guess the best would be to use UIManager.put("OptionPane.messageForeground", Color.white);? how do i use this? Sorry, I am very new to java

     
    import java.awt.Color;
     
    import  javax.swing.*;
     
    public class square{
     
     
     
    	public void perimeter(){
     
     
    		double sq;
     
    	String shape2 = JOptionPane.showInputDialog("Enter shape you want to calculate the circumference for - Enter 1-square, 2-rectangle, 3-circle, 4-triangle, and 5-Exit.  ");
    	int shape =  Integer.parseInt(shape2);
     
     
    	 if (shape ==1){
     
     
    	String square2 = JOptionPane.showInputDialog("Enter numeric value in centimeters ");
     
    	double square =  Double.parseDouble(square2);
     
    	 sq= 4 * square;
     
    			     JOptionPane.showMessageDialog(null,
    			     "You selected Square \n Length of each side= " + square + " cm \n Area=" + sq +"cm");
     
    			    }
     
     
    		if (shape ==5){
     
    			System.exit(0);
    		}}}


  2. #2
    Junior Member
    Join Date
    Apr 2011
    Posts
    5
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Need help with changing color of JOptionPane

    Also, i need to create a color() method so other classes can inherit it. many thx!!!

Similar Threads

  1. Trying to output color....HELP PLEASE!
    By toppcon in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 15th, 2011, 11:52 PM
  2. Changing Panel Color with a ComboBox
    By bengregg in forum AWT / Java Swing
    Replies: 7
    Last Post: March 2nd, 2011, 10:04 PM
  3. JTable Row Color
    By aussiemcgr in forum Java Theory & Questions
    Replies: 2
    Last Post: October 8th, 2010, 04:59 PM
  4. Color Problem
    By aussiemcgr in forum Java Theory & Questions
    Replies: 5
    Last Post: July 12th, 2010, 04:53 PM
  5. changing the visited links color in JEditorpane
    By nasi in forum AWT / Java Swing
    Replies: 5
    Last Post: April 18th, 2010, 09:44 AM