Results 1 to 2 of 2
  1. #1
    Althalus is offline Member
    Join Date
    Dec 2015
    Posts
    2
    Rep Power
    0

    Default RGBtoHSB wants float[] but setBackground wants Color... Why?

    RGBtoHSB wants float[] but setBackground wants Color... does anyone know a way to fix this?

    Java Code:
    package teststuff;
    
    import java.awt.Color;
    import java.awt.Graphics;
    
    import javax.swing.JApplet;
    
    public class test extends JApplet{
    
    		public void paint(Graphics page)
    	     {
    	     
    			int r = 50, g = 10, b = 90;
    			Color color; {
    				float[] color3 = null;
    			 float[] color2 = Color.RGBtoHSB(r, g, b, color3); {
    			 System.out.println(color2);
    			 getContentPane().setBackground(color);
    			 }
    			 }
    			}
    		}
    }
    Last edited by Althalus; 12-14-2015 at 07:23 AM.

  2. #2
    Althalus is offline Member
    Join Date
    Dec 2015
    Posts
    2
    Rep Power
    0

    Default Re: RGBtoHSB wants float[] but setBackground wants Color... Why?

    It's ok, I figured it out.
    Java Code:
    package teststuff;
    
    import java.awt.Color;
    import java.awt.Graphics;
    
    import javax.swing.JApplet;
    
    public class test extends JApplet{
    
    		public void paint(Graphics page)
    	     {
    	     
    			float h = 50, s = 20, b = 50;
    				//Color color = new Color(h, s, b);
    			 getContentPane().setBackground(Color.getHSBColor(h, s, b));
    			 System.out.println(Color.getHSBColor(h, s, b));
    	     }
    }

Similar Threads

  1. setBackground Color problem
    By kevrod79 in forum AWT / Swing
    Replies: 9
    Last Post: 01-05-2012, 09:53 PM
  2. SetBackground for JComponent
    By tulasi.neppali in forum AWT / Swing
    Replies: 5
    Last Post: 09-12-2010, 10:14 PM
  3. Problems with setBackground()
    By Oleg in forum New To Java
    Replies: 6
    Last Post: 03-07-2010, 04:59 PM
  4. JButton.setBackground() Problem
    By ellias2007 in forum AWT / Swing
    Replies: 2
    Last Post: 02-24-2010, 09:49 PM
  5. [COLOR="Navy"]execute .bat file in mysql [/COLOR]
    By msankar.ravi in forum Networking
    Replies: 0
    Last Post: 02-24-2010, 04:27 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
  •