Color: HSBtoRGB(float hue,float saturation,float brightness) : Color « java.awt « Java by API






Color: HSBtoRGB(float hue,float saturation,float brightness)

   
import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MainClass extends JPanel {

  public void paint(Graphics g) {
    int n = 3;
    int xdata[] = new int[n];
    int ydata[] = new int[n];
    xdata[0] = 50;
    ydata[0] = 150;
    xdata[1] = 200;
    ydata[1] = 50;
    xdata[2] = 350;
    ydata[2] = 150;
    int rgb = Color.HSBtoRGB(1.0f, 1.0f, 1.0f);
    g.setColor(new Color(rgb));
    g.fillPolygon(xdata, ydata, n);

  }

  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new MainClass());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 200);
    frame.setVisible(true);
  }
}

           
         
    
    
  








Related examples in the same category

1.Color.GRAY
2.Color.lightGray
3.Color.magenta
4.Color.pink
5.new Color(int r, int g, int b)
6.new Color(int rgb)
7.Color: equals(Object obj)
8.Color: getComponents(float[] compArray)
9.Color: getRGB()
10.Color: RGBtoHSB(int r, int g, int b, float[] hsbvals)