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:CustomStrokes.java
/** Draw the example */ public void paint(Graphics g1) { Graphics2D g = (Graphics2D) g1; // Get a shape to work with. Here we'll use the letter B Font f = new Font("Serif", Font.BOLD, 200); GlyphVector gv = f.createGlyphVector(g.getFontRenderContext(), "B"); Shape shape = gv.getOutline(); // Set drawing attributes and starting position g.setColor(Color.black); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.translate(10, 175);/*from w w w .j av a 2s . c o m*/ // Draw the shape once with each stroke for (int i = 0; i < strokes.length; i++) { g.setStroke(strokes[i]); // set the stroke g.draw(shape); // draw the shape g.translate(140, 0); // move to the right } }
From source file:bayesGame.ui.transformers.BayesNodeProbabilityToGridTransformer.java
@Override public Icon transform(BayesNode node) { Fraction probability = node.getProbability(); double cells = probability.percentageValue(); Image grid;/*from w ww . ja v a 2s .c o m*/ Color trueColor = BayesGame.trueColor; Color falseColor = BayesGame.falseColor; boolean hiddennode = node.hasProperty("hidden"); boolean targetnode = node.hasProperty("target"); if (node.hasProperty("misguessed")) { trueColor = Color.GRAY; falseColor = Color.BLACK; } // TODO: indicate target nodes somehow if (node.cptName == null) { node.cptName = ""; } if (node.cptName.equals("DetIS")) { grid = new IsNodePainter().paintPercentage(cells, trueColor, falseColor, rows, columns, squaresize); } else if (node.cptName.equals("DetNOT")) { grid = new NotNodePainter().paintPercentage(cells, trueColor, falseColor, rows, columns, squaresize); } else if (node.cptName.equals("Prior")) { grid = PriorPainter.paintPercentage(cells, trueColor, falseColor, rows, columns, squaresize); } else if (node.cptName.equals("DetOR")) { List<Object> parentTypeList = net.getParents(node.type); Fraction parentNode1Probability = net.getProbability(parentTypeList.get(0)); Fraction parentNode2Probability = net.getProbability(parentTypeList.get(1)); grid = OrNodePainter.paintPercentage(trueColor, falseColor, (int) (rows * squaresize * 3.5), squaresize, node, parentNode1Probability, parentNode2Probability); } else if (node.cptName.equals("DetAND")) { List<Object> parentTypeList = net.getParents(node.type); Fraction parentNode1Probability = net.getProbability(parentTypeList.get(0)); Fraction parentNode2Probability = net.getProbability(parentTypeList.get(1)); grid = AndNodePainter.paintPercentage(trueColor, falseColor, (int) (rows * squaresize * 3.5), squaresize, node, parentNode1Probability, parentNode2Probability); } else if (node.cptName.equals("DetNOTAnd")) { grid = DetNOTAnd.paintPercentage(cells, trueColor, falseColor, rows, columns, squaresize, node); } else if (node.cptName.equals("Bayes")) { List<Object> parentTypeList = net.getParents(node.type); Fraction parentNodeProbability = net.getProbability(parentTypeList.get(0)); grid = BayesPainter.paintPercentage(cells, trueColor, falseColor, rows, columns, squaresize, node, parentNodeProbability); } else { grid = GridPainter.paintPercentage(cells, trueColor, falseColor, rows, columns, squaresize); } if (hiddennode) { grid = NodePainter.getBorders((BufferedImage) grid, Color.BLACK); } else if (!node.isObserved()) { grid = NodePainter.getBorders((BufferedImage) grid, Color.GRAY); } int x_size = grid.getHeight(null); double size_multiplier = 0.7; int new_x_size = (int) (x_size * size_multiplier); ImageIcon icon = new ImageIcon(grid.getScaledInstance(-1, new_x_size, Image.SCALE_SMOOTH)); // ImageIcon icon = new ImageIcon(grid); return icon; }
From source file:Highlights.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); String s = "Drag the text to highlight Java Source and Support."; Font font = new Font("Serif", Font.PLAIN, 32); if (textLayout == null) { FontRenderContext frc = g2.getFontRenderContext(); textLayout = new TextLayout(s, font, frc); }// www .j a v a 2 s .c o m // Draw the highlight. if (firstHit != null && secondHit != null) { Shape base = textLayout.getLogicalHighlightShape(firstHit.getInsertionIndex(), secondHit.getInsertionIndex()); AffineTransform at = AffineTransform.getTranslateInstance(x, y); Shape highlight = at.createTransformedShape(base); g2.setPaint(Color.white); g2.fill(highlight); } g2.setPaint(Color.black); textLayout.draw(g2, x, y); }
From source file:MenuLayoutDemo.java
public JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); menuBar.setLayout(new BoxLayout(menuBar, BoxLayout.PAGE_AXIS)); menuBar.add(createMenu("Menu 1")); menuBar.add(createMenu("Menu 2")); menuBar.add(createMenu("Menu 3")); menuBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.BLACK)); return menuBar; }
From source file:Main.java
public void clear() { graphics2D.setPaint(Color.white); graphics2D.fillRect(0, 0, getSize().width, getSize().height); graphics2D.setPaint(Color.black); repaint(); }
From source file:com.jpetrak.gate.scala.gui.ScalaEditorPanel.java
public void setCompilationOk() { jTextField1.setForeground(Color.black); }
From source file:jmbench.plots.MemoryRelativeBarPlot.java
private void plot() { CategoryPlot plot = chart.getCategoryPlot(); // plot.setDomainGridlinesVisible(true); // plot.setRangeCrosshairVisible(true); // plot.setRangeCrosshairPaint(Color.blue); plot.setRangeGridlinePaint(Color.BLACK); // set the range axis to display integers only... // NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis(); // domainAxis.setTickMarkPaint(Color.BLACK); plot.setBackgroundPaint(new Color(230, 230, 230)); // disable bar outlines... BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(true);/*from ww w.j a va2 s.co m*/ renderer.setShadowVisible(false); renderer.setBaseOutlinePaint(Color.BLACK); // renderer.setBaseOutlineStroke(new BasicStroke(2)); // CategoryAxis domainAxis = plot.getDomainAxis(); // domainAxis.setCategoryLabelPositions( // CategoryLabelPositions.createUpRotationLabelPositions( // Math.PI / 6.0)); }
From source file:FontHints.java
protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.WHITE);/*from w ww. ja v a 2 s . c o m*/ g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.setColor(Color.BLACK); g2d.drawString("Unhinted string", 10, 20); if (desktopHints != null) { g2d.addRenderingHints(desktopHints); } g2d.drawString("Desktop-hinted string", 10, 40); }
From source file:org.jax.maanova.plot.PlotUtil.java
/** * Create a simple monochrome XY renderer which can be used for scatter plots * @return the renderer/*from w ww. j a v a 2 s . co m*/ */ public static XYLineAndShapeRenderer createMonochromeScatterPlotRenderer() { XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); renderer.setAutoPopulateSeriesShape(false); renderer.setAutoPopulateSeriesOutlinePaint(false); renderer.setAutoPopulateSeriesOutlineStroke(false); renderer.setAutoPopulateSeriesPaint(false); renderer.setBaseShape(new Ellipse2D.Float(-PlotUtil.SCATTER_PLOT_DOT_SIZE_PIXELS / 2F, -PlotUtil.SCATTER_PLOT_DOT_SIZE_PIXELS / 2F, PlotUtil.SCATTER_PLOT_DOT_SIZE_PIXELS, PlotUtil.SCATTER_PLOT_DOT_SIZE_PIXELS)); renderer.setUseOutlinePaint(true); renderer.setBaseOutlinePaint(Color.BLACK); renderer.setBaseOutlineStroke(new BasicStroke(0.25F)); renderer.clearSeriesPaints(false); renderer.setBasePaint(new Color(0x55, 0x55, 0xFF)); // blue return renderer; }
From source file:test.mandelbrot.SequentialMandelbrotApp.java
public SequentialMandelbrotApp() throws HeadlessException { super();/* w w w. j a va 2s. c om*/ this.setSize(WIDTH, HEIGHT); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); // create off-screen buffer offscreen = createImage(WIDTH, HEIGHT); offg = offscreen.getGraphics(); offg.setColor(Color.black); offg.fillRect(0, 0, WIDTH, HEIGHT); repaint(); setTitle("Wait..."); }