List of usage examples for java.awt Color orange
Color orange
To view the source code for java.awt Color orange.
Click Source Link
From source file:com.github.andreax79.meca.Main.java
public static Stats drawRule(int ruleNumber, int size, Boundaries boundaries, UpdatePattern updatePattern, int steps, double alpha, String pattern, Output output, ColorScheme colorScheme) throws IOException { Rule rule = new Rule(ruleNumber); Row row = new Row(size, rule, boundaries, updatePattern, pattern, alpha); // e.g. 00010011011111 Stats stats = new Stats(); FileOutputStream finalImage = null; Graphics2D g = null;/* w w w . j a va 2s . c o m*/ BufferedImage img = null; if (output != Output.noOutput) { String fileName = "rule" + ruleNumber; // pattern if (pattern != null) fileName += pattern; // alpha if (alpha > 0) fileName += String.format("_a%02d", (int) (alpha * 100)); // updatePattern if (updatePattern != UpdatePattern.synchronous) fileName += "-" + updatePattern; fileName += ".jpeg"; File file = new File(fileName); finalImage = new FileOutputStream(file); int width = (int) (cellSize * (size + 1) * (output == Output.all ? 1.25 : 1)); int height = cellSize * (steps + 1); img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); g = img.createGraphics(); g.setBackground(Color.white); g.clearRect(0, 0, width, height); g.setColor(Color.black); } int startMeansFromStep = 50; List<Double> densities = new LinkedList<Double>(); double totalDensities = 0; double prevValue = 0; double prevDelta = 0; double prevOnes = 0; double prevOnesDelta = 0; for (int t = 0; t < steps; t++) { if (t >= startMeansFromStep) { double density = row.getDensity(); densities.add(density); totalDensities += density; } // System.out.println(String.format("%4d", t) + " " + row.toString() + " ones=" + row.getOnes()); if (output != Output.noOutput) { for (int j = 0; j < row.getSize(); j++) { switch (colorScheme) { case noColor: if (row.getCell(j).getState()) { g.setColor(Color.black); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); } break; case omegaColor: g.setColor(row.getCell(j).getOmegaColor()); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); break; case activationColor: if (row.getCell(j).getState()) { g.setColor(row.getCell(j).getColor()); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); } break; } } if (output == Output.all) { double value = row.getValue(); double delta = Math.abs(value - prevValue); double ones = row.getOnes(); double onesDelta = Math.abs(ones - prevOnes); if (t > 0) { g.setColor(Color.red); g.drawLine((int) (prevValue * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (value * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); g.setColor(Color.blue); g.drawLine((int) (prevOnes * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (ones * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); if (t > 1) { g.setColor(Color.orange); g.drawLine((int) (prevDelta * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (delta * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); g.setColor(Color.cyan); g.drawLine((int) (prevOnesDelta * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (onesDelta * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); } } prevValue = value; prevDelta = delta; prevOnes = ones; prevOnesDelta = onesDelta; } } row = new Row(row); } double means = totalDensities / densities.size(); double var = 0; for (double density : densities) var += Math.pow(density - means, 2); var = var / densities.size(); System.out.println("Rule: " + ruleNumber + " Boundaties: " + boundaries + " UpdatePattern: " + updatePattern + " Alpha: " + String.format("%.3f", alpha) + " Means: " + String.format("%.6f", means) + " Variance: " + String.format("%.6f", var)); stats.setMeans(means); stats.setVariance(var); if (output != Output.noOutput) { JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(finalImage); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img); param.setQuality(1.0f, true); encoder.encode(img, param); finalImage.flush(); finalImage.close(); } return stats; }
From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo9.java
/** * Returns an array of paint objects that will be used for the bar colors. * //from w ww .j a va2 s . c o m * @return An array of paint objects. */ private static Paint[] createPaint() { Paint[] colors = new Paint[5]; colors[0] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.red); colors[1] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.green); colors[2] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.blue); colors[3] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.orange); colors[4] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.magenta); return colors; }
From source file:com.seleniumtests.it.driver.TestBrowserSnapshot.java
/** * Test page contains fixed header (yellow) and footer (orange) of 5 pixels height. Detect how many * pixels of these colors are present in picture * Also count red pixels which is a line not to remove when cropping * @param picture/*from ww w . j a v a2 s .c om*/ * @return * @throws IOException */ private int[] getHeaderAndFooterPixels(File picture) throws IOException { BufferedImage image = ImageIO.read(picture); int topPixels = 0; int bottomPixels = 0; int securityLine = 0; for (int height = 0; height < image.getHeight(); height++) { Color color = new Color(image.getRGB(0, height)); if (color.equals(Color.YELLOW)) { topPixels++; } else if (color.equals(Color.ORANGE)) { bottomPixels++; } else if (color.equals(Color.RED) || color.equals(Color.GREEN)) { securityLine++; } } return new int[] { topPixels, bottomPixels, securityLine }; }
From source file:de.fuberlin.agcsw.heraclitus.graph.GraphAnalyse.java
private static void initJungViewer() { // Create Layout for Visualization Graph<JungVertex, JungEdge> g = new DirectedSparseMultigraph<JungVertex, JungEdge>(); KKLayout<JungVertex, JungEdge> l = new KKLayout<JungVertex, JungEdge>(g); l.setMaxIterations(100);//ww w. ja va 2 s.c o m vv = new VisualizationViewer<JungVertex, JungEdge>(l); vv.addComponentListener(new FrameComponentListener()); JungClickOnPickMouseListener lis = new JungClickOnPickMouseListener(); vv.addMouseListener(lis); vv.addMouseMotionListener(lis); vv.setDoubleBuffered(true); //init Mouse Picking DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); gm.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(gm); Transformer<JungVertex, Paint> vertexPaint = new Transformer<JungVertex, Paint>() { public Paint transform(JungVertex v) { if (v.getUri() == null) { //this is a literal return Color.GRAY; } if (v.getLabel().startsWith("node")) { //this is a blank node return Color.orange; } return Color.RED; } }; Transformer<JungVertex, Shape> vertexShape = new Transformer<JungVertex, Shape>() { @Override public Shape transform(JungVertex v) { if (v.getLabel().startsWith("node")) { //this is a blank node Arc2D.Double arc = new Arc2D.Double(-15, -15, 30, 30, 0, 360, Arc2D.CHORD); return arc; } RoundRectangle2D.Double rec = new RoundRectangle2D.Double(-65, -12.5, 130, 25, 30, 30); return rec; } }; vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<JungVertex>()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<JungEdge>()); vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderContext().setVertexShapeTransformer(vertexShape); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); }
From source file:org.adempiere.apps.graph.GraphBuilder.java
private void setupCategoryChart(JFreeChart chart) { CategoryPlot plot = chart.getCategoryPlot(); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, new Color(92 / 255f, 178 / 255f, 232 / 255f)); renderer.setSeriesPaint(1, new Color(56 / 255f, 97 / 255f, 119 / 255f)); renderer.setSeriesPaint(2, new Color(242 / 255f, 70 / 255f, 78 / 255f)); renderer.setSeriesPaint(3, Color.orange); renderer.setSeriesPaint(4, new Color(147 / 255f, 196 / 255f, 51 / 255f)); renderer.setSeriesPaint(5, new Color(210 / 255f, 247 / 255f, 91 / 255f)); renderer.setSeriesPaint(6, new Color(129 / 255f, 235 / 255f, 249 / 255f)); renderer.setSeriesPaint(7, new Color(60 / 255f, 84 / 255f, 8 / 255f)); renderer.setSeriesPaint(8, new Color(0.8f, 0.8f, 0.8f)); }
From source file:org.cytoscape.graph.render.immed.GraphGraphicsTest.java
private long drawCurrentFull(Random rand) { final float nodeSizeFactor = 50f; float size = (float) canvasSize; long begin = System.nanoTime(); for (int i = 0; i < numNodes; i++) { float x = rand.nextFloat() * (rand.nextBoolean() ? size : -size); float y = rand.nextFloat() * (rand.nextBoolean() ? size : -size); currentGraphGraphics.drawNodeFull((byte) (i % (int) GraphGraphics.s_last_shape), x, y, (x + (rand.nextFloat() * nodeSizeFactor)), (y + (rand.nextFloat() * nodeSizeFactor)), Color.blue, 1.0f + (i % 10), null, Color.yellow); }/*from ww w . j a v a 2s .c om*/ long end = System.nanoTime(); long nodeDur = end - begin; BasicStroke edgeStroke = new BasicStroke(1f); begin = System.nanoTime(); for (int i = 0; i < numEdges; i++) { currentGraphGraphics.drawEdgeFull((byte) ((i % 7) - 8), rand.nextFloat() * (20f), Color.red, (byte) ((i % 7) - 8), rand.nextFloat() * (20f), Color.orange, rand.nextFloat() * (rand.nextBoolean() ? size : -size), rand.nextFloat() * (rand.nextBoolean() ? size : -size), currentGraphGraphics.m_noAnchors, rand.nextFloat() * (rand.nextBoolean() ? size : -size), rand.nextFloat() * (rand.nextBoolean() ? size : -size), 1f, edgeStroke, Color.green); } end = System.nanoTime(); long duration = (end - begin) + nodeDur; // try { // ImageIO.write(image,"PNG",new File("/tmp/homer-current-" + rand.nextInt(100) + ".png")); // } catch (IOException ioe) { ioe.printStackTrace(); } return duration; }
From source file:com.netsteadfast.greenstep.action.CommonMeterChartAction.java
private void fillChart(String title, float value, int lowerBound, int upperBound) throws Exception { DefaultValueDataset dataset = new DefaultValueDataset(); dataset.setValue(value);//from w w w . ja v a 2 s .com DialPlot plot = new DialPlot(); plot.setView(0.0d, 0.0d, 1.0d, 1.0d); plot.setDataset(0, dataset); StandardDialFrame frame = new StandardDialFrame(); plot.setDialFrame(frame); DialBackground dialBackground = new DialBackground(); dialBackground.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL)); plot.setBackground(dialBackground); DialTextAnnotation textAnnotation = new DialTextAnnotation(title); textAnnotation.setRadius(0.555555555555555555D); plot.addLayer(textAnnotation); DialValueIndicator valueIndicator = new DialValueIndicator(0); plot.addLayer(valueIndicator); StandardDialScale scale1 = new StandardDialScale(); scale1.setLowerBound(lowerBound); scale1.setUpperBound(upperBound); scale1.setStartAngle(-140); // -120 scale1.setExtent(-260D); // -300D scale1.setTickRadius(0.88D); scale1.setTickLabelOffset(0.14999999999999999D); scale1.setTickLabelFont(new Font("", Font.TRUETYPE_FONT, 14)); plot.addScale(0, scale1); StandardDialRange standarddialrange0 = new StandardDialRange(lowerBound, (upperBound * 0.6), Color.red); standarddialrange0.setInnerRadius(0.52000000000000002D); standarddialrange0.setOuterRadius(0.55000000000000004D); plot.addLayer(standarddialrange0); StandardDialRange standarddialrange1 = new StandardDialRange((upperBound * 0.6), (upperBound * 0.8), Color.orange); standarddialrange1.setInnerRadius(0.52000000000000002D); standarddialrange1.setOuterRadius(0.55000000000000004D); plot.addLayer(standarddialrange1); StandardDialRange standarddialrange2 = new StandardDialRange((upperBound * 0.8), upperBound, Color.green); standarddialrange2.setInnerRadius(0.52000000000000002D); standarddialrange2.setOuterRadius(0.55000000000000004D); plot.addLayer(standarddialrange2); Pointer pointer = new Pointer(0); pointer.setFillPaint(new Color(144, 196, 246)); plot.addPointer(pointer); plot.mapDatasetToScale(0, 0); DialCap dialcap = new DialCap(); dialcap.setRadius(0.0700000000000001D); plot.setCap(dialcap); this.chart = new JFreeChart(plot); //this.chart.setBackgroundPaint(new Color(234, 244, 253)); this.chart.setBackgroundPaint(Color.white); }
From source file:uk.co.modularaudio.mads.base.stereo_compressor.ui.OutSignalAmpMeter.java
private void refillMeterImage() { // log.debug("Repainting it."); if (outBufferedImage != null) { outBufferedImageGraphics.setColor(Color.BLACK); outBufferedImageGraphics.fillRect(0, 0, componentWidth, componentHeight); final int meterWidth = PREFERRED_METER_WIDTH; final int totalMeterHeight = componentHeight - 2; final int meterHeight = (showClipBox ? totalMeterHeight - meterWidth : totalMeterHeight); final int meterHeightOffset = (showClipBox ? meterWidth : 0); float levelValue = 0.0f; if (currentMeterValueDb != Float.NEGATIVE_INFINITY) { levelValue = dbToLevelComputer.toNormalisedSliderLevelFromDb(currentMeterValueDb); }//from w w w. j a v a 2 s.c o m outBufferedImageGraphics.setColor(Color.GREEN); final float greenVal = (levelValue >= greenThresholdLevel ? greenThresholdLevel : levelValue); int greenBarHeightInPixels = (int) (greenVal * meterHeight); greenBarHeightInPixels = (greenBarHeightInPixels > (meterHeight) ? (meterHeight) : (greenBarHeightInPixels < 0 ? 0 : greenBarHeightInPixels)); final int greenStartY = meterHeight - greenBarHeightInPixels + 1 + meterHeightOffset; outBufferedImageGraphics.fillRect(3, greenStartY, meterWidth - 4, greenBarHeightInPixels); if (currentMeterValueDb > GREEN_THRESHOLD_DB) { outBufferedImageGraphics.setColor(Color.orange); final float orangeVal = (levelValue >= orangeThreholdLevel ? orangeThreholdLevel : levelValue); int orangeBarHeightInPixels = (int) (orangeVal * meterHeight); orangeBarHeightInPixels = (orangeBarHeightInPixels > (meterHeight) ? (meterHeight) : (orangeBarHeightInPixels < 0 ? 0 : orangeBarHeightInPixels)); // Take off the green orangeBarHeightInPixels -= greenBarHeightInPixels; final int orangeStartY = greenStartY - orangeBarHeightInPixels; // int orangeEndY = greenStartY; outBufferedImageGraphics.fillRect(3, orangeStartY, meterWidth - 4, orangeBarHeightInPixels); if (currentMeterValueDb > ORANGE_THRESHOLD_DB) { outBufferedImageGraphics.setColor(Color.RED); final float redVal = levelValue; int redBarHeightInPixels = (int) (redVal * meterHeight); redBarHeightInPixels = (redBarHeightInPixels > (meterHeight) ? (meterHeight) : (redBarHeightInPixels < 0 ? 0 : redBarHeightInPixels)); // Take off the green and orange redBarHeightInPixels = redBarHeightInPixels - (greenBarHeightInPixels + orangeBarHeightInPixels); final int redStartY = orangeStartY - redBarHeightInPixels; // int redEndY = orangeStartY; outBufferedImageGraphics.fillRect(3, redStartY, meterWidth - 4, redBarHeightInPixels); } } float maxLevelValue = 0.0f; final Color maxDbColor = getColorForDb(currentMaxValueDb); if (currentMaxValueDb != Float.NEGATIVE_INFINITY) { maxLevelValue = dbToLevelComputer.toNormalisedSliderLevelFromDb(currentMaxValueDb); } outBufferedImageGraphics.setColor(maxDbColor); int maxValueHeightInPixels = (int) (maxLevelValue * meterHeight); maxValueHeightInPixels = (maxValueHeightInPixels > (meterHeight) ? (meterHeight) : (maxValueHeightInPixels < 0 ? 0 : maxValueHeightInPixels)); final int yReverser = meterHeight + 1; final int maxStartY = yReverser - maxValueHeightInPixels + meterHeightOffset; outBufferedImageGraphics.drawLine(1, maxStartY, meterWidth, maxStartY); if (showClipBox) { if (currentMaxValueDb >= 1.0f) { // Should already be the right colour // g.setColor( getColorForDb( 0.0f ) ); outBufferedImageGraphics.fillRect(1, 1, meterWidth, meterWidth - 1); } } else { } } }
From source file:org.kineticsystem.commons.layout.TetrisLayout.java
/** * Create a new layout with given rows and columns. * @param rows The number of rows.//w ww. jav a 2 s.com * @param cols The number of columns. */ public TetrisLayout(int rows, int cols) { if ((rows <= 0) || (cols <= 0)) { logger.fatal("Cannot create layout: " + "need positive row and column number!"); System.exit(TetrisLayout.FATAL_ERROR); } // Setup testing colors. spanningLayoutColor = Color.ORANGE; internalLayoutColor = Color.BLUE; externalLayoutColor = Color.RED; // Setup global variables and structures. cBars = Bar.createArray(cols); rBars = Bar.createArray(rows); // Set horizontal gaps and positions. cSizes = SplittedLine.createArray(cols + 1); cGaps = Gap.createArray(cols + 1); for (int i = 0; i < cols + 1; i++) { cGaps[i].setSize(DEFAULT_GAP); } cGaps[0].setSize(0); cGaps[cols].setSize(0); // Set vertical gaps and positions. rSizes = SplittedLine.createArray(rows + 1); rGaps = Gap.createArray(rows + 1); for (int i = 0; i < rows + 1; i++) { rGaps[i].setSize(DEFAULT_GAP); } rGaps[0].setSize(0); rGaps[rows].setSize(0); constraintsMap = new HashMap<Component, Cell>(); componentSizes = new HashMap<Component, Size>(); preferredGapFreeWidth = 0; preferredGapFreeHeight = 0; // Setup default layout algorithm. strategy = new DefaultLayoutStrategy(); strategy.initialize(rBars.length, cBars.length); }
From source file:MyLink.java
public JPanel KSGenerate() { // create a simple graph for the demo graph = new SparseMultigraph<Integer, MyLink>(); Integer[] v = createVertices(getTermNum()); createEdges(v);/*from www. j a v a2 s . c om*/ vv = new VisualizationViewer<Integer, MyLink>(new KKLayout<Integer, MyLink>(graph)); //vv.setPreferredSize(new Dimension(540,500)); vv.setPreferredSize(new Dimension(610, 570)); // 570, 640 | 565, 640 | 565, 570 vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v)); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.magenta)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.magenta)); VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>( new EllipseVertexShapeTransformer<Integer>()); DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>(); vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction); vv.getRenderContext().setVertexIconTransformer(vertexIconFunction); loadImages(v, vertexIconFunction.getIconMap()); vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap()); vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<Integer>( vv.getPickedVertexState(), new Color(0, 102, 255), Color.red)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<MyLink>(vv.getPickedEdgeState(), Color.orange, Color.cyan)); vv.setBackground(Color.white); final int maxSize = findMaxSizeNumber(); File file = new File("./output/DESC_TERM_COUNT.txt"); String s; try { BufferedReader fis = new BufferedReader(new InputStreamReader(new FileInputStream(file))); s = fis.readLine(); userSelectedTermsCount = Integer.parseInt(s); termIndex = new int[userSelectedTermsCount]; int i = 0; while ((s = fis.readLine()) != null) { String[] tmp = s.split("="); termIndex[i] = Integer.parseInt(tmp[1].trim()); i++; } } catch (IOException e) { System.out.println(e.getMessage()); } Transformer<Integer, Shape> vertexSize = new Transformer<Integer, Shape>() { public Shape transform(Integer i) { double sizeInt = termIndex[i]; sizeInt = (double) sizeInt / (double) maxSize; sizeInt = (double) sizeInt * (double) 30 + 10; Ellipse2D circle = new Ellipse2D.Double(sizeInt / 2 * (-1), sizeInt / 2 * (-1), sizeInt, sizeInt); return circle; } }; vv.getRenderContext().setVertexShapeTransformer(vertexSize); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.N); // add my listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>()); // create a frome to hold the graph APanel = new JPanel(); APanel.setLayout(new BoxLayout(APanel, BoxLayout.Y_AXIS)); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JCheckBox lo = new JCheckBox("Show Labels"); lo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { showLabels = e.getStateChange() == ItemEvent.SELECTED; vv.repaint(); } }); lo.setSelected(true); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(lo); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); vv.setBorder(KSMapBorder); APanel.add(vv); APanel.add(controls); return APanel; }