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:Main.java
private ListCellRenderer<? super String> getRenderer() { return new DefaultListCellRenderer() { @Override//from ww w .j a v a2 s. c om public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel listCellRendererComponent = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); listCellRendererComponent.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK)); return listCellRendererComponent; } }; }
From source file:org.jfree.chart.demo.MeterChartDemo1.java
private static JFreeChart createChart(ValueDataset valuedataset) { MeterPlot meterplot = new MeterPlot(valuedataset); meterplot.setRange(new Range(0.0D, 60D)); meterplot.addInterval(new MeterInterval("Normal", new Range(0.0D, 35D), Color.lightGray, new BasicStroke(2.0F), new Color(0, 255, 0, 64))); meterplot.addInterval(new MeterInterval("Warning", new Range(35D, 50D), Color.lightGray, new BasicStroke(2.0F), new Color(255, 255, 0, 64))); meterplot.addInterval(new MeterInterval("Critical", new Range(50D, 60D), Color.lightGray, new BasicStroke(2.0F), new Color(255, 0, 0, 128))); meterplot.setNeedlePaint(Color.darkGray); meterplot.setDialBackgroundPaint(Color.white); meterplot.setDialOutlinePaint(Color.gray); meterplot.setDialShape(DialShape.CHORD); meterplot.setMeterAngle(260);/*from www.jav a 2 s.c o m*/ meterplot.setTickLabelsVisible(true); meterplot.setTickLabelFont(new Font("Dialog", 1, 10)); meterplot.setTickLabelPaint(Color.darkGray); meterplot.setTickSize(5D); meterplot.setTickPaint(Color.lightGray); meterplot.setValuePaint(Color.black); meterplot.setValueFont(new Font("Dialog", 1, 14)); JFreeChart jfreechart = new JFreeChart("Meter Chart 1", JFreeChart.DEFAULT_TITLE_FONT, meterplot, true); return jfreechart; }
From source file:Main.java
public Main() { JPanel panel = new JPanel(); BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.PAGE_AXIS); panel.setLayout(boxLayout);//from w w w . ja va2 s . co m for (int i = 0; i < 40; i++) { panel.add(new JButton("Button " + i)); } buttons = panel.getComponents(); activeComponent = buttons[index]; final JScrollPane scroll = new JScrollPane(panel); Timer timer = new Timer(500, new ActionListener() { public void actionPerformed(ActionEvent e) { ((JButton) activeComponent).setForeground(Color.BLACK); if (index >= buttons.length - 1) { index = 0; } else { index++; } activeComponent = buttons[index]; ((JButton) activeComponent).setForeground(Color.red); setView(scroll, activeComponent); System.out.println(((JButton) activeComponent).getActionCommand()); } }); timer.start(); scroll.setPreferredSize(new Dimension(200, 300)); JFrame frame = new JFrame(); frame.add(scroll); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:FilledRectangleDemo2D.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setPaint(Color.gray);//from w ww . ja v a2 s. c o m int x = 5; int y = 7; g2.setPaint(Color.red); g2.fill(new Rectangle2D.Double(x, y, 200, 200)); g2.setPaint(Color.black); g2.drawString("Filled Rectangle2D", x, 250); }
From source file:QRCode.java
public static String createQRCode(String arg) { int size = 125; String fileType = "png"; File myFile = null;// w ww. jav a 2 s.co m UUID uuid = UUID.nameUUIDFromBytes(arg.getBytes()); try { myFile = File.createTempFile("temp-file-name", ".png"); Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>(); hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); QRCodeWriter qrCodeWriter = new QRCodeWriter(); BitMatrix byteMatrix = qrCodeWriter.encode(uuid.toString(), BarcodeFormat.QR_CODE, size, size, hintMap); int CrunchifyWidth = byteMatrix.getWidth(); BufferedImage image = new BufferedImage(CrunchifyWidth, CrunchifyWidth, BufferedImage.TYPE_INT_RGB); image.createGraphics(); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.WHITE); graphics.fillRect(0, 0, CrunchifyWidth, CrunchifyWidth); graphics.setColor(Color.BLACK); for (int i = 0; i < CrunchifyWidth; i++) { for (int j = 0; j < CrunchifyWidth; j++) { if (byteMatrix.get(i, j)) { graphics.fillRect(i, j, 1, 1); } } } ImageIO.write(image, fileType, myFile); //System.out.println("\n\nYou have successfully created QR Code " + myFile.getCanonicalPath()); return myFile.getCanonicalPath(); } catch (WriterException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:Main.java
/** Set the border of the given components to a black line border. */ public static void setLineBorder(JComponent... components) { setBorder(BorderFactory.createLineBorder(Color.BLACK), components); }
From source file:StocksTable4.java
public StocksTable4() { super("Stocks Table"); setSize(600, 300);/*from w ww .j a va 2 s. 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(true); header.addMouseListener(m_data.new ColumnListener(m_table)); header.setReorderingAllowed(true); 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:org.jfree.chart.demo.MeterChartDemo3.java
private static JFreeChart createChart(String s, ValueDataset valuedataset, DialShape dialshape) { MeterPlot meterplot = new MeterPlot(valuedataset); meterplot.setDialShape(dialshape);//from ww w . j a v a2s.com meterplot.setRange(new Range(0.0D, 60D)); meterplot.addInterval(new MeterInterval("Normal", new Range(0.0D, 35D), Color.lightGray, new BasicStroke(2.0F), new Color(0, 255, 0, 64))); meterplot.addInterval(new MeterInterval("Warning", new Range(35D, 50D), Color.lightGray, new BasicStroke(2.0F), new Color(255, 255, 0, 64))); meterplot.addInterval(new MeterInterval("Critical", new Range(50D, 60D), Color.lightGray, new BasicStroke(2.0F), new Color(255, 0, 0, 128))); meterplot.setNeedlePaint(Color.darkGray); meterplot.setDialBackgroundPaint(Color.white); meterplot.setDialOutlinePaint(Color.gray); meterplot.setMeterAngle(260); meterplot.setTickLabelsVisible(true); meterplot.setTickLabelFont(new Font("Dialog", 1, 10)); meterplot.setTickLabelPaint(Color.darkGray); meterplot.setTickSize(5D); meterplot.setTickPaint(Color.lightGray); meterplot.setValuePaint(Color.black); meterplot.setValueFont(new Font("Dialog", 1, 14)); JFreeChart jfreechart = new JFreeChart(s, JFreeChart.DEFAULT_TITLE_FONT, meterplot, true); return jfreechart; }
From source file:com.sumeet.kraiglist.pdfview.PdfReportView.java
@Override protected void buildPdfDocument(Map<String, Object> model, Document pdfdoc, PdfWriter pdfwriter, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); String name = (String) session.getAttribute("firstname"); if (name == null) { name = ""; }// ww w .j a v a2 s . c o m Font font_helvetica_12_normal_black = new Font(Font.HELVETICA, 12, Font.NORMAL, Color.BLACK); Font font_courier_16_italic_blue = new Font(Font.COURIER, 10, Font.ITALIC, Color.BLUE); Font font_courier_16_italic_red = new Font(Font.COURIER, 16, Font.ITALIC, Color.BLUE); Font font_times_16_bold_green = new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, Color.BLACK); Paragraph prg0 = new Paragraph( " Terms of Use of MyNEU KRAIGLIST", font_helvetica_12_normal_black); Paragraph prg1 = new Paragraph( "____________________________________________________________________________________________________________", font_courier_16_italic_red); Paragraph prg2 = new Paragraph(""); Chunk c1 = new Chunk("Hello " + name + ",", font_courier_16_italic_blue); Paragraph prg3 = new Paragraph("PRODUCT SALES : " + "The GSI Products listed on this Site are offered for sale solely pursuant to GSIs standard terms and conditions of sale applicable" + "to such products. The terms and conditions are accessible for viewing by clicking on the link on each product line home page." + "GSI objects to and rejects any other terms that may be proposed by any customer or potential customer. No offers to sell or purchase" + "GSI products are valid and binding on GSI unless and until specifically accepted, in writing, by GSI.", font_times_16_bold_green); //Phrase phr2 = new Phrase("Phrase 2", font_helvetica_16_normal_blue); Paragraph prg4 = new Paragraph(""); Paragraph prg5 = new Paragraph("LICENSE TO USE THIS SITE : " + "We at the GSI Group Inc. and its subsidiaries (GSI) are happy to have you as a visitor. We have established the following" + "terms and conditions, including our Privacy Statement, as a requirement for visitors using our site. In order to use our site, you" + "must agree to these terms and conditions (Terms). BY CHOOSING TO ACCESS AND USE THIS SITE, YOU ARE EXPRESSLY" + "AGREEING TO BE LEGALLY BOUND BY THESE TERMS. IF YOU DO NOT AGREE, DO NOT USE OR VIEW THE SITE." + "These Terms apply only to the use of this Site and do not supercede any other contractual agreement between you and GSI." + "Use of Materials: Upon your agreement to the Terms, GSI grants you the right to view the site and to download materials from" + "this site for your personal, non-commercial use. You are not authorized to use the materials for any other purpose. If you do" + "download or otherwise reproduce the materials from this Site, you must reproduce all of GSIs proprietary markings, such as" + "copyright and trademark notices, in the same form and manner as the original." + "Private Pages: Some parts of this Site are not available to the general public, but only to certain business associates of GSI." + "These sections may only be accessed by authorized entities and are controlled by password-protected access. If you are not" + "authorized to use these sections, then you agree that you will not attempt to gain access. If you are authorized, then by accessing" + "those areas, you expressly agree to the supplemental terms that are posted as part of the access process." + "No Harmful Use: In exchange for our permission to use this Site, you agree that you will not do anything to harm the functioning" + "or content of the Site. You will not attempt to upload, insert or change any information or image to or on this Site, except for providing" + "information where prompted by the Site. You agree that you will not take any action that imposes an unreasonably or disproportionately" + "large load on the Site or interferes with its functioning. You also agree that you will not use any false identity" + "when interacting with the Site, or do anything that is fraudulent, obscene, libelous or legally prohibited." + "You may not use any deep-link, page-scrape, robot, spider or any other automatic device, program, algorithm or methodology" + "or any similar or equivalent manual process to access, acquire, copy or monitor any portion of the Site or any of its content," + "or in any way reproduce or circumvent the navigational structure or presentation of the Site." + "INDEMNITY: YOU AGREE THAT YOU WILL DEFEND, INDEMNIFY AND HOLD HARMLESS GSI, ITS CUSTOMERS, SUPPLIERS" + "AND JOINT VENTURE PARTNERS AND THEIR RESPECTIVE EMPLOYEES, OFFICERS, DIRECTORS, CONTRACTORS," + "VENDORS, ASSIGNEES AND AGENTS FOR AND AGAINST ANY COSTS, CLAIMS, DAMAGES, LOSSES, OR" + "OTHER LIABILITIES ARISING FROM YOUR USE OF THE SITE IN BREACH OF THESE TERMS OR IN VIOLATION OF THE" + "LAW. IF GSI TAKES ANY LEGAL ACTION AGAINST YOU AS A RESULT OF YOUR VIOLATION OF THESE TERMS, YOU" + "AGREE THAT YOU WILL BE RESPONSIBLE FOR AND WILL PAY ALL OF GSIS LEGAL FEES IN CONNECTION WITH" + "SUCH ACTION. ", font_times_16_bold_green); pdfdoc.add(c1); pdfdoc.add(prg0); pdfdoc.add(prg1); pdfdoc.add(prg2); pdfdoc.add(prg3); pdfdoc.add(prg4); pdfdoc.add(prg5); }
From source file:AnotherBorderTest.java
public AnotherBorderTest() { setTitle("Border Test"); setSize(450, 450);//from w w w .java 2s . co m JPanel content = (JPanel) getContentPane(); content.setLayout(new GridLayout(6, 2, 3, 3)); JPanel p = new JPanel(); p.setBorder(new BevelBorder(BevelBorder.RAISED)); p.add(new JLabel("RAISED BevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new BevelBorder(BevelBorder.LOWERED)); p.add(new JLabel("LOWERED BevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new LineBorder(Color.black, 5)); p.add(new JLabel("Black LineBorder, thickness = 5")); content.add(p); p = new JPanel(); p.setBorder(new EmptyBorder(10, 10, 10, 10)); p.add(new JLabel("EmptyBorder with thickness of 10")); content.add(p); p = new JPanel(); p.setBorder(new EtchedBorder(EtchedBorder.RAISED)); p.add(new JLabel("RAISED EtchedBorder")); content.add(p); p = new JPanel(); p.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); p.add(new JLabel("LOWERED EtchedBorder")); content.add(p); p = new JPanel(); p.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED)); p.add(new JLabel("RAISED SoftBevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); p.add(new JLabel("LOWERED SoftBevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new MatteBorder(new ImageIcon("BALL.GIF"))); p.add(new JLabel("MatteBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new MatteBorder(new ImageIcon("java2sLogo.gif")), "Title String")); p.add(new JLabel("TitledBorder using MatteBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new LineBorder(Color.black, 5), "Title String")); p.add(new JLabel("TitledBorder using LineBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new EmptyBorder(10, 10, 10, 10), "Title String")); p.add(new JLabel("TitledBorder using EmptyBorder")); content.add(p); setVisible(true); }