Example usage for java.lang Exception getMessage

List of usage examples for java.lang Exception getMessage

Introduction

In this page you can find the example usage for java.lang Exception getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:TableCellColorPDF.java

public static void main(String[] args) {
    Document document = new Document();

    try {/*from  w  ww . j av  a2  s  .com*/
        PdfWriter.getInstance(document, new FileOutputStream("TableCellColorPDF.pdf"));
        document.open();

        PdfPTable table = new PdfPTable(1);
        PdfPCell cell = new PdfPCell(new Paragraph("cell test1"));
        cell.setBorderColor(new Color(255, 0, 0));
        table.addCell(cell);

        cell = new PdfPCell(new Paragraph("cell test2"));
        table.addCell(cell);

        document.add(table);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:FormListPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A4);
    try {// w  w w  . j a v a 2  s  .c  o m
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("FormListPDF.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();
        cb.moveTo(0, 0);
        String options[] = { "A", "B", "C" };
        PdfFormField field = PdfFormField.createList(writer, options, 0);
        field.setWidget(new Rectangle(100, 700, 180, 760), PdfAnnotation.HIGHLIGHT_OUTLINE);
        field.setFieldName("AList");
        field.setValueAsString("B");
        writer.addAnnotation(field);

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:AddingMorethanOneChunkPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {// w ww.j  a v a 2  s . c  om
        PdfWriter.getInstance(document, new FileOutputStream("AddingMorethanOneChunkPDF.pdf"));
        document.open();

        Chunk test = new Chunk("some text");
        float subscript = -8.0f;
        test.setTextRise(subscript);
        test.setUnderline(new Color(0xFF, 0x00, 0x00), 3.0f, 0.0f, -5.0f + subscript, 0.0f,
                PdfContentByte.LINE_CAP_ROUND);
        document.add(test);

        Chunk test1 = new Chunk("another text");

        document.add(test1);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ListWithLongTextLineHTML.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w  w w. ja  va  2  s  .  c o m
        HtmlWriter.getInstance(document, new FileOutputStream("ListWithLongTextLineHTML.html"));
        document.open();

        List list = new List(true, 20);
        list.add(new ListItem("First line"));
        list.add(new ListItem(
                "Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text "));
        list.add(new ListItem("Third line"));

        document.add(list);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:ImagesDefaultWRAPInANewLinePDF.java

public static void main(java.lang.String[] args) {
    Document document = new Document();
    try {/*from ww  w .  j  a v a  2 s.co m*/
        PdfWriter.getInstance(document, new FileOutputStream("ImagesDefaultWRAPInANewLinePDF.pdf"));
        document.open();

        Image imageRight = Image.getInstance("logo.png");
        imageRight.setAlignment(Image.LEFT);

        for (int i = 0; i < 100; i++) {
            document.add(new Phrase("Text "));
        }
        document.add(Chunk.NEWLINE);
        document.add(imageRight);
        for (int i = 0; i < 100; i++) {
            document.add(new Phrase("Text "));
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ChunkFontColorPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   www .j  av  a 2 s  .  com*/
        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:RomanListsPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from www . j a  v a 2s  .  c o m
        PdfWriter.getInstance(document, new FileOutputStream("RomanListsPDF.pdf"));
        document.open();

        RomanList roman = new RomanList(35);
        roman.setRomanLower(true);
        roman.add(new ListItem("first item"));
        roman.add(new ListItem(
                "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "));

        document.add(roman);

    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:MainClass.java

public static void main(String[] args) {
    try {//from  w w  w .jav  a2  s .c  o  m
        String className = "org.gjt.mm.mysql.Driver";
        Class driverObject = Class.forName(className);
        System.out.println("driverObject=" + driverObject);
        System.out.println("your installation of JDBC Driver OK.");
    } catch (Exception e) {
        System.out.println("Failed: JDBC Driver Error: " + e.getMessage());
    }

}

From source file:CoordinateUpsideDownPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A4);
    try {//  www . j  a v  a2s .  c  om
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("CoordinateUpsideDownPDF.pdf"));
        document.open();

        PdfContentByte cb = writer.getDirectContent();
        cb.concatCTM(1f, 0f, 0f, -1f, 0f, PageSize.A4.height());

        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:ListWithLongTextLinePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//w w  w. j  ava2  s .  com
        PdfWriter.getInstance(document, new FileOutputStream("ListWithLongTextLinePDF.pdf"));

        document.open();

        List list = new List(true, 20);
        list.add(new ListItem("First line"));
        list.add(new ListItem(
                "Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text "));
        list.add(new ListItem("Third line"));

        document.add(list);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}