List of usage examples for java.awt Color getGreen
public int getGreen()
From source file:com.controlj.addon.gwttree.server.OpaqueBarRenderer3D.java
private Color getTopDark(Color primary) { float hsbVals[] = new float[3]; Color.RGBtoHSB(primary.getRed(), primary.getGreen(), primary.getBlue(), hsbVals); hsbVals[1] = 0.9f;/*from w w w . j a v a 2 s.c o m*/ hsbVals[2] = 0.6f; return Color.getHSBColor(hsbVals[0], hsbVals[1], hsbVals[2]); }
From source file:com.controlj.addon.gwttree.server.OpaqueBarRenderer3D.java
private Color getFrontDark(Color primary) { float hsbVals[] = new float[3]; Color.RGBtoHSB(primary.getRed(), primary.getGreen(), primary.getBlue(), hsbVals); hsbVals[1] = 1.0f;//w w w .j ava2 s .co m hsbVals[2] = 0.5f; return Color.getHSBColor(hsbVals[0], hsbVals[1], hsbVals[2]); }
From source file:com.controlj.addon.gwttree.server.OpaqueBarRenderer3D.java
private Color getSideLight(Color primary) { float hsbVals[] = new float[3]; Color.RGBtoHSB(primary.getRed(), primary.getGreen(), primary.getBlue(), hsbVals); hsbVals[1] = .6f;/*from ww w . j ava2 s . c o m*/ hsbVals[2] = 0.6f; return Color.getHSBColor(hsbVals[0], hsbVals[1], hsbVals[2]); }
From source file:com.controlj.addon.gwttree.server.OpaqueBarRenderer3D.java
private Color getSideDark(Color primary) { float hsbVals[] = new float[3]; Color.RGBtoHSB(primary.getRed(), primary.getGreen(), primary.getBlue(), hsbVals); hsbVals[1] = 1.0f;//from ww w. ja v a 2 s. c o m hsbVals[2] = 0.3f; return Color.getHSBColor(hsbVals[0], hsbVals[1], hsbVals[2]); }
From source file:net.sf.mzmine.chartbasics.chartthemes.EStandardChartTheme.java
public void setNoBackground(boolean state) { Color c = ((Color) this.getPlotBackgroundPaint()); Color cchart = ((Color) this.getChartBackgroundPaint()); this.setPlotBackgroundPaint(new Color(c.getRed(), c.getGreen(), c.getBlue(), state ? 0 : 255)); this.setChartBackgroundPaint( new Color(cchart.getRed(), cchart.getGreen(), cchart.getBlue(), state ? 0 : 255)); this.setLegendBackgroundPaint( new Color(cchart.getRed(), cchart.getGreen(), cchart.getBlue(), state ? 0 : 255)); }
From source file:haven.Utils.java
public static Color contrast(Color col) { int max = Math.max(col.getRed(), Math.max(col.getGreen(), col.getBlue())); if (max > 128) { return (new Color(col.getRed() / 2, col.getGreen() / 2, col.getBlue() / 2, col.getAlpha())); } else if (max == 0) { return (Color.WHITE); } else {/*from ww w. ja va 2s . c o m*/ int f = 128 / max; return (new Color(col.getRed() * f, col.getGreen() * f, col.getBlue() * f, col.getAlpha())); } }
From source file:gr.iti.mklab.reveal.forensics.util.Util.java
public static double[][][] getImageDifferenceD(BufferedImage image1, BufferedImage image2) { Color tmpColor1, tmpColor2; int width = image1.getWidth(); int height = image1.getHeight(); double red_temp, green_temp, blue_temp; double[][][] outputMap = new double[3][width][height]; for (int ii = 0; ii < width; ii++) { for (int jj = 0; jj < height; jj++) { tmpColor1 = new Color(image1.getRGB(ii, jj)); tmpColor2 = new Color(image2.getRGB(ii, jj)); red_temp = tmpColor1.getRed() - tmpColor2.getRed(); green_temp = tmpColor1.getGreen() - tmpColor2.getGreen(); blue_temp = tmpColor1.getBlue() - tmpColor2.getBlue(); outputMap[0][ii][jj] = (double) (red_temp) * (red_temp); outputMap[1][ii][jj] = (double) (green_temp) * (green_temp); outputMap[2][ii][jj] = (double) (blue_temp) * (blue_temp); }/* ww w .ja v a 2 s . co m*/ } return outputMap; }
From source file:ColorGradient.java
/** * Draw a color gradient from the top of the specified component to the * bottom. Start with the start color and change smoothly to the end *//* w w w. ja v a2 s.com*/ public void fillGradient(Component c, Graphics g, Color start, Color end) { Rectangle bounds = this.getBounds(); // How big is the component? // Get the red, green, and blue components of the start and end // colors as floats between 0.0 and 1.0. Note that the Color class // also works with int values between 0 and 255 float r1 = start.getRed() / 255.0f; float g1 = start.getGreen() / 255.0f; float b1 = start.getBlue() / 255.0f; float r2 = end.getRed() / 255.0f; float g2 = end.getGreen() / 255.0f; float b2 = end.getBlue() / 255.0f; // Figure out how much each component should change at each y value float dr = (r2 - r1) / bounds.height; float dg = (g2 - g1) / bounds.height; float db = (b2 - b1) / bounds.height; // Now loop once for each row of pixels in the component for (int y = 0; y < bounds.height; y++) { g.setColor(new Color(r1, g1, b1)); // Set the color of the row g.drawLine(0, y, bounds.width - 1, y); // Draw the row r1 += dr; g1 += dg; b1 += db; // Increment color components } }
From source file:Main.java
public Main() { for (int i = 0; i < panels.length; i++) { final String[] labels = new String[] { "0", "1" }; final Random rand = new Random(); int index = rand.nextInt(labels.length); String randomTitle = labels[index]; final JLabel label = new JLabel(randomTitle, JLabel.CENTER); Timer lblt = new Timer(00, new ActionListener() { @Override/*from ww w .ja va 2 s . c o m*/ public void actionPerformed(ActionEvent ae) { label.setText(labels[rand.nextInt(labels.length)]); } }); lblt.setRepeats(true); lblt.start(); label.setForeground(Color.green); label.setVerticalAlignment(JLabel.CENTER); panels[i] = new JPanel(); panels[i].setBackground(Color.BLACK); panels[i].add(label); frame.getContentPane().add(panels[i]); } frame.setLayout(new GridLayout(grid, grid)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); frame.setVisible(true); ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (int i = 0; i < panels.length; i++) { Color mix = new Color(255, 255, 255); Random random = new Random(); int r = random.nextInt(255); int g = random.nextInt(255); int b = random.nextInt(255); if (mix != null) { r = (r + mix.getRed()) / 2; g = (g + mix.getGreen()) / 2; b = (b + mix.getBlue()) / 2; } Color color = new Color(r, g, b); panels[i].setBackground(color); } } }; t = new Timer(00, action); t.setRepeats(true); t.start(); }
From source file:haven.Utils.java
public static float[] c2fa(Color c) { return (new float[] { ((float) c.getRed() / 255.0f), ((float) c.getGreen() / 255.0f), ((float) c.getBlue() / 255.0f), ((float) c.getAlpha() / 255.0f) }); }