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:org.jfree.chart.demo.StatisticalBarChartDemo1.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setRangeGridlinePaint(Color.white); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis.setAutoRangeIncludesZero(false); StatisticalBarRenderer statisticalbarrenderer = new StatisticalBarRenderer(); statisticalbarrenderer.setErrorIndicatorPaint(Color.black); statisticalbarrenderer.setIncludeBaseInRange(false); categoryplot.setRenderer(statisticalbarrenderer); statisticalbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); statisticalbarrenderer.setBaseItemLabelsVisible(true); statisticalbarrenderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER)); return jfreechart; }
From source file:edworld.pdfreader4humans.PDFReaderTest.java
@Test public void createPageImageWithStructure() throws IOException { File outputFile = new File("target/outputWithStructure.png"); ImageIO.write(reader.createPageImage(1, 3, Color.WHITE, Color.BLACK, true), "png", outputFile); assertImagesAreSimilar(getClass().getResourceAsStream("/testcase1/outputWithStructure.png"), ImageIO.read(outputFile)); }
From source file:include.picture.MyBarChart.java
/** *? *//* w w w.j a v a 2 s . com*/ public void paint() { try { check(); CategoryDataset dataset = getDataSet(series, category, data); JFreeChart chart = ChartFactory.createBarChart3D(title, axisXLabel, axisYLabel, dataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(Color.WHITE); BarRenderer3D renderer = new BarRenderer3D(); CategoryPlot plot = chart.getCategoryPlot(); renderer.setMaxBarWidth(0.01); renderer.setBaseOutlinePaint(Color.BLACK); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setItemLabelFont(new Font("", Font.PLAIN, 15)); renderer.setItemLabelsVisible(true); renderer.setItemMargin(0.1); plot.setRenderer(renderer); FileOutputStream fos_jpg = null; try { fos_jpg = new FileOutputStream(fileName); ChartUtilities.writeChartAsJPEG(fos_jpg, 1000, chart, width, height, null); } finally { try { fos_jpg.close(); } catch (Exception e) { } } } catch (Exception e) { e.printStackTrace(); } // end of try-catch }
From source file:com.igormaznitsa.sciareto.notifications.NotificationManager.java
public void showNotification(@Nullable final Image icon, @Nullable final String title, @Nonnull final Type type, @Nonnull final String message) { final JLabel label = new JLabel(String.format("<html>%s</html>", StringEscapeUtils.escapeHtml(message))); label.setForeground(Color.black); this.showNotification(icon, title, type, label); }
From source file:EditorPaneExample3.java
public EditorPaneExample3() { super("JEditorPane Example 3"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;/*from w w w. j a va 2s . c o m*/ c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridx = 1; c.gridy = 0; c.gridwidth = 1; c.weightx = 1.0; c.fill = GridBagConstraints.HORIZONTAL; textField = new JTextField(32); panel.add(textField, c); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); getContentPane().add(panel, "South"); // Change page based on text field textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String url = textField.getText(); try { // Try to display the page loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); pane.setPage(url); loadingState.setText("Loaded"); loadedType.setText(pane.getContentType()); } catch (IOException e) { JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); } } }); }
From source file:MainClass.java
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Insets insets = getBorderInsets(c); Color horizontalColor;/*from w w w . j ava 2 s. com*/ Color verticalColor; if (c.isEnabled()) { boolean pressed = false; if (c instanceof AbstractButton) { ButtonModel model = ((AbstractButton) c).getModel(); pressed = model.isPressed(); } if (pressed) { horizontalColor = Color.WHITE; verticalColor = Color.BLACK; } else { horizontalColor = Color.BLACK; verticalColor = Color.WHITE; } } else { horizontalColor = Color.LIGHT_GRAY; verticalColor = Color.LIGHT_GRAY; } g.setColor(horizontalColor); g.translate(x, y); // top g.fillRect(0, 0, width, insets.top); // bottom g.fillRect(0, height - insets.bottom, width, insets.bottom); g.setColor(verticalColor); // left g.fillRect(0, insets.top, insets.left, height - insets.top - insets.bottom); // right g.fillRect(width - insets.right, insets.top, insets.right, height - insets.top - insets.bottom); g.translate(-x, -y); }
From source file:lu.lippmann.cdb.common.gui.MultiPanel.java
/** * Constructor./*from ww w . j a v a 2 s . c o m*/ */ public MultiPanel(final ListOrderedMap<JComponent, Integer> mapPanels, final int w, final int h, final boolean withWeight) { final int total = mapPanels.keySet().size(); if (!withWeight) setLayout(new GridLayout(0, 1)); final int w2 = w - 10 * total; final int h2 = h - 75; final Map<JComponent, Color> choosedColor = new HashMap<JComponent, Color>(); int i = 0; for (final JComponent p : mapPanels.keySet()) { final Dimension size = new Dimension((int) (w2 * (mapPanels.get(p) / 100.0)), h2); p.setPreferredSize(size); choosedColor.put(p, COLORS[i]); p.setBackground(COLORS[i]); p.setBorder(BorderFactory.createLineBorder(Color.BLACK)); add(p); i++; } if (withWeight) { /** add percents **/ for (final JComponent p : mapPanels.keySet()) { final int perc = mapPanels.get(p); final int percent = (int) (w2 * (mapPanels.get(p) / 100.0)); final Dimension size = new Dimension(percent, 20); final JPanel arrow = new JPanel(); arrow.setPreferredSize(size); final JLabel label = new JLabel(perc + "%"); label.setForeground(choosedColor.get(p).darker()); arrow.add(label); add(arrow); } } }
From source file:net.sf.jasperreports.engine.xml.JRChartPlotFactory.java
/** * *//*from w ww . j ava2s .c om*/ public Object createObject(Attributes atts) { JRChartPlot plot = (JRChartPlot) digester.peek(); Color color = JRColorUtil.getColor(atts.getValue(JRXmlConstants.ATTRIBUTE_backcolor), Color.black); if (color != null) { plot.setBackcolor(color); } String orientation = atts.getValue(JRXmlConstants.ATTRIBUTE_orientation); if (orientation != null && orientation.length() > 0) plot.setOrientation((PlotOrientation) JRXmlConstants.getPlotOrientationMap().get(orientation)); String foregroundAlpha = atts.getValue(JRXmlConstants.ATTRIBUTE_foregroundAlpha); if (foregroundAlpha != null && foregroundAlpha.length() > 0) plot.setForegroundAlpha(Float.valueOf(foregroundAlpha)); String backgroundAlpha = atts.getValue(JRXmlConstants.ATTRIBUTE_backgroundAlpha); if (backgroundAlpha != null && backgroundAlpha.length() > 0) plot.setBackgroundAlpha(Float.valueOf(backgroundAlpha)); String labelRotation = atts.getValue(JRXmlConstants.ATTRIBUTE_labelRotation); if (labelRotation != null && labelRotation.length() > 0) plot.setLabelRotation(Double.valueOf(labelRotation)); return plot; }
From source file:image.writer.ImageWriterExample2.java
private BufferedImage createAnImage(String compression, int pageNum) { boolean monochrome = compression.startsWith("CCITT"); //CCITT is for 1bit b/w only BufferedImage bimg;/*from www .ja va 2 s. com*/ if (monochrome) { bimg = new BufferedImage(400, 200, BufferedImage.TYPE_BYTE_BINARY); } else { bimg = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB); } Graphics2D g2d = bimg.createGraphics(); g2d.setBackground(Color.white); g2d.clearRect(0, 0, 400, 200); g2d.setColor(Color.black); //Paint something paintSome(g2d, pageNum); return bimg; }
From source file:com.NewJFrame.java
/** * Creates new form NewJFrame/* w w w . j av a 2s . c o m*/ */ public NewJFrame() { initComponents(); textPane.setText("Hello"); Color bgColor = Color.BLACK; UIDefaults defaults = new UIDefaults(); defaults.put("TextPane[Enabled].backgroundPainter", bgColor); textPane.putClientProperty("Nimbus.Overrides", defaults); textPane.putClientProperty("Nimbus.Overrides.InheritDefaults", true); textPane.setBackground(bgColor); }