List of usage examples for java.awt Color getBlue
public int getBlue()
From source file:org.webcurator.ui.admin.controller.CreateFlagController.java
public String getComplementColour(String hexColour) throws JspException { String output = null;/* w w w.j a v a2 s . c o m*/ Integer i = null; if (hexColour == null || hexColour.equals("")) { i = 0; } else { i = Integer.parseInt(hexColour, 16); } int red = (i >> 16); int green = (i >> 8) & 0xFF; int blue = i & 0xFF; float[] hsl; float alpha; Color rgb = new Color(red, green, blue); hsl = fromRGB(rgb); alpha = rgb.getAlpha() / 255.0f; float hue = (hsl[0] + 180.0f) % 360.0f; Color complement = toRGB(hue, hsl[1], hsl[2], 1.0f); output = rgb2hex(complement.getRed(), complement.getGreen(), complement.getBlue()); return output; }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.PlateHeatMapController.java
/** * Plot the z-scores: simple scatterplot */// w w w. j a va2 s. c o m private void plotZScores() { XYSeriesCollection xySeriesCollection = new XYSeriesCollection(); Map<Well, Double> map = computeZScoresForMap(); List<PlateCondition> plateConditionList = trackCoordinatesController.getPlateConditionList(); for (int i = 0; i < plateConditionList.size(); i++) { // current condition PlateCondition condition = plateConditionList.get(i); XYSeries series = new XYSeries(i + "-" + condition); for (int j = 0; j < condition.getSingleCellAnalyzedWells().size(); j++) { // current well Well well = condition.getSingleCellAnalyzedWells().get(j); series.add(i + 1, map.get(well)); } xySeriesCollection.addSeries(series); } JFreeChart jfreechart = ChartFactory.createScatterPlot("z*-score", "condition number", "z*-score", xySeriesCollection, PlotOrientation.VERTICAL, false, true, false); JFreeChartUtils.setupXYPlot(jfreechart.getXYPlot()); jfreechart.getXYPlot().getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // line for the median speed ValueMarker marker = new ValueMarker(0); marker.setPaint(Color.GRAY); Stroke dashedStroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 1.0f, 3.0f }, 0.0f); marker.setStroke(dashedStroke); jfreechart.getXYPlot().addRangeMarker(marker); marker = new ValueMarker(3); marker.setPaint(Color.GRAY); marker.setStroke(dashedStroke); jfreechart.getXYPlot().addRangeMarker(marker); marker = new ValueMarker(-3); marker.setPaint(Color.GRAY); marker.setStroke(dashedStroke); jfreechart.getXYPlot().addRangeMarker(marker); XYItemRenderer renderer = jfreechart.getXYPlot().getRenderer(); for (int i = 0; i < xySeriesCollection.getSeriesCount(); i++) { // plot lines according to conditions indexes int colorIndex = i % GuiUtils.getAvailableColors().length; Color color = GuiUtils.getAvailableColors()[colorIndex]; color = new Color(color.getRed(), color.getGreen(), color.getBlue(), 127); renderer.setSeriesPaint(i, color); renderer.setSeriesShape(i, new Ellipse2D.Double(0, 0, 10, 10)); } zScoreChartPanel.setChart(jfreechart); }
From source file:org.geoserver.wms.wms_1_1_1.GetLegendGraphicTest.java
/** * Tests an custom legend graphic/*from w w w .j a va 2s. com*/ */ @Test public void testCustomLegend() throws Exception { String base = "wms?service=WMS&version=1.1.1&request=GetLegendGraphic" + "&layer=sf:states&style=custom" + "&format=image/png&width=22&height=22"; BufferedImage image = getAsImage(base, "image/png"); Resource resource = getResourceLoader().get("styles/legend.png"); BufferedImage expected = ImageIO.read(resource.file()); assertEquals(getPixelColor(expected, 10, 2).getRGB(), getPixelColor(image, 10, 2).getRGB()); // test rescale base = "wms?service=WMS&version=1.1.1&request=GetLegendGraphic" + "&layer=sf:states&style=custom" + "&format=image/png&width=16&height=16"; image = getAsImage(base, "image/png"); Color expectedColor = getPixelColor(expected, 11, 11); Color actualColor = getPixelColor(image, 8, 8); assertEquals("red", expectedColor.getRed(), actualColor.getRed()); assertEquals("green", expectedColor.getGreen(), actualColor.getGreen()); assertEquals("blue", expectedColor.getBlue(), actualColor.getBlue()); assertEquals("alpha", expectedColor.getAlpha(), actualColor.getAlpha()); }
From source file:util.program.ProgramTextCreator.java
private static void startInfoSection(StringBuilder buffer, String section) { Color foreground = Color.black;//Settings.propProgramPanelForegroundColor.getColor(); buffer.append("<tr><td valign=\"top\" style=\"color:#808080; font-size:"); buffer.append(mBodyFontSize);//from ww w.j a v a 2s . c om buffer.append("\"><b>"); buffer.append(section); buffer.append("</b></td><td style=\"color:rgb(" + foreground.getRed() + "," + foreground.getGreen() + "," + foreground.getBlue() + "); font-size:"); buffer.append(mBodyFontSize); buffer.append("\">"); }
From source file:nz.ac.massey.cs.gql4jung.browser.resultviews.GraphBasedResultView.java
private Map<String, Color> createColorMap(MotifInstance instance) { if (instance == null) return new HashMap<String, Color>(0); Set<Vertex> vertices = instance.getVertices(); Set<String> packages = new HashSet<String>(vertices.size()); for (Vertex v : vertices) { packages.add(v.getNamespace());//from www . j av a2s . c o m } int count = 0; Map<String, Color> pmap = new HashMap<String, Color>(packages.size()); float offset = 100 / packages.size(); offset = offset / 100; for (String p : packages) { Color hsb = Color.getHSBColor(count * offset, settings.getVertexSaturation(), settings.getVertexBrightness()); pmap.put(p, new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue(), settings.getVertexTransparency())); // transparency //pmap.put(p,hsb); count = count + 1; } return pmap; }
From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileChartPanelEditor.java
private Component createChartPanel() { depthSerie = new XYSeries("depth"); XYSeriesCollection depthCollection = new XYSeriesCollection(); depthCollection.addSeries(depthSerie); JFreeChart chart = ChartFactory.createXYLineChart("", I18nResourceManager.sharedInstance().getString("time"), I18nResourceManager.sharedInstance().getString("depth"), depthCollection, PlotOrientation.VERTICAL, true, true, false);// www . j av a 2s . c o m plot = chart.getXYPlot(); Paint p = new GradientPaint(0f, 0f, UIAgent.getInstance().getColorWaterBottom(), 200f, 200f, UIAgent.getInstance().getColorWaterSurface(), false); plot.setBackgroundPaint(p); XYAreaRenderer renderer0 = new XYAreaRenderer(); renderer0.setOutline(true); renderer0.setBaseOutlinePaint(UIAgent.getInstance().getColorProfileEdition()); Color baseColor = UIAgent.getInstance().getColorBaseBackground(); renderer0.setSeriesPaint(0, new Color(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), 50)); plot.setRenderer(0, renderer0); dAxis = new NumberAxis(); rAxis = new NumberAxis(); // dAxis.setAutoRange(false); // rAxis.setAutoRange(false); // dAxis.setRange(0, maxTime); // rAxis.setRange(lowestDepth, 0); plot.setDomainAxis(dAxis); plot.setRangeAxis(rAxis); // plot.setRangeCrosshairLockedOnData(false); // plot.setDomainCrosshairLockedOnData(false); ((NumberAxis) plot.getDomainAxis()).setNumberFormatOverride(new MinutesNumberFormat()); panel = new ChartPanel(chart); // panel.addChartMouseListener(new ChartMouseListener() { // // @Override // public void chartMouseMoved(ChartMouseEvent arg0) { // // TODO Auto-generated method stub // // } // // @Override // public void chartMouseClicked(ChartMouseEvent evt) { // // double x = plot.getDomainAxis().java2DToValue( // panel.translateScreenToJava2D( // evt.getTrigger().getPoint()).getX(), // panel.getChartRenderingInfo().getPlotInfo() // .getDataArea(), plot.getDomainAxisEdge()); // // double y = plot.getRangeAxis().java2DToValue( // panel.translateScreenToJava2D( // evt.getTrigger().getPoint()).getY(), // panel.getChartRenderingInfo().getPlotInfo() // .getDataArea(), plot.getRangeAxisEdge()); // // diveProfileEditor.addEntry(x, y, this); // } // }); createDecoWarningCollection(); createAscentTooFastCollection(); createRemainBottomTimeCollection(); createDecoEntriesCollection(); return panel; }
From source file:util.ui.UiUtilities.java
/** * Creates a Html EditorPane that holds a HTML-Help Text. * * Add a Listener if you want to have clickable Links * * @param html// w ww . j a v a 2s . c o m * HTML-Text to display * @param listener * Link-Listener for this HelpText * @param background The color for the background. * @return EditorPane that holds a Help Text * @since 2.7.2 */ public static JEditorPane createHtmlHelpTextArea(String html, HyperlinkListener listener, Color background) { // Quick "hack". Remove HTML-Code and replace it with Code that includes the // correct Font if (html.indexOf("<html>") >= 0) { html = StringUtils.substringBetween(html, "<html>", "</html>"); } JLabel label = new JLabel(); Font font = label.getFont(); html = "<html><div style=\"color:" + UiUtilities.getHTMLColorCode(label.getForeground()) + ";font-family:" + font.getName() + "; font-size:" + font.getSize() + ";background-color:rgb(" + background.getRed() + "," + background.getGreen() + "," + background.getBlue() + ");\">" + html + "</div></html>"; final JEditorPane pane = new JEditorPane("text/html", html); pane.setBorder(BorderFactory.createEmptyBorder()); pane.setEditable(false); pane.setFont(font); pane.setOpaque(false); pane.setFocusable(false); if (listener != null) { pane.addHyperlinkListener(listener); } return pane; }
From source file:haven.Utils.java
public static Color blendcol(Color x, Color y, double a) { int f1 = (int) (a * 255), f2 = 255 - f1; return (new Color(((x.getRed() * f2) + (y.getRed() * f1)) / 255, ((x.getGreen() * f2) + (y.getGreen() * f1)) / 255, ((x.getBlue() * f2) + (y.getBlue() * f1)) / 255, ((x.getAlpha() * f2) + (y.getAlpha() * f1)) / 255)); }
From source file:com.fanniemae.ezpie.actions.HighlightScan.java
private boolean checkIfColorInRange(Color colorFound, Color toCompare, int range) { int red = colorFound.getRed() - toCompare.getRed(); int green = colorFound.getGreen() - toCompare.getGreen(); int blue = colorFound.getBlue() - toCompare.getBlue(); if (Math.abs(red) < range && Math.abs(green) < range && Math.abs(blue) < range) return true; return false; }
From source file:haven.Utils.java
public static Color blendcol(Color in, Color bl) { int f1 = bl.getAlpha(); int f2 = 255 - bl.getAlpha(); return (new Color(((in.getRed() * f2) + (bl.getRed() * f1)) / 255, ((in.getGreen() * f2) + (bl.getGreen() * f1)) / 255, ((in.getBlue() * f2) + (bl.getBlue() * f1)) / 255, in.getAlpha())); }