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:components.BorderDemo.java
public BorderDemo() { super(new GridLayout(1, 0)); //Keep references to the next few borders, //for use in titles and compound borders. Border blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty; //A border that puts 10 extra pixels at the sides and //bottom of each pane. Border paneEdge = BorderFactory.createEmptyBorder(0, 10, 10, 10); blackline = BorderFactory.createLineBorder(Color.black); raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); raisedbevel = BorderFactory.createRaisedBevelBorder(); loweredbevel = BorderFactory.createLoweredBevelBorder(); empty = BorderFactory.createEmptyBorder(); //First pane: simple borders JPanel simpleBorders = new JPanel(); simpleBorders.setBorder(paneEdge);// ww w .j a v a 2 s. c om simpleBorders.setLayout(new BoxLayout(simpleBorders, BoxLayout.Y_AXIS)); addCompForBorder(blackline, "line border", simpleBorders); addCompForBorder(raisedetched, "raised etched border", simpleBorders); addCompForBorder(loweredetched, "lowered etched border", simpleBorders); addCompForBorder(raisedbevel, "raised bevel border", simpleBorders); addCompForBorder(loweredbevel, "lowered bevel border", simpleBorders); addCompForBorder(empty, "empty border", simpleBorders); //Second pane: matte borders JPanel matteBorders = new JPanel(); matteBorders.setBorder(paneEdge); matteBorders.setLayout(new BoxLayout(matteBorders, BoxLayout.Y_AXIS)); ImageIcon icon = createImageIcon("images/wavy.gif", "wavy-line border icon"); //20x22 Border border = BorderFactory.createMatteBorder(-1, -1, -1, -1, icon); if (icon != null) { addCompForBorder(border, "matte border (-1,-1,-1,-1,icon)", matteBorders); } else { addCompForBorder(border, "matte border (-1,-1,-1,-1,<null-icon>)", matteBorders); } border = BorderFactory.createMatteBorder(1, 5, 1, 1, Color.red); addCompForBorder(border, "matte border (1,5,1,1,Color.red)", matteBorders); border = BorderFactory.createMatteBorder(0, 20, 0, 0, icon); if (icon != null) { addCompForBorder(border, "matte border (0,20,0,0,icon)", matteBorders); } else { addCompForBorder(border, "matte border (0,20,0,0,<null-icon>)", matteBorders); } //Third pane: titled borders JPanel titledBorders = new JPanel(); titledBorders.setBorder(paneEdge); titledBorders.setLayout(new BoxLayout(titledBorders, BoxLayout.Y_AXIS)); TitledBorder titled; titled = BorderFactory.createTitledBorder("title"); addCompForBorder(titled, "default titled border" + " (default just., default pos.)", titledBorders); titled = BorderFactory.createTitledBorder(blackline, "title"); addCompForTitledBorder(titled, "titled line border" + " (centered, default pos.)", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredetched, "title"); addCompForTitledBorder(titled, "titled lowered etched border" + " (right just., default pos.)", TitledBorder.RIGHT, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredbevel, "title"); addCompForTitledBorder(titled, "titled lowered bevel border" + " (default just., above top)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.ABOVE_TOP, titledBorders); titled = BorderFactory.createTitledBorder(empty, "title"); addCompForTitledBorder(titled, "titled empty border" + " (default just., bottom)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.BOTTOM, titledBorders); //Fourth pane: compound borders JPanel compoundBorders = new JPanel(); compoundBorders.setBorder(paneEdge); compoundBorders.setLayout(new BoxLayout(compoundBorders, BoxLayout.Y_AXIS)); Border redline = BorderFactory.createLineBorder(Color.red); Border compound; compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); addCompForBorder(compound, "compound border (two bevels)", compoundBorders); compound = BorderFactory.createCompoundBorder(redline, compound); addCompForBorder(compound, "compound border (add a red outline)", compoundBorders); titled = BorderFactory.createTitledBorder(compound, "title", TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM); addCompForBorder(titled, "titled compound border" + " (centered, below bottom)", compoundBorders); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Simple", null, simpleBorders, null); tabbedPane.addTab("Matte", null, matteBorders, null); tabbedPane.addTab("Titled", null, titledBorders, null); tabbedPane.addTab("Compound", null, compoundBorders, null); tabbedPane.setSelectedIndex(0); String toolTip = new String( "<html>Blue Wavy Line border art crew:<br> Bill Pauley<br> Cris St. Aubyn<br> Ben Wronsky<br> Nathan Walrath<br> Tommy Adams, special consultant</html>"); tabbedPane.setToolTipTextAt(1, toolTip); add(tabbedPane); }
From source file:sim.app.sugarscape.Charts.java
JFreeChart createCultureTagChart() { JFreeChart chart = ChartFactory.createXYLineChart("Culture Tag Time Series", "Time", "Fraction Blue", model.culture_tag_coll, PlotOrientation.VERTICAL, true, true, false); model.culture_tag_chart = chart;/*from w ww . j a v a 2 s . c o m*/ NumberAxis rangeAxis1 = new NumberAxis("Time"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYPlot plot = chart.getXYPlot(); ValueAxis xAxis = plot.getDomainAxis(); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.BLACK); return chart; }
From source file:painting.SwingPaintDemo3.java
public MyPanel() { setBorder(BorderFactory.createLineBorder(Color.black)); addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { moveSquare(e.getX(), e.getY()); }/*from www .j a v a 2s .c o m*/ }); addMouseMotionListener(new MouseAdapter() { public void mouseDragged(MouseEvent e) { moveSquare(e.getX(), e.getY()); } }); }
From source file:TransformersRotationTranslation.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; // Use antialiasing. g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Move the origin to 75, 75. AffineTransform at = AffineTransform.getTranslateInstance(75, 75); g2.transform(at);//from w ww . j ava2 s .co m // Draw the shapes in their original locations. g2.setPaint(Color.black); g2.draw(axes); g2.draw(shape); // Transform the Graphics2D. AffineTransform rat = new AffineTransform(); rat.setToRotation(Math.PI / 6); rat.translate(100, 100); g2.transform(rat); // Draw the "new" shapes in dashed. Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 1 }, 0); g2.setStroke(stroke); g2.draw(axes); g2.draw(shape); }
From source file:org.javarebel.chart.generator.DefaultItemLabelConfig.java
@Override public Paint[] getSeriesPaint() { return new Paint[] { Color.BLACK }; }
From source file:lu.lippmann.cdb.graph.renderer.CadralEdgeColorTransformer.java
/** * {@inheritDoc}/*w w w. ja va 2s .c o m*/ */ @Override public Color transform(final CEdge edge) { if (mapWeigth == null || !mapWeigth.containsKey(edge)) { return Color.BLACK; } else { final int pos = (int) (mapWeigth.get(edge) * (nbColors - 1)); return colors.get(pos); } }
From source file:be.fedict.eid.applet.service.impl.PdfGenerator.java
/** * Generate a Code128C barcode//from ww w . j a v a2s . c o m * * @param rrn unique Rijksregister number * @param cardNumber number of the card * @return Image containing barcode * @throws IOException * @throws BadElementException */ private Image createBarcodeImage(String rrn, String cardNumber) throws IOException, BadElementException { if (null == rrn || rrn.length() != 11 || null == cardNumber || cardNumber.length() < 9) { throw new IllegalArgumentException("Missing or invalid length for RRN or Card Number"); } String lastDigits = cardNumber.substring(cardNumber.length() - 9); String code = rrn + lastDigits; Barcode128 barcode = new Barcode128(); barcode.setCodeType(Barcode128.CODE_C); barcode.setCode(code); barcode.setFont(null); return Image.getInstance(barcode.createAwtImage(Color.BLACK, Color.WHITE), null, true); }
From source file:org.jfree.chart.demo.SurveyResultsDemo1.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart(null, null, null, categorydataset, PlotOrientation.HORIZONTAL, false, true, false); jfreechart.setBackgroundPaint(Color.white); TextTitle texttitle = new TextTitle( "Figure 7 | I. Resources - The site offers users relevant, informative and educational resources"); texttitle.setHorizontalAlignment(HorizontalAlignment.LEFT); texttitle.setBackgroundPaint(Color.red); texttitle.setPaint(Color.white); jfreechart.setTitle(texttitle);// w w w. ja va2 s .c o m CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setOutlinePaint(null); categoryplot.setDomainGridlinesVisible(true); categoryplot.setDomainGridlinePosition(CategoryAnchor.END); categoryplot.setDomainGridlineStroke(new BasicStroke(0.5F)); categoryplot.setDomainGridlinePaint(Color.black); categoryplot.setRangeGridlinesVisible(false); categoryplot.clearRangeMarkers(); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setVisible(false); categoryaxis.setCategoryMargin(0.5D); categoryplot.getRangeAxis().setVisible(false); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setSeriesPaint(0, new Color(156, 164, 74)); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelsVisible(true); barrenderer.setBaseItemLabelFont(new Font("SansSerif", 1, 10)); ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT); barrenderer.setBasePositiveItemLabelPosition(itemlabelposition); CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation("1. White papers are available.", "Category 1", 0.0D); categorytextannotation.setFont(new Font("SansSerif", 1, 12)); categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation); CategoryTextAnnotation categorytextannotation1 = new CategoryTextAnnotation( "2. White papers enhance users understanding of the firm and its expertise.", "Category 2", 0.0D); categorytextannotation1.setFont(new Font("SansSerif", 0, 12)); categorytextannotation1.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation1.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation1); CategoryTextAnnotation categorytextannotation2 = new CategoryTextAnnotation( "3. White papers are relevant to the firm's prospects and clients.", "Category 3", 0.0D); categorytextannotation2.setFont(new Font("SansSerif", 0, 12)); categorytextannotation2.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation2.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation2); CategoryTextAnnotation categorytextannotation3 = new CategoryTextAnnotation( "4. White papers are relevant to the firm's positioning.", "Category 4", 0.0D); categorytextannotation3.setFont(new Font("SansSerif", 0, 12)); categorytextannotation3.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation3.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation3); CategoryTextAnnotation categorytextannotation4 = new CategoryTextAnnotation( "5. Case studies are available.", "Category 5", 0.0D); categorytextannotation4.setFont(new Font("SansSerif", 1, 12)); categorytextannotation4.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation4.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation4); CategoryTextAnnotation categorytextannotation5 = new CategoryTextAnnotation( "6. Case studies enhance users understanding of the firm and its expertise.", "Category 6", 0.0D); categorytextannotation5.setFont(new Font("SansSerif", 0, 12)); categorytextannotation5.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation5.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation5); CategoryTextAnnotation categorytextannotation6 = new CategoryTextAnnotation( "7. Case studies are relevant to the firm's prospects and clients.", "Category 7", 0.0D); categorytextannotation6.setFont(new Font("SansSerif", 0, 12)); categorytextannotation6.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation6.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation6); CategoryTextAnnotation categorytextannotation7 = new CategoryTextAnnotation( "8. White papers are relevant to the firm's positioning.", "Category 8", 0.0D); categorytextannotation7.setFont(new Font("SansSerif", 0, 12)); categorytextannotation7.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation7.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation7); CategoryTextAnnotation categorytextannotation8 = new CategoryTextAnnotation( "9. Case studies are available.", "Category 9", 0.0D); categorytextannotation8.setFont(new Font("SansSerif", 1, 12)); categorytextannotation8.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation8.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation8); CategoryTextAnnotation categorytextannotation9 = new CategoryTextAnnotation( "10. Case studies enhance users understanding of the firm and its expertise.", "Category 10", 0.0D); categorytextannotation9.setFont(new Font("SansSerif", 0, 12)); categorytextannotation9.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation9.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation9); CategoryTextAnnotation categorytextannotation10 = new CategoryTextAnnotation( "11. Case studies are relevant to the firm's prospects and clients.", "Category 11", 0.0D); categorytextannotation10.setFont(new Font("SansSerif", 0, 12)); categorytextannotation10.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation10.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation10); CategoryTextAnnotation categorytextannotation11 = new CategoryTextAnnotation( "12. White papers are relevant to the firm's positioning.", "Category 12", 0.0D); categorytextannotation11.setFont(new Font("SansSerif", 0, 12)); categorytextannotation11.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation11.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation11); CategoryTextAnnotation categorytextannotation12 = new CategoryTextAnnotation( "13. Users can easily access resources based on viewer interest.", "Category 13", 0.0D); categorytextannotation12.setFont(new Font("SansSerif", 1, 12)); categorytextannotation12.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation12.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation12); CategoryTextAnnotation categorytextannotation13 = new CategoryTextAnnotation( "14. Access to additional hyperlinks enhances users's ability to find relevant information.", "Category 14", 0.0D); categorytextannotation13.setFont(new Font("SansSerif", 1, 12)); categorytextannotation13.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation13.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation13); CategoryTextAnnotation categorytextannotation14 = new CategoryTextAnnotation("15. OVERALL EFFECTIVENESS.", "Overall", 0.0D); categorytextannotation14.setFont(new Font("SansSerif", 1, 12)); categorytextannotation14.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation14.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation14); return jfreechart; }
From source file:BorderDemo.java
public BorderDemo() { super(new GridLayout(1, 0)); // Keep references to the next few borders, // for use in titles and compound borders. Border blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty; // A border that puts 10 extra pixels at the sides and // bottom of each pane. Border paneEdge = BorderFactory.createEmptyBorder(0, 10, 10, 10); blackline = BorderFactory.createLineBorder(Color.black); raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); raisedbevel = BorderFactory.createRaisedBevelBorder(); loweredbevel = BorderFactory.createLoweredBevelBorder(); empty = BorderFactory.createEmptyBorder(); // First pane: simple borders JPanel simpleBorders = new JPanel(); simpleBorders.setBorder(paneEdge);/*from ww w .j a v a 2 s. c o m*/ simpleBorders.setLayout(new BoxLayout(simpleBorders, BoxLayout.Y_AXIS)); addCompForBorder(blackline, "line border", simpleBorders); addCompForBorder(raisedetched, "raised etched border", simpleBorders); addCompForBorder(loweredetched, "lowered etched border", simpleBorders); addCompForBorder(raisedbevel, "raised bevel border", simpleBorders); addCompForBorder(loweredbevel, "lowered bevel border", simpleBorders); addCompForBorder(empty, "empty border", simpleBorders); // Second pane: matte borders JPanel matteBorders = new JPanel(); matteBorders.setBorder(paneEdge); matteBorders.setLayout(new BoxLayout(matteBorders, BoxLayout.Y_AXIS)); ImageIcon icon = createImageIcon("images/wavy.gif", "wavy-line border icon"); // 20x22 Border border = BorderFactory.createMatteBorder(-1, -1, -1, -1, icon); if (icon != null) { addCompForBorder(border, "matte border (-1,-1,-1,-1,icon)", matteBorders); } else { addCompForBorder(border, "matte border (-1,-1,-1,-1,<null-icon>)", matteBorders); } border = BorderFactory.createMatteBorder(1, 5, 1, 1, Color.red); addCompForBorder(border, "matte border (1,5,1,1,Color.red)", matteBorders); border = BorderFactory.createMatteBorder(0, 20, 0, 0, icon); if (icon != null) { addCompForBorder(border, "matte border (0,20,0,0,icon)", matteBorders); } else { addCompForBorder(border, "matte border (0,20,0,0,<null-icon>)", matteBorders); } // Third pane: titled borders JPanel titledBorders = new JPanel(); titledBorders.setBorder(paneEdge); titledBorders.setLayout(new BoxLayout(titledBorders, BoxLayout.Y_AXIS)); TitledBorder titled; titled = BorderFactory.createTitledBorder("title"); addCompForBorder(titled, "default titled border" + " (default just., default pos.)", titledBorders); titled = BorderFactory.createTitledBorder(blackline, "title"); addCompForTitledBorder(titled, "titled line border" + " (centered, default pos.)", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredetched, "title"); addCompForTitledBorder(titled, "titled lowered etched border" + " (right just., default pos.)", TitledBorder.RIGHT, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredbevel, "title"); addCompForTitledBorder(titled, "titled lowered bevel border" + " (default just., above top)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.ABOVE_TOP, titledBorders); titled = BorderFactory.createTitledBorder(empty, "title"); addCompForTitledBorder(titled, "titled empty border" + " (default just., bottom)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.BOTTOM, titledBorders); // Fourth pane: compound borders JPanel compoundBorders = new JPanel(); compoundBorders.setBorder(paneEdge); compoundBorders.setLayout(new BoxLayout(compoundBorders, BoxLayout.Y_AXIS)); Border redline = BorderFactory.createLineBorder(Color.red); Border compound; compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); addCompForBorder(compound, "compound border (two bevels)", compoundBorders); compound = BorderFactory.createCompoundBorder(redline, compound); addCompForBorder(compound, "compound border (add a red outline)", compoundBorders); titled = BorderFactory.createTitledBorder(compound, "title", TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM); addCompForBorder(titled, "titled compound border" + " (centered, below bottom)", compoundBorders); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Simple", null, simpleBorders, null); tabbedPane.addTab("Matte", null, matteBorders, null); tabbedPane.addTab("Titled", null, titledBorders, null); tabbedPane.addTab("Compound", null, compoundBorders, null); tabbedPane.setSelectedIndex(0); String toolTip = new String( "<html>Blue Wavy Line border art crew:<br> Bill Pauley<br> Cris St. Aubyn<br> Ben Wronsky<br> Nathan Walrath<br> Tommy Adams, special consultant</html>"); tabbedPane.setToolTipTextAt(1, toolTip); add(tabbedPane); }
From source file:test.mandelbrot.MandelbrotApp.java
public MandelbrotApp(final GridNode nodeRef) throws HeadlessException { super();//from w ww.j ava2s . c o m this.setSize(WIDTH, HEIGHT); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { shutdown = true; setTitle("Shutting Down Node... Wait"); System.out.println("Shutting Down Node... Wait"); try { if (future != null) { if (!future.isJobFinished()) { future.cancel(); } } nodeRef.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } System.exit(0); } }); 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..."); }