List of usage examples for java.awt Color BLACK
Color BLACK
To view the source code for java.awt Color BLACK.
Click Source Link
From source file:AntiAlias.java
/** Draw the example */ public void paint(Graphics g1) { Graphics2D g = (Graphics2D) g1; BufferedImage image = // Create an off-screen image new BufferedImage(65, 35, BufferedImage.TYPE_INT_RGB); Graphics2D ig = image.createGraphics(); // Get its Graphics for drawing // Set the background to a gradient fill. The varying color of // the background helps to demonstrate the anti-aliasing effect ig.setPaint(new GradientPaint(0, 0, Color.black, 65, 35, Color.white)); ig.fillRect(0, 0, 65, 35);/*from www. j av a2 s.c o m*/ // Set drawing attributes for the foreground. // Most importantly, turn on anti-aliasing. ig.setStroke(new BasicStroke(2.0f)); // 2-pixel lines ig.setFont(new Font("Serif", Font.BOLD, 18)); // 18-point font ig.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias! RenderingHints.VALUE_ANTIALIAS_ON); // Now draw pure blue text and a pure red oval ig.setColor(Color.blue); ig.drawString("Java", 9, 22); ig.setColor(Color.red); ig.drawOval(1, 1, 62, 32); // Finally, scale the image by a factor of 10 and display it // in the window. This will allow us to see the anti-aliased pixels g.drawImage(image, AffineTransform.getScaleInstance(10, 10), this); // Draw the image one more time at its original size, for comparison g.drawImage(image, 0, 0, this); }
From source file:grafix.graficos.eixos.EixoCandles.java
protected void completarPlot(final XYPlot plot, final JanelaGraficos janela) { OHLCDataset dataCandles = criarOHLCDataset(janela); CandlestickRenderer candRenderer = new CandlestickRenderer(); candRenderer.setUpPaint(Controle.getConfiguracoesUsuario().getCorCandlesAlta()); candRenderer.setDownPaint(Controle.getConfiguracoesUsuario().getCorCandlesBaixa()); candRenderer.setSeriesPaint(0, Color.black); candRenderer.setStroke(new BasicStroke(.75f)); candRenderer.setToolTipGenerator(new CandlesToolTipGenerator(janela)); plot.setDataset(indices.size(), dataCandles); plot.setRenderer(indices.size(), candRenderer); incluirMarcaIntraday(plot, janela);//from ww w . j a v a2 s . c o m }
From source file:com.github.fritaly.graphml4j.GroupStyle.java
public GroupStyle() { // Apply the default values here setHeight(80.0f);//from w ww . j av a2 s . co m setWidth(140.0f); setFillColor(Utils.decode("#F5F5F5")); setTransparentFill(false); setBorderColor(Color.BLACK); setBorderType(LineType.LINE); setBorderWidth(2.0f); setShape(Shape.ROUNDED_RECTANGLE); setFontFamily("Dialog"); setFontSize(15); setFontStyle(FontStyle.BOLD); setBackgroundColor(null); setLineColor(null); setTextAlignment(Alignment.CENTER); setTextColor(Color.BLACK); setVisible(true); setSizePolicy(SizePolicy.NODE_WIDTH); setBackgroundColor(Utils.decode("#99CCFF")); setPlacement(Placement.INTERNAL); setPosition(Position.TOP); setUnderlinedText(false); // This distance is necessary because the group has rounded corners setBorderDistance(1.0f); }
From source file:fr.univ_tours.li.mdjedaini.ideb.io.GraphWriter.java
/** * /*from w ww .j ava 2 s. com*/ * @param arg_g * @param arg_fileName */ public void writeGraph(Graph<EAB_Vertex, EAB_Edge> arg_g, String arg_fileName) { GraphMLWriter<EAB_Vertex, EAB_Edge> graphWriter = new GraphMLWriter<>(); // set the transformers Transformer<EAB_Vertex, String> vertexID = new Transformer<EAB_Vertex, String>() { public String transform(EAB_Vertex arg_c) { return arg_c.c.cellId.toString(); } }; Transformer<EAB_Vertex, String> vertexLabel = new Transformer<EAB_Vertex, String>() { public String transform(EAB_Vertex cell) { return cell.c.cellId.toString(); //return cell.c.getMondrianCell().getCoordinateList(); } }; Transformer<EAB_Edge, Paint> edgePaint = new Transformer<EAB_Edge, Paint>() { public Paint transform(EAB_Edge edge) { return Color.BLACK; } }; try { // this is for creating directory structure if it does not exist File file = new File(arg_fileName); file.getParentFile().mkdirs(); FileWriter writer = new FileWriter(file); graphWriter.setVertexIDs(vertexID); graphWriter.setVertexDescriptions(vertexLabel); //graphWriter.setvsetVertexIDs(vertexID); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(arg_fileName))); graphWriter.save(arg_g, out); } catch (Exception arg_e) { } }
From source file:TextureWithBufferedImage.java
public void paint(Graphics g) { Graphics2D g2D = (Graphics2D) g; Rectangle2D rec1, rec2, rec3, rec4, rec5; rec1 = new Rectangle2D.Float(25, 25, 75, 150); rec2 = new Rectangle2D.Float(125, 25, 10, 75); rec3 = new Rectangle2D.Float(75, 125, 125, 75); rec4 = new Rectangle2D.Float(25, 15, 12, 75); rec5 = new Rectangle2D.Float(15, 50, 15, 15); AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1); g2D.setComposite(ac);/*from w w w. j a v a 2 s . com*/ g2D.setStroke(new BasicStroke(5.0f)); g2D.draw(rec1); GradientPaint gp = new GradientPaint(125f, 25f, Color.yellow, 225f, 100f, Color.blue); g2D.setPaint(gp); g2D.fill(rec2); BufferedImage bi = new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB); Graphics2D big = bi.createGraphics(); big.setColor(Color.magenta); big.fillRect(0, 0, 5, 5); big.setColor(Color.black); big.drawLine(0, 0, 5, 5); Rectangle r = new Rectangle(0, 0, 5, 5); TexturePaint tp = new TexturePaint(bi, r); g2D.setPaint(tp); g2D.fill(rec3); g2D.setColor(Color.green); g2D.fill(rec4); g2D.setColor(Color.red); g2D.fill(rec5); }
From source file:dbseer.gui.chart.DBSeerXYLineAndShapeRenderer.java
@Override public Paint getItemOutlinePaint(int row, int column) { if (row == this.lastSeries && column == this.lastCategory) { return Color.BLACK; }/*from w w w . j a va 2 s. c o m*/ return super.getItemOutlinePaint(row, column); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int cx = getSize().width / 2; int cy = getSize().height / 2; g2.translate(cx, cy);/*from w w w. java 2 s .c om*/ g2.rotate(theta * Math.PI / 180); Shape oldClip = g2.getClip(); Shape e = new Ellipse2D.Float(-cx, -cy, cx * 2, cy * 2); g2.clip(e); Shape c = new Ellipse2D.Float(-cx, -cy, cx * 3 / 4, cy * 2); g2.setPaint(new GradientPaint(40, 40, Color.blue, 60, 50, Color.white, true)); g2.fill(c); g2.setPaint(Color.yellow); g2.fillOval(cx / 4, 0, cx, cy); g2.setClip(oldClip); g2.setFont(new Font("Times New Roman", Font.PLAIN, 64)); g2.setPaint(new GradientPaint(-cx, 0, Color.red, cx, 0, Color.black, false)); g2.drawString("Hello, 2D!", -cx * 3 / 4, cy / 4); AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) .75); g2.setComposite(ac); Shape r = new RoundRectangle2D.Float(0, -cy * 3 / 4, cx * 3 / 4, cy * 3 / 4, 20, 20); g2.setStroke(new BasicStroke(4)); g2.setPaint(Color.magenta); g2.fill(r); g2.setPaint(Color.green); g2.draw(r); g2.drawImage(image, -cx / 2, -cy / 2, this); }
From source file:com.tencent.wstt.apt.chart.PieChart.java
public PieChart() { super(new BorderLayout()); chart = createChart();/*from w w w . java 2 s . com*/ final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); this.add(chartPanel); }
From source file:com.ivli.roim.controls.DomainMarker.java
public DomainMarker(double aV, XYSeries aS) { super(aV);/*from w ww . j av a2 s. c om*/ iSeries = aS; iSeries.addChangeListener(this); setLabel(String.format(LABEL_FORMAT, aV)); setLabelAnchor(RectangleAnchor.CENTER); setLabelOffset(RectangleInsets.ZERO_INSETS); setAlpha(1.0f); setPaint(Color.BLACK); setStroke(new BasicStroke(1.0f)); setOutlinePaint(Color.CYAN); setOutlineStroke(new BasicStroke(.0f)); }
From source file:graficos.GenerarGraficoInventario.java
public void crear() { try {/*w w w.ja va 2 s . c o m*/ Dba db = new Dba(pathdb); db.conectar(); String sql = "select Nombre, CantidadDisponibles, CantidadEnUso from Activos"; db.prepare(sql); db.query.execute(); ResultSet rs = db.query.getResultSet(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); while (rs.next()) { int total = rs.getInt(2) + rs.getInt(3); dataset.setValue(total, "Cantidad", rs.getString(1)); } JFreeChart chart = ChartFactory.createBarChart3D("Inventario de Activos del Hotel", "Activo", "Cantidad", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); ((BarRenderer) p.getRenderer()).setBarPainter(new StandardBarPainter()); BarRenderer r = (BarRenderer) chart.getCategoryPlot().getRenderer(); r.setSeriesPaint(0, Color.BLUE); try { ChartUtilities.saveChartAsJPEG(new File(path), chart, 500, 300); } catch (Exception ee) { System.err.println(ee.toString()); System.err.println("Problem occurred creating chart."); } db.desconectar(); } catch (Exception e) { } }