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:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setPaint(Color.black); g2.draw(shape);//from w ww . j av a 2 s . com }
From source file:be.fedict.eid.applet.maven.MyEdgeTransformer.java
public Paint transform(String edgeName) { return Color.BLACK; }
From source file:Main.java
public ShadowPane() { setLayout(new BorderLayout()); setOpaque(false); setBackground(Color.BLACK); setBorder(new EmptyBorder(0, 0, 10, 10)); }
From source file:com.imaging100x.tracker.TrackerUtils.java
/** * Create a frame with a plot of the data given in XYSeries *//*from w w w. j a v a 2 s .c o m*/ public static void plotData(String title, final XYSeries data, String xTitle, String yTitle, int xLocation, int yLocation) { // JFreeChart code XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(data); JFreeChart chart = ChartFactory.createScatterPlot(title, // Title xTitle, // x-axis Label yTitle, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); final XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setSeriesPaint(0, Color.black); renderer.setSeriesFillPaint(0, Color.white); renderer.setSeriesLinesVisible(0, true); Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f); renderer.setSeriesShape(0, circle, false); renderer.setUseFillPaint(true); ChartFrame graphFrame = new ChartFrame(title, chart); graphFrame.getChartPanel().setMouseWheelEnabled(true); graphFrame.setPreferredSize(new Dimension(SIZE, SIZE)); graphFrame.setResizable(true); graphFrame.pack(); graphFrame.setLocation(xLocation, yLocation); graphFrame.setVisible(true); dataset.addChangeListener(new DatasetChangeListener() { public void datasetChanged(DatasetChangeEvent dce) { double xRange = data.getMaxX() - data.getMinX(); double yRange = data.getMaxY() - data.getMinY(); double xAvg = (data.getMaxX() + data.getMinX()) / 2; double yAvg = (data.getMaxY() + data.getMinY()) / 2; double range = xRange; if (yRange > range) { range = yRange; } double offset = 0.55 * range; plot.getDomainAxis().setRange(xAvg - offset, xAvg + offset); plot.getRangeAxis().setRange(yAvg - offset, yAvg + offset); } }); }
From source file:com.compomics.pepshell.view.statistics.JFreeChartPanel.java
private static void setupPlot(CategoryPlot categoryPlot) { categoryPlot.setBackgroundPaint(Color.white); categoryPlot.setRangeGridlinePaint(Color.black); // hide the border of the sorrounding box categoryPlot.setOutlinePaint(Color.white); // get domanin and range axes CategoryAxis domainAxis = categoryPlot.getDomainAxis(); ValueAxis rangeAxis = categoryPlot.getRangeAxis(); // set label paint for axes to black domainAxis.setLabelPaint(Color.black); rangeAxis.setLabelPaint(Color.black); // set font for labels, both on domain and range axes domainAxis.setLabelFont(new Font("Tahoma", Font.BOLD, 12)); rangeAxis.setLabelFont(new Font("Tahoma", Font.BOLD, 12)); }
From source file:Main.java
/** * Prints a <code>Document</code> using a monospaced font, word wrapping on * the characters ' ', '\t', '\n', ',', '.', and ';'. This method is * expected to be called from Printable 'print(Graphics g)' functions. * * @param g The graphics context to write to. * @param doc The <code>javax.swing.text.Document</code> to print. * @param fontSize the point size to use for the monospaced font. * @param pageIndex The page number to print. * @param pageFormat The format to print the page with. * @param tabSize The number of spaces to expand tabs to. * * @see #printDocumentMonospaced// w ww. j a v a 2 s . co m */ public static int printDocumentMonospacedWordWrap(Graphics g, Document doc, int fontSize, int pageIndex, PageFormat pageFormat, int tabSize) { g.setColor(Color.BLACK); g.setFont(new Font("Monospaced", Font.PLAIN, fontSize)); // Initialize our static variables (these are used by our tab expander below). tabSizeInSpaces = tabSize; fm = g.getFontMetrics(); // Create our tab expander. //RPrintTabExpander tabExpander = new RPrintTabExpander(); // Get width and height of characters in this monospaced font. int fontWidth = fm.charWidth('w'); // Any character will do here, since font is monospaced. int fontHeight = fm.getHeight(); int MAX_CHARS_PER_LINE = (int) pageFormat.getImageableWidth() / fontWidth; int MAX_LINES_PER_PAGE = (int) pageFormat.getImageableHeight() / fontHeight; final int STARTING_LINE_NUMBER = MAX_LINES_PER_PAGE * pageIndex; // The (x,y) coordinate to print at (in pixels, not characters). // Since y is the baseline of where we'll start printing (not the top-left // corner), we offset it by the font's ascent ( + 1 just for good measure). xOffset = (int) pageFormat.getImageableX(); int y = (int) pageFormat.getImageableY() + fm.getAscent() + 1; // A counter to keep track of the number of lines that WOULD HAVE been // printed if we were printing all lines. int numPrintedLines = 0; // Keep going while there are more lines in the document. currentDocLineNumber = 0; // The line number of the document we're currently on. rootElement = doc.getDefaultRootElement(); // To shorten accesses in our loop. numDocLines = rootElement.getElementCount(); // The number of lines in our document. while (currentDocLineNumber < numDocLines) { // Get the line we are going to print. String curLineString; Element currentLine = rootElement.getElement(currentDocLineNumber); int startOffs = currentLine.getStartOffset(); try { curLineString = doc.getText(startOffs, currentLine.getEndOffset() - startOffs); } catch (BadLocationException ble) { // Never happens ble.printStackTrace(); return Printable.NO_SUCH_PAGE; } // Remove newlines, because they end up as boxes if you don't; this is a monospaced font. curLineString = curLineString.replaceAll("\n", ""); // Replace tabs with how many spaces they should be. if (tabSizeInSpaces == 0) { curLineString = curLineString.replaceAll("\t", ""); } else { int tabIndex = curLineString.indexOf('\t'); while (tabIndex > -1) { int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces); String replacementString = ""; for (int i = 0; i < spacesNeeded; i++) replacementString += ' '; // Note that "\t" is actually a regex for this method. curLineString = curLineString.replaceFirst("\t", replacementString); tabIndex = curLineString.indexOf('\t'); } } // If this document line is too long to fit on one printed line on the page, // break it up into multpile lines. while (curLineString.length() > MAX_CHARS_PER_LINE) { int breakPoint = getLineBreakPoint(curLineString, MAX_CHARS_PER_LINE) + 1; numPrintedLines++; if (numPrintedLines > STARTING_LINE_NUMBER) { g.drawString(curLineString.substring(0, breakPoint), xOffset, y); y += fontHeight; if (numPrintedLines == STARTING_LINE_NUMBER + MAX_LINES_PER_PAGE) return Printable.PAGE_EXISTS; } curLineString = curLineString.substring(breakPoint, curLineString.length()); } currentDocLineNumber += 1; // We have printed one more line from the document. numPrintedLines++; if (numPrintedLines > STARTING_LINE_NUMBER) { g.drawString(curLineString, xOffset, y); y += fontHeight; if (numPrintedLines == STARTING_LINE_NUMBER + MAX_LINES_PER_PAGE) return Printable.PAGE_EXISTS; } } // Now, the whole document has been "printed." Decide if this page had any text on it or not. if (numPrintedLines > STARTING_LINE_NUMBER) return Printable.PAGE_EXISTS; return Printable.NO_SUCH_PAGE; }
From source file:com.t3.model.ZoneFactory.java
public static Zone createZone() { Zone zone = new Zone(); zone.setName(DEFAULT_MAP_NAME);// w w w.j a v a 2 s .co m zone.setBackgroundPaint(new DrawableTexturePaint(defaultImageId)); zone.setFogPaint(new DrawableColorPaint(Color.black)); zone.setVisible(AppPreferences.getNewMapsVisible()); zone.setHasFog(AppPreferences.getNewMapsHaveFOW()); zone.setUnitsPerCell(AppPreferences.getDefaultUnitsPerCell()); zone.setTokenVisionDistance(AppPreferences.getDefaultVisionDistance()); zone.setGrid(GridFactory.createGrid(AppPreferences.getDefaultGridType(), AppPreferences.getFaceEdge(), AppPreferences.getFaceVertex())); zone.setGridColor(AppPreferences.getDefaultGridColor().getRGB()); zone.getGrid().setSize(AppPreferences.getDefaultGridSize()); zone.getGrid().setOffset(0, 0); return zone; }
From source file:TextLayoutLeft.java
public void paint(Graphics g) { d = getSize();//from w w w.jav a 2s .c om g.setFont(f); if (fm == null) { fm = g.getFontMetrics(); ascent = fm.getAscent(); fh = ascent + fm.getDescent(); space = fm.stringWidth(" "); } g.setColor(Color.black); StringTokenizer st = new StringTokenizer( "this is a text. this is a test <BR> this is a text. this is a test"); int x = 0; int nextx; int y = 0; String word, sp; int wordCount = 0; String line = ""; while (st.hasMoreTokens()) { word = st.nextToken(); if (word.equals("<BR>")) { drawString(g, line, wordCount, fm.stringWidth(line), y + ascent); line = ""; wordCount = 0; x = 0; y = y + (fh * 2); } else { int w = fm.stringWidth(word); if ((nextx = (x + space + w)) > d.width) { drawString(g, line, wordCount, fm.stringWidth(line), y + ascent); line = ""; wordCount = 0; x = 0; y = y + fh; } if (x != 0) { sp = " "; } else { sp = ""; } line = line + sp + word; x = x + space + w; wordCount++; } } drawString(g, line, wordCount, fm.stringWidth(line), y + ascent); }
From source file:Clock.java
public Clock() { propertyChangeSupport = new PropertyChangeSupport(this); setBackground(Color.white);// w w w . j a v a 2 s . c o m setForeground(Color.black); (new Thread(this)).start(); }
From source file:TextLayoutPanel.java
public TextLayoutPanel() { setBackground(Color.white);/*w w w.j a v a 2s .c om*/ setForeground(Color.black); setSize(400, 200); addMouseListener(new MouseHandler()); addMouseMotionListener(new MouseMotionHandler()); w = getWidth(); h = getHeight(); String text = "Java Source and Support"; font = new Font("Arial", Font.PLAIN, 36); frc = new FontRenderContext(null, false, false); layout = new TextLayout(text, font, frc); rx = (float) (w / 2 - layout.getBounds().getWidth() / 2); ry = (float) 3 * h / 4; rw = (float) (layout.getBounds().getWidth()); rh = (float) (layout.getBounds().getHeight()); rect = new Rectangle2D.Float(rx, ry, rw, rh); caretColor = getForeground(); }