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:com.aw.swing.mvp.grid.GridManager.java
private void configureGridTitleColor() { JPanel pnlGrid = ipView.getPnlGrid(gridIndex); pnlGrid.setBorder(BorderFactory.createLineBorder(new Color(131, 172, 219))); JPanel pnlTitGrid = ipView.getPnlTitGrid(gridIndex); pnlTitGrid.setBackground(new Color(131, 172, 219)); pnlTitGrid.setLayout(// w w w . j av a2s . c om new FormLayout("fill:16dlu:noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,right:pref:grow", "center:16dlu:noGrow")); JLabel lblTitGrid = ipView.getLblTitGrid(gridIndex); lblTitGrid.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); lblTitGrid.setForeground(Color.black); numRecords = new JLabel(""); numRecords.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); numRecords.setForeground(Color.black); numRecords.setVisible(showTotalRegistros); pnlTitGrid.remove(lblTitGrid); CellConstraints cc = new CellConstraints(); pnlTitGrid.add(lblTitGrid, cc.xy(3, 1)); pnlTitGrid.add(numRecords, cc.xy(5, 1)); }
From source file:com.github.andreax79.meca.Main.java
public static Stats drawRule(int ruleNumber, int size, Boundaries boundaries, UpdatePattern updatePattern, int steps, double alpha, String pattern, Output output, ColorScheme colorScheme) throws IOException { Rule rule = new Rule(ruleNumber); Row row = new Row(size, rule, boundaries, updatePattern, pattern, alpha); // e.g. 00010011011111 Stats stats = new Stats(); FileOutputStream finalImage = null; Graphics2D g = null;//from w ww .j a v a2s. co m BufferedImage img = null; if (output != Output.noOutput) { String fileName = "rule" + ruleNumber; // pattern if (pattern != null) fileName += pattern; // alpha if (alpha > 0) fileName += String.format("_a%02d", (int) (alpha * 100)); // updatePattern if (updatePattern != UpdatePattern.synchronous) fileName += "-" + updatePattern; fileName += ".jpeg"; File file = new File(fileName); finalImage = new FileOutputStream(file); int width = (int) (cellSize * (size + 1) * (output == Output.all ? 1.25 : 1)); int height = cellSize * (steps + 1); img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); g = img.createGraphics(); g.setBackground(Color.white); g.clearRect(0, 0, width, height); g.setColor(Color.black); } int startMeansFromStep = 50; List<Double> densities = new LinkedList<Double>(); double totalDensities = 0; double prevValue = 0; double prevDelta = 0; double prevOnes = 0; double prevOnesDelta = 0; for (int t = 0; t < steps; t++) { if (t >= startMeansFromStep) { double density = row.getDensity(); densities.add(density); totalDensities += density; } // System.out.println(String.format("%4d", t) + " " + row.toString() + " ones=" + row.getOnes()); if (output != Output.noOutput) { for (int j = 0; j < row.getSize(); j++) { switch (colorScheme) { case noColor: if (row.getCell(j).getState()) { g.setColor(Color.black); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); } break; case omegaColor: g.setColor(row.getCell(j).getOmegaColor()); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); break; case activationColor: if (row.getCell(j).getState()) { g.setColor(row.getCell(j).getColor()); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); } break; } } if (output == Output.all) { double value = row.getValue(); double delta = Math.abs(value - prevValue); double ones = row.getOnes(); double onesDelta = Math.abs(ones - prevOnes); if (t > 0) { g.setColor(Color.red); g.drawLine((int) (prevValue * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (value * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); g.setColor(Color.blue); g.drawLine((int) (prevOnes * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (ones * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); if (t > 1) { g.setColor(Color.orange); g.drawLine((int) (prevDelta * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (delta * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); g.setColor(Color.cyan); g.drawLine((int) (prevOnesDelta * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (onesDelta * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); } } prevValue = value; prevDelta = delta; prevOnes = ones; prevOnesDelta = onesDelta; } } row = new Row(row); } double means = totalDensities / densities.size(); double var = 0; for (double density : densities) var += Math.pow(density - means, 2); var = var / densities.size(); System.out.println("Rule: " + ruleNumber + " Boundaties: " + boundaries + " UpdatePattern: " + updatePattern + " Alpha: " + String.format("%.3f", alpha) + " Means: " + String.format("%.6f", means) + " Variance: " + String.format("%.6f", var)); stats.setMeans(means); stats.setVariance(var); if (output != Output.noOutput) { JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(finalImage); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img); param.setQuality(1.0f, true); encoder.encode(img, param); finalImage.flush(); finalImage.close(); } return stats; }
From source file:ColorSchemaGenerator.java
public static java.awt.Color decodeColor(String colorString) { java.awt.Color color = null;//from ww w .ja v a 2s . c o m char firstChar = colorString.charAt(0); if (firstChar == '#') { color = new java.awt.Color(Integer.parseInt(colorString.substring(1), 16)); } else if ('0' <= firstChar && firstChar <= '9') { color = new java.awt.Color(Integer.parseInt(colorString)); } else { color = java.awt.Color.black; } return color; }
From source file:edu.ku.brc.ui.GradiantButton.java
/** * Helper method for constructors// w ww . j ava 2 s.c om */ protected void init() { itself = this; setTextColor(Color.BLACK); setBorder(new EmptyBorder(0, 0, 0, 0)); super.setBorderPainted(false); this.addMouseListener(this); }
From source file:com.googlecode.logVisualizer.chart.VerticalXYBarChartBuilder.java
private JFreeChart createChart(final IntervalXYDataset dataset) { final JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), xLable, false, yLable, dataset, PlotOrientation.VERTICAL, isIncludeLegend(), true, false); final XYPlot plot = (XYPlot) chart.getPlot(); final NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); double lastXValue = 0; if (dataset.getSeriesCount() > 0) lastXValue = dataset.getXValue(0, dataset.getItemCount(0) - 1); plot.setDomainAxis(new FixedZoomNumberAxis(lastXValue)); plot.setNoDataMessage("No data available"); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.black); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); setBarShadowVisible(chart, false);/*from w w w . j ava2s. c om*/ plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); if (dataset.getSeriesCount() > 0) plot.getDomainAxis().setUpperBound(lastXValue); plot.getDomainAxis().setLowerBound(0); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); yAxis.setUpperMargin(0.1); return chart; }
From source file:utils.ChartUtils.java
/** * Update IR bar chart//from ww w .j av a 2 s. com * * @param labelsByFrequency Labels ordered by frequency * @param IR Imbalance Ratio values * @param cp CategoryPlot */ public static void updateIRBarChart(ImbalancedFeature[] labelsByFrequency, double[] IR, CategoryPlot cp) { DefaultCategoryDataset myData = new DefaultCategoryDataset(); double prob = 0; labelsByFrequency = MetricUtils.sortByFrequency(labelsByFrequency); double sum = 0.0; for (int i = labelsByFrequency.length - 1; i >= 0; i--) { prob = IR[i]; sum += prob; myData.setValue(prob, labelsByFrequency[i].getName(), " "); } cp.setDataset(myData); // add mean mark sum = sum / labelsByFrequency.length; Marker meanMark = new ValueMarker(sum); meanMark.setPaint(Color.red); meanMark.setLabelFont(new Font("SansSerif", Font.BOLD, 12)); meanMark.setLabel(" Mean: " + MetricUtils.truncateValue(sum, 3)); cp.addRangeMarker(meanMark); //Add Imbalance limit mark Marker limitMark = new ValueMarker(1.5); limitMark.setPaint(Color.black); limitMark.setLabelFont(new Font("SansSerif", Font.BOLD, 12)); if ((sum < 1.3) || (sum > 1.7)) { limitMark.setLabel(" Imbalance limit (IR=1.5)"); } cp.addRangeMarker(limitMark); }
From source file:org.neo4j.bench.chart.JFreeBarChart.java
@Override protected JFreeChart createChart(AbstractDataset dataset) { JFreeChart chart = ChartFactory.createBarChart("Performance chart", "Bench case", "Time(s)", (DefaultCategoryDataset) dataset, PlotOrientation.VERTICAL, true, true, false); rotateCategoryAxis(chart, Math.PI / 4.0); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setItemLabelGenerator(new CategoryItemLabelGenerator() { public String generateColumnLabel(CategoryDataset dataset, int column) { return "col" + column; }// www. ja v a 2s .c o m public String generateLabel(CategoryDataset dataset, int row, int column) { return "" + dataset.getValue(row, column).intValue(); } public String generateRowLabel(CategoryDataset dataset, int row) { return "row" + row; } }); renderer.setBaseItemLabelPaint(Color.black); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, -Math.PI / 2.0)); renderer.setItemLabelsVisible(true); return chart; }
From source file:Main.java
@Override public void paint(Graphics g, JComponent c) { super.paint(g, c); if (c instanceof JLayer == false) { return;// ww w.j a va 2 s .c om } JLayer jlayer = (JLayer) c; JTabbedPane tabPane = (JTabbedPane) jlayer.getView(); for (int i = 0; i < tabPane.getTabCount(); i++) { Rectangle rect = tabPane.getBoundsAt(i); Dimension d = button.getPreferredSize(); int x = rect.x + rect.width - d.width - 2; int y = rect.y + (rect.height - d.height) / 2; Rectangle r = new Rectangle(x, y, d.width, d.height); button.setForeground(r.contains(pt) ? Color.RED : Color.BLACK); SwingUtilities.paintComponent(g, button, p, r); } }
From source file:BorderDemo.java
public BorderDemo() { super("BorderDemo"); Border blackline, etched, 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); etched = BorderFactory.createEtchedBorder(); raisedbevel = BorderFactory.createRaisedBevelBorder(); loweredbevel = BorderFactory.createLoweredBevelBorder(); empty = BorderFactory.createEmptyBorder(); //First pane: simple borders JPanel simpleBorders = new JPanel(); simpleBorders.setBorder(paneEdge);// ww w . j a va 2 s . co m simpleBorders.setLayout(new BoxLayout(simpleBorders, BoxLayout.Y_AXIS)); addCompForBorder(blackline, "line border", simpleBorders); addCompForBorder(etched, "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)); //XXX: We *should* size the component so that the //XXX: icons tile OK. Without that, the icons are //XXX: likely to be cut off and look bad. ImageIcon icon = new ImageIcon("images/left.gif"); //20x22 Border border = BorderFactory.createMatteBorder(-1, -1, -1, -1, icon); addCompForBorder(border, "matte border (-1,-1,-1,-1,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); addCompForBorder(border, "matte border (0,20,0,0,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(etched, "title"); addCompForTitledBorder(titled, "titled 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); getContentPane().add(tabbedPane, BorderLayout.CENTER); }
From source file:parts.GraphicContent.java
public void setContent(JPanel panel) { String sprint[] = null;/*from w w w .ja v a 2s . c om*/ int taskCount[] = null; DefaultCategoryDataset dataset = new DefaultCategoryDataset(); try { Statement st = scrum.SCRUM.conexao.createStatement(); String sql = "select COUNT(*) from sprint"; result = st.executeQuery(sql); result.next(); sprint = new String[result.getInt(1)]; } catch (Exception e) { e.printStackTrace(); } try { Statement st = scrum.SCRUM.conexao.createStatement(); String sql = "select * from sprint"; result = st.executeQuery(sql); int i = 0; while (result.next()) { sprint[i] = result.getString("alias"); i++; } } catch (Exception e) { e.printStackTrace(); } int sprintIDs[] = new int[sprint.length]; try { Statement st = scrum.SCRUM.conexao.createStatement(); String sql = "select * from sprint"; result = st.executeQuery(sql); int i = 0; while (result.next()) { sprintIDs[i] = result.getInt("idsprint"); i++; } } catch (Exception e) { e.printStackTrace(); } for (int i = 0; i < sprint.length; i++) { try { Statement st = scrum.SCRUM.conexao.createStatement(); String sql = "select COUNT(*) from sprint_tasks where idsprint = " + sprintIDs[i]; result = st.executeQuery(sql); while (result.next()) { dataset.addValue(result.getInt(1), "Tarefas", sprint[i]); } } catch (Exception e) { e.printStackTrace(); } } JFreeChart chart = null; chart = ChartFactory.createBarChart("Quantidade de tarefas por Sprint", "Sprint", "Tarefas", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.black); ChartPanel cp = new ChartPanel(chart); cp.setBounds(0, 0, panel.getWidth(), panel.getHeight()); panel.removeAll(); cp.setVisible(true); panel.add(cp); panel.revalidate(); panel.repaint(); }