List of usage examples for java.lang System err
PrintStream err
To view the source code for java.lang System err.
Click Source Link
From source file:FontEncodingPDF.java
public static void main(String[] args) { Document document = new Document(); try {// w w w.jav a 2 s. co m PdfWriter.getInstance(document, new FileOutputStream("FontEncodingPDF.pdf")); document.open(); BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED); Font font = new Font(helvetica, 12, Font.NORMAL); Chunk chunk = new Chunk("BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED", font); document.add(chunk); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:GettingDefaultCellPDF.java
public static void main(String[] args) { Document document = new Document(); try {// www .j av a 2 s. co m PdfWriter.getInstance(document, new FileOutputStream("GettingDefaultCellPDF.pdf")); document.open(); PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(new Paragraph("header with colspan 3")); cell.setColspan(3); table.addCell(cell); table.getDefaultCell().setGrayFill(0.8f); table.addCell("1.1"); table.addCell("2.1"); table.addCell("3.1"); document.add(table); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:LayerShapeOnTextPDF.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("LayerShapeOnTextPDF.pdf")); document.open(); Paragraph p = new Paragraph(); for (int i = 0; i < 100; i++) p.add(new Chunk("Text Text Text Text Text Text Text Text ")); document.add(p); PdfContentByte cb = writer.getDirectContent(); cb.setRGBColorFill(0xFF, 0xFF, 0xFF); cb.circle(250.0f, 500.0f, 50.0f); cb.fill(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:XandYcoordinatesPdfContentByte.java
public static void main(String[] args) { Document document = new Document(); try {//w w w. j ava 2s . c om PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("XandYcoordinatesPdfContentByte.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.moveTo(216, 720); cb.lineTo(360, 360); cb.lineTo(360, 504); cb.lineTo(72, 144); cb.lineTo(144, 288); cb.stroke(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:Main.java
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice screen = ge.getDefaultScreenDevice(); if (!screen.isFullScreenSupported()) { System.out.println("Full screen mode not supported"); System.exit(1);/* ww w . ja v a 2 s .c o m*/ } try { BufferedImage loadedpic = ImageIO.read(new File("your.jpg")); screen.setFullScreenWindow(new Main(loadedpic)); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:PhraseWithColorRedAndNormalFontPDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from ww w . j av a 2 s.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:ImageTableCellPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w .j a v a2 s. c om PdfWriter.getInstance(document, new FileOutputStream("ImageTableCellPDF.pdf")); document.open(); Image image = Image.getInstance("logo.png"); PdfPTable table = new PdfPTable(2); table.addCell("cell"); table.addCell(image); table.addCell("cell"); table.addCell(new PdfPCell(image, true)); table.addCell("This three"); table.addCell(new PdfPCell(image, false)); document.add(table); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault(); String hostName = "hostName"; String fileName = "fileName"; SSLSocket sslsock = (SSLSocket) factory.createSocket(hostName, 443); SSLSession session = sslsock.getSession(); X509Certificate cert;/* w w w. j a v a 2 s. c om*/ try { cert = (X509Certificate) session.getPeerCertificates()[0]; } catch (SSLPeerUnverifiedException e) { System.err.println(session.getPeerHost() + " did not present a valid certificate."); return; } System.out.println(session.getPeerHost() + " has presented a certificate belonging to:"); Principal p = cert.getSubjectDN(); System.out.println("\t[" + p.getName() + "]"); System.out.println("The certificate bears the valid signature of:"); System.out.println("\t[" + cert.getIssuerDN().getName() + "]"); System.out.print("Do you trust this certificate (y/n)? "); System.out.flush(); BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); if (Character.toLowerCase(console.readLine().charAt(0)) != 'y') return; PrintWriter out = new PrintWriter(sslsock.getOutputStream()); out.print("GET " + fileName + " HTTP/1.0\r\n\r\n"); out.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(sslsock.getInputStream())); String line; while ((line = in.readLine()) != null) System.out.println(line); sslsock.close(); }
From source file:EncryptedPDFWithUserPasswordOwnerPassword.java
public static void main(String[] args) { Document document = new Document(); try {/*from w ww . j a v a2s . com*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("EncryptedPDFWithUserPasswordOwnerPassword.pdf")); //setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) writer.setEncryption(PdfWriter.STRENGTH128BITS, "java2s.com", "World", PdfWriter.AllowCopy | PdfWriter.AllowPrinting); document.open(); document.add(new Paragraph("Hello World")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:FloatCmp.java
public static void main(String[] argv) { double da = 3 * .3333333333; double db = 0.99999992857; // Compare two numbers that are expected to be close. if (da == db) { System.out.println("Java considers " + da + "==" + db); // else compare with our own equals method } else if (equals(da, db, 0.0000001)) { System.out.println("True within epsilon " + EPSILON); } else {/*from w w w . j a v a 2 s . com*/ System.out.println(da + " != " + db); } // Show that comparing two NaNs is not a good idea: double d1 = Double.NaN; double d2 = Double.NaN; if (d1 == d2) System.err.println("Comparing two NaNs incorrectly returns true."); if (!new Double(d1).equals(new Double(d2))) System.err.println("Double(NaN).equal(NaN) incorrectly returns false."); }