List of usage examples for java.awt Color blue
Color blue
To view the source code for java.awt Color blue.
Click Source Link
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();//from w w w. j a v a 2 s .c o m PdfContentByte cb = writer.getDirectContent(); BarcodeEAN codeEAN = new BarcodeEAN(); codeEAN.setCode("4512345678906"); Paragraph p = new Paragraph(); // it is composed of 3 blocks whith AI 01, 3101 and 10 Barcode128 uccEan128 = new Barcode128(); uccEan128.setCodeType(Barcode.CODE128_UCC); uccEan128.setCode("(01)00000090311314(10)ABC123(15)060916"); document.add(uccEan128.createImageWithBarcode(cb, Color.blue, Color.black)); document.add(p); document.close(); }
From source file:Main.java
public static void main(String args[]) throws BadLocationException { JFrame jf = new JFrame("StyledText"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container cp = jf.getContentPane(); JTextPane pane = new JTextPane(); SimpleAttributeSet set = new SimpleAttributeSet(); StyleConstants.setBold(set, true); // Set the attributes before adding text pane.setCharacterAttributes(set, true); pane.setText("java2s.com "); set = new SimpleAttributeSet(); StyleConstants.setItalic(set, true); StyleConstants.setForeground(set, Color.red); StyleConstants.setBackground(set, Color.blue); Document doc = pane.getStyledDocument(); doc.insertString(doc.getLength(), "Swing ", set); set = new SimpleAttributeSet(); StyleConstants.setFontSize(set, 24); doc.insertString(doc.getLength(), "Tutorial", set); JScrollPane scrollPane = new JScrollPane(pane); cp.add(scrollPane, BorderLayout.CENTER); jf.setSize(400, 300);//from w ww .j av a 2 s . com jf.setVisible(true); }
From source file:EditableColorColumn.java
public static void main(String args[]) { Color choices[] = { Color.red, Color.orange, Color.yellow, Color.green, Color.blue, Color.magenta }; ComboTableCellRenderer renderer = new ComboTableCellRenderer(); JComboBox comboBox = new JComboBox(choices); comboBox.setRenderer(renderer);//from www . ja v a 2 s.c om TableCellEditor editor = new DefaultCellEditor(comboBox); JFrame frame = new JFrame("Editable Color Table"); TableModel model = new ColorTableModel(); JTable table = new JTable(model); TableColumn column = table.getColumnModel().getColumn(3); column.setCellRenderer(renderer); column.setCellEditor(editor); JScrollPane scrollPane = new JScrollPane(table); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();/*w w w. ja v a 2 s .c om*/ PdfContentByte cb = writer.getDirectContent(); BarcodeEAN codeEAN = new BarcodeEAN(); codeEAN.setCode("4512345678906"); Paragraph p = new Paragraph(); // Data for the barcode : Barcode128 shipBarCode = new Barcode128(); shipBarCode.setX(0.75f); shipBarCode.setN(1.5f); shipBarCode.setSize(10f); shipBarCode.setTextAlignment(Element.ALIGN_CENTER); shipBarCode.setBaseline(10f); shipBarCode.setBarHeight(50f); shipBarCode.setCode("111111111111"); document.add(shipBarCode.createImageWithBarcode(cb, Color.black, Color.blue)); document.add(p); document.close(); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.setSize(300, 200);//from w ww.j a v a 2s .c om frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton redButton = new JButton("Red"); JButton greenButton = new JButton("Green"); JButton blueButton = new JButton("Blue"); class Listener extends JPanel implements ActionListener { public void actionPerformed(ActionEvent event) { Color color; if (event.getSource() == redButton) { color = Color.red; redButton.setBackground(color); panel.setBackground(color); } else if (event.getSource() == greenButton) { color = Color.green; greenButton.setBackground(color); panel.setBackground(color); } else { color = Color.blue; blueButton.setBackground(color); panel.setBackground(color); } setBackground(color); repaint(); } } redButton.addActionListener(new Listener()); greenButton.addActionListener(new Listener()); blueButton.addActionListener(new Listener()); panel.add(redButton); panel.add(greenButton); panel.add(blueButton); frame.add(panel); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();//w w w .j a v a 2 s . com PdfContentByte cb = writer.getDirectContent(); BarcodeEAN codeEAN = new BarcodeEAN(); codeEAN.setCode("4512345678906"); Paragraph p = new Paragraph(); // EANSUPP document.add(new Paragraph("ISBN 0-111-11111-1")); codeEAN.setCodeType(Barcode.EAN13); codeEAN.setCode("1111111111111"); BarcodeEAN codeSUPP = new BarcodeEAN(); codeSUPP.setCodeType(Barcode.SUPP5); codeSUPP.setCode("55499"); codeSUPP.setBaseline(-2); BarcodeEANSUPP eanSupp = new BarcodeEANSUPP(codeEAN, codeSUPP); document.add(eanSupp.createImageWithBarcode(cb, null, Color.blue)); document.add(p); document.close(); }
From source file:Main.java
public static void main(String... args) { JTextPane tPane = new JTextPane(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); appendToPane(tPane, "this is a test.\n", Color.RED, Color.WHITE); appendToPane(tPane, "this is a test \n", Color.PINK, Color.BLUE); appendToPane(tPane, "test", Color.GRAY, Color.BLACK); appendToPane(tPane, "test", Color.RED, Color.BLUE); appendToPane(tPane, "test", Color.RED, Color.YELLOW); f.getContentPane().add(tPane);//from w w w .j a v a 2s . c o m f.pack(); f.setVisible(true); }
From source file:LabelHeaderSample.java
public static void main(String args[]) { Object rows[][] = { { "one", "ichi - \u4E00" }, { "two", "ni - \u4E8C" }, { "three", "san - \u4E09" }, { "four", "shi - \u56DB" }, { "five", "go - \u4E94" }, { "six", "roku - \u516D" }, { "seven", "shichi - \u4E03" }, { "eight", "hachi - \u516B" }, { "nine", "kyu - \u4E5D" }, { "ten", "ju - \u5341" } }; JFrame frame = new JFrame("Label Header"); String headers[] = { "English", "Japanese" }; JTable table = new JTable(rows, headers); JScrollPane scrollPane = new JScrollPane(table); Icon redIcon = new DiamondIcon(Color.red); Icon blueIcon = new DiamondIcon(Color.blue); Border headerBorder = UIManager.getBorder("TableHeader.cellBorder"); JLabel blueLabel = new JLabel(headers[0], blueIcon, JLabel.CENTER); blueLabel.setBorder(headerBorder);/* ww w .j av a 2 s. c om*/ JLabel redLabel = new JLabel(headers[1], redIcon, JLabel.CENTER); redLabel.setBorder(headerBorder); TableCellRenderer renderer = new JComponentTableCellRenderer(); TableColumnModel columnModel = table.getColumnModel(); TableColumn column0 = columnModel.getColumn(0); TableColumn column1 = columnModel.getColumn(1); column0.setHeaderRenderer(renderer); column0.setHeaderValue(blueLabel); column1.setHeaderRenderer(renderer); column1.setHeaderValue(redLabel); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { if (!SystemTray.isSupported()) { return;//ww w .j av a2 s . c o m } SystemTray tray = SystemTray.getSystemTray(); PropertyChangeListener pcl; pcl = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent pce) { System.out.println("Property changed = " + pce.getPropertyName()); TrayIcon[] tia = (TrayIcon[]) pce.getOldValue(); if (tia != null) { for (int i = 0; i < tia.length; i++) System.out.println(tia[i]); } tia = (TrayIcon[]) pce.getNewValue(); if (tia != null) { for (int i = 0; i < tia.length; i++) System.out.println(tia[i]); } } }; tray.addPropertyChangeListener("trayIcons", pcl); Dimension size = tray.getTrayIconSize(); BufferedImage bi = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB); Graphics g = bi.getGraphics(); g.setColor(Color.blue); g.fillRect(0, 0, size.width, size.height); TrayIcon icon = null; tray.add(icon = new TrayIcon(bi)); Thread.sleep(3000); tray.remove(icon); Thread.sleep(3000); System.exit(0); }
From source file:Main.java
public static void main(String[] args) { JFrame fr = new JFrame(); fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JEditorPane pane = new JEditorPane(); pane.setEditorKit(new NewEditorKit()); pane.setText(/*from www . ja v a 2s.co m*/ "test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test "); StyledDocument doc = (StyledDocument) pane.getDocument(); MutableAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute("strike-color", Color.red); doc.setCharacterAttributes(0, 9, attr, false); attr.addAttribute("strike-color", Color.blue); doc.setCharacterAttributes(10, 19, attr, false); JScrollPane sp = new JScrollPane(pane); fr.getContentPane().add(sp); fr.setSize(300, 300); fr.setLocationRelativeTo(null); fr.setVisible(true); }