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 w w . ja v a 2 s. c o m AffineTransform at = AffineTransform.getTranslateInstance(75, 75); g2.transform(at); g2.setPaint(Color.red); g2.draw(shape); }
From source file:StocksTable3.java
public StocksTable3() { super("Stocks Table"); setSize(600, 300);//from w ww .ja va 2s . c o m m_data = new StockTableData(); m_title = new JLabel(m_data.getTitle(), new ImageIcon("money.gif"), SwingConstants.LEFT); m_title.setFont(new Font("TimesRoman", Font.BOLD, 24)); m_title.setForeground(Color.black); getContentPane().add(m_title, BorderLayout.NORTH); m_table = new JTable(); m_table.setAutoCreateColumnsFromModel(false); m_table.setModel(m_data); for (int k = 0; k < StockTableData.m_columns.length; k++) { DefaultTableCellRenderer renderer = new ColoredTableCellRenderer(); renderer.setHorizontalAlignment(StockTableData.m_columns[k].m_alignment); TableColumn column = new TableColumn(k, StockTableData.m_columns[k].m_width, renderer, null); m_table.addColumn(column); } JTableHeader header = m_table.getTableHeader(); header.setUpdateTableInRealTime(false); JScrollPane ps = new JScrollPane(); ps.getViewport().add(m_table); getContentPane().add(ps, BorderLayout.CENTER); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }
From source file:XORModePaintWithMouse.java
public void paint(Graphics g) { g.drawLine(0, 0, 100, 100);/*from ww w. j a v a 2 s. c om*/ g.drawLine(0, 100, 100, 0); g.setColor(Color.blue); g.drawLine(40, 25, 250, 180); g.drawLine(75, 90, 400, 400); g.setColor(Color.green); // xor cross hairs g.setXORMode(Color.black); g.drawLine(chsX - 10, chsY, chsX + 10, chsY); g.drawLine(chsX, chsY - 10, chsX, chsY + 10); g.setPaintMode(); }
From source file:common.utility.ChartHelper.java
public static JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createBarChart3D("Quantity Of Citizens Of Each Area", // chart title "(Include unactived people)", // domain axis label "Quantity", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );/*from w w w. j a v a2 s . c om*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.yellow); // Set the background colour of the chart chart.getTitle().setPaint(Color.blue); // Adjust the colour of the title CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); // Modify the plot background p.setRangeGridlinePaint(Color.red); return chart; }
From source file:Main.java
/** * Converts a given string into a color. * //from w ww. j a v a 2 s. c o m * @param value * the string, either a name or a hex-string. * @return the color. */ public static Color stringToColor(final String value) { if (value == null) { return Color.black; } try { // get color by hex or octal value return Color.decode(value); } catch (NumberFormatException nfe) { // if we can't decode lets try to get it by name try { // try to get a color by name using reflection final Field f = Color.class.getField(value); return (Color) f.get(null); } catch (Exception ce) { // if we can't get any color return black return Color.black; } } }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 1 }, 0);/*from w w w . j av a 2s .c om*/ g2.setStroke(stroke); g2.setPaint(Color.black); g2.draw(shape); }
From source file:GradientPane.java
public void paint(Graphics g) { Graphics2D g2D = (Graphics2D) g; Point2D.Float p1 = new Point2D.Float(150.f, 75.f); // Gradient line start Point2D.Float p2 = new Point2D.Float(250.f, 75.f); // Gradient line end float width = 300; float height = 50; Rectangle2D.Float rect1 = new Rectangle2D.Float(p1.x - 100, p1.y - 25, width, height); GradientPaint g2 = new GradientPaint(p1, Color.WHITE, p2, Color.DARK_GRAY, false); // Acyclic // gradient rect1.setRect(p1.x - 100, p1.y - 25, width, height); g2D.setPaint(g2); // Gradient color fill g2D.fill(rect1); // Fill the rectangle g2D.setPaint(Color.BLACK); // Outline in black g2D.draw(rect1); // Fill the rectangle g2D.draw(new Line2D.Float(p1, p2)); }
From source file:probe.com.model.util.vaadintoimageutil.HeatmapSwingComponent.java
public String generateHeatmap(String[] rows, String[] columns, String[][] data) { JPanel heatmapPanelLayout = new JPanel(); heatmapPanelLayout.setLayout(null);// ww w . java 2 s . c o m heatmapPanelLayout.setVisible(true); heatmapPanelLayout.setBorder(new LineBorder(Color.BLACK)); int width = (columns.length + 1) * 50; int height = (rows.length + 1) * 50; heatmapPanelLayout.setSize(width, height); JPanel cornerCell = initCell("#ffffff", 0, 0); int x = 50; int y = 0; heatmapPanelLayout.add(cornerCell); for (String headerCell : columns) { JPanel cell = initCell(headerCell, x, y); x += 50; heatmapPanelLayout.add(cell); } y = 50; for (String headerCell : rows) { JPanel cell = initCell(headerCell, 0, y); y += 50; heatmapPanelLayout.add(cell); } x = 50; y = 50; for (String[] row : data) { for (String color : row) { JPanel cell = initCell(color, x, y); heatmapPanelLayout.add(cell); x += 50; } x = 50; y += 50; } BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = image.createGraphics(); graphics.setPaint(Color.WHITE); heatmapPanelLayout.paint(graphics); // super.paint(graphics); byte[] imageData = null; try { ImageEncoder in = ImageEncoderFactory.newInstance(ImageFormat.PNG, new Float(0.084666f)); imageData = in.encode(image); } catch (Exception e) { System.out.println(e.getLocalizedMessage()); } String base64 = Base64.encodeBytes(imageData); base64 = "data:image/png;base64," + base64; return base64; // // JFrame frame = new JFrame(); // frame.setSize(1000, 1000); // frame.add(heatmapPanelLayout); // frame.setVisible(true); // return ""; }
From source file:ColorIcon.java
public ColorIcon(int width, int height, Color c) { iWidth = width;/*from w w w. jav a 2 s . com*/ iHeight = height; color = c; border = Color.black; insets = new Insets(1, 1, 1, 1); }
From source file:FilledArc.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int x = 5;//from w w w .j a va 2 s . c o m int y = 7; // fill Arc2D g2.setPaint(Color.red); g2.fill(new Arc2D.Double(x, y, 200, 200, 90, 135, Arc2D.OPEN)); g2.setPaint(Color.black); g2.drawString("Filled Arc2D", x, 250); }