List of usage examples for java.awt Color Color
public Color(ColorSpace cspace, float[] components, float alpha)
From source file:TableCellBorderColorPDF.java
public static void main(String[] args) { Document.compress = false;//w w w . j a v a 2s. c o m Document document = new Document(); try { PdfWriter.getInstance(document, new FileOutputStream("TableCellBorderColorPDF.pdf")); document.open(); PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(); cell.addElement(new Chunk("cell ")); cell.setBorderColor(new Color(0xFF, 0x00, 0x00)); table.addCell("a cell"); table.addCell(cell); table.addCell("a cell"); document.add(table); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:JumpLocalDestinationPDF.java
public static void main(String[] args) { Document document = new Document(); try {// www . ja v a 2 s . c o m PdfWriter.getInstance(document, new FileOutputStream("JumpLocalDestinationPDF.pdf")); document.open(); Paragraph paragraph = new Paragraph(); Anchor anchor1 = new Anchor("some text", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255))); anchor1.setName("top"); paragraph.add(anchor1); document.add(paragraph); Anchor anchor2 = new Anchor("please jump to a local destination", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255))); anchor2.setReference("#top"); document.add(anchor2); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:EndOfLineWithTextRenderModePDF.java
public static void main(String[] args) { Document document = new Document(); try {// w w w . j a v a 2s . c o m PdfWriter.getInstance(document, new FileOutputStream("EndOfLineWithTextRenderModePDF.pdf")); document.open(); Chunk chunk = new Chunk( "1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0"); chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_STROKE, 0.3f, new Color(30, 30, 30)); document.add(chunk); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:LocalGotoPDF.java
public static void main(String[] args) { Document document = new Document(); try {/* w w w . j a va2s .c om*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("LocalGotoPDF.pdf")); document.open(); Paragraph p1 = new Paragraph("If you click on ", FontFactory.getFont(FontFactory.HELVETICA, 12)); p1.add(new Chunk("this word", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255))) .setLocalGoto("test")); p1.add(" you will automatically jump to another location in this document."); Paragraph p2 = new Paragraph( "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text"); Paragraph p3 = new Paragraph("This paragraph contains a "); p3.add(new Chunk("local destination", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(255, 0, 0))) .setLocalDestination("test")); document.add(p1); document.add(p2); document.add(p3); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:FontColorByPdfContentBytePDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w. j a v a 2 s .c o m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("FontColorByPdfContentBytePDF.pdf")); document.open(); BaseFont bf = FontFactory.getFont(FontFactory.COURIER).getCalculatedBaseFont(false); PdfContentByte cb = writer.getDirectContent(); cb.beginText(); cb.setColorFill(new Color(0x00, 0xFF, 0x00)); cb.setFontAndSize(bf, 12); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "Grass is green", 250, 700, 0); cb.endText(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 11, 212, 500); frame.getContentPane().add(scrollPane); JTree tree = new JTree(addNodes(new File("."))); tree.setRootVisible(false);//w w w.j av a 2 s.c o m tree.setShowsRootHandles(true); tree.setBorder(new LineBorder(new Color(0, 0, 0))); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); scrollPane.setViewportView(tree); tree.setCellRenderer(new FileTreeCellRenderer()); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:LINE_CAP_PROJECTING_SQUARE_and_LINE_CAP_BUTT.java
public static void main(String[] args) { Document document = new Document(); try {/* w w w .j a va 2 s . c o m*/ PdfWriter.getInstance(document, new FileOutputStream("LINE_CAP_PROJECTING_SQUARE_and_LINE_CAP_BUTT.pdf")); document.open(); Chunk c = new Chunk("Multiple lines", FontFactory.getFont(FontFactory.HELVETICA, 24)); c.setUnderline(new Color(0x00, 0xFF, 0x00), 5.0f, 0.0f, 0.0f, -0.5f, PdfContentByte.LINE_CAP_PROJECTING_SQUARE); c.setUnderline(new Color(0x00, 0x00, 0xFF), 0.0f, 0.2f, 15.0f, 0.0f, PdfContentByte.LINE_CAP_BUTT); document.add(c); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:PhraseWithColorRedAndNormalFontPDF.java
public static void main(String[] args) { Document document = new Document(); try {/* ww w. ja va 2s. c o m*/ PdfWriter.getInstance(document, new FileOutputStream("PhraseWithColorRedAndNormalFontPDF.pdf")); document.open(); Phrase phrase = new Phrase("(3) this is a phrase with a red, normal font Courier, size 20.\n", FontFactory.getFont(FontFactory.COURIER, 20, Font.NORMAL, new Color(255, 0, 0))); document.add(phrase); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:ChunkFontColorPDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from w ww .jav a2s .c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ChunkFontColorPDF.pdf")); document.open(); Font red = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLD, new Color(0xFF, 0x00, 0x00)); Paragraph p; p = new Paragraph("Red is "); p.add(new Chunk("red", red)); document.add(p); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:RenderingTEXT_RENDER_MODE_FILL.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w . j a v a2 s . c o m PdfWriter.getInstance(document, new FileOutputStream("RenderingTEXT_RENDER_MODE_FILL.pdf")); document.open(); Paragraph p = new Paragraph("Text Rendering:"); document.add(p); Chunk chunk = new Chunk("rendering test"); chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL, 100f, new Color(0xFF, 0x00, 0x00)); document.add(chunk); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }