List of usage examples for com.lowagie.text.pdf PdfPCell setVerticalAlignment
public void setVerticalAlignment(int verticalAlignment)
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsName(Airport airport, Document document) { // FIRST ROW//from w ww.j av a 2 s . c o m // AIRPORT NAME DATE FLIGHTGEAR notifyAction("createSheetsName"); PdfPTable table = new PdfPTable(3); { com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); Paragraph p = new Paragraph(airport.getName().toUpperCase(), font); PdfPCell cell = new PdfPCell(p); cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); //cell.setColspan(3); table.addCell(cell); } { DateFormat dateFormat = new SimpleDateFormat("dd MMM yy", Locale.US); Date date = new Date(); String dateString = dateFormat.format(date).toUpperCase(); com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL); PdfPCell cell = new PdfPCell(new Paragraph(dateString, font)); cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); } { com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.COURIER, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); PdfPCell cell = new PdfPCell(new Paragraph("FLIGHTGEAR", font)); cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); } float[] widths2 = { 2f, 1f, 1f }; try { table.setWidths(widths2); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsAircraftTypes(Airport airport, Document document) { // AIRPORT NAME Aircrafts pictures notifyAction("createSheetsAircraftTypes"); PdfPTable table = new PdfPTable(2); {// ww w. jav a 2 s . c om com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.NORMAL); Paragraph p = new Paragraph(airport.getId(), font); PdfPCell cell = new PdfPCell(p); cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); } { com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.COURIER, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); PdfPCell cell = new PdfPCell(new Paragraph("FLIGHTGEAR", font)); cell.setBorderWidth(borderWidth); //cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsFreqs(Airport airport, Document document) { // FREQs Nearest Navaid notifyAction("createSheetsFreqs"); PdfPTable table = new PdfPTable(2); {//from w w w .j ava 2s .c om PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_TOP); { if (_airport.getAtises().size() > 0) { String freq = ""; for (final Atis atis : _airport.getAtises()) { freq = freq + new Double(atis.getFreq()).toString() + " "; } Paragraph p = createTinyParagraph("ATIS ", freq); cell.addElement(p); } } { String[] reqs = { "50", "51", "52", "53", "54", "55", "56" }; for (String req : reqs) { List<ATCFreq> tempFreqs = _airport.getATCFreqs(req); if (tempFreqs.size() > 0) { String freq = ""; for (final ATCFreq tower : tempFreqs) { freq = freq + tower.getFreq() + " "; } Paragraph p = createTinyParagraph(ATCFreq.typeNames.get(req) + " ", freq); cell.addElement(p); } } } //cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setBorderWidth(borderWidth); cell.setVerticalAlignment(Element.ALIGN_TOP); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); { Paragraph p = new Paragraph("Nearest Navaid:", new com.lowagie.text.Font( com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL)); cell.addElement(p); } { Paragraph p = new Paragraph(getNEarestBeaconString(airport), new com.lowagie.text.Font( com.lowagie.text.Font.TIMES_ROMAN, 10, com.lowagie.text.Font.NORMAL)); cell.addElement(p); } cell.setBorderWidth(borderWidth); //cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_TOP); table.addCell(cell); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsAddSvg(Airport airport, PdfWriter writer, Document document, String imageFileName) { // FREQs Nearest Navaid notifyAction("createSheetsAddSvg"); PdfPTable table = new PdfPTable(1); {//from ww w . ja v a2 s . c o m PdfPCell cell = new PdfPCell(); cell.setMinimumHeight(height); { Paragraph p = new Paragraph(); com.lowagie.text.Font fontWarning = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); p.add(new Chunk(" ", fontWarning)); cell.addElement(p); } cell.setBorderWidth(borderWidth); cell.setVerticalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsFakeShops(Airport airport, Document document) { // FREQs Nearest Navaid notifyAction("createSheetsFakeShops"); PdfPTable table = new PdfPTable(1); {//from w w w .j ava 2 s. c om PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setMinimumHeight(20); boolean addWorker = false; for (final Runway runway : airport.getRunways()) { if (runway.getLength() > 1200 / FEET_PER_METER) { addWorker = true; } } boolean addFork = (airport.hasTower()); Paragraph p = new Paragraph(); p.setLeading((p.leading() / 2) + 4); if (addWorker) { try { p.add(new Chunk(" ")); p.add(new Chunk(Image.getInstance(getClass().getResource(Main.imgFolder + "avail_work.png")), 0, -3)); } catch (BadElementException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } } if (addFork) { try { p.add(new Chunk(" ")); p.add(new Chunk(Image.getInstance(getClass().getResource(Main.imgFolder + "avail_fork.png")), 0, -3)); } catch (BadElementException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } } cell.addElement(p); //cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setBorderWidth(borderWidth); cell.setVerticalAlignment(Element.ALIGN_TOP); table.addCell(cell); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsLights(Airport airport, Document document) { // FREQs Nearest Navaid notifyAction("createSheetsLights"); PdfPTable table = new PdfPTable(1); {//from ww w .j av a2s . c o m PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setMinimumHeight(20); Paragraph p = new Paragraph(); p.setLeading((p.leading() / 2) + 4); com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 10, com.lowagie.text.Font.NORMAL); oneLightDone = false; try { p.add(new Chunk(" ", font)); p.add(new Chunk(Image.getInstance(getClass().getResource(Main.imgFolder + "light.png")), 0, 0)); p.add(new Chunk(" ", font)); } catch (BadElementException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } boolean addABN = airport.hasBeacon(); if (addABN) { p.add(addOneLight("ABN", font)); } boolean addALS = false; boolean addPAPI = false; for (final Runway runway : airport.getRunways()) { if ((runway.hasALSF_I(false) || runway.hasALSF_I(true)) || (runway.hasALSF_II(false) || runway.hasALSF_II(true))) { addALS = true; } if ((runway.hasPapi(false) || runway.hasPapi(true))) { addPAPI = true; } } if (addALS) { p.add(addOneLight("ALS", font)); } if (addPAPI) { p.add(addOneLight("PAPI ", font)); String separ = ""; for (final Runway runway : airport.getRunways()) { if (runway.hasPapi(false)) { p.add(new Chunk(separ + runway.getNumber() + " (3.5)" + degrees + " ", font)); separ = ", "; } if (runway.hasPapi(true)) { p.add(new Chunk(separ + runway.getOppositeNumber() + " (3.5)" + degrees + " ", font)); separ = ", "; } } } cell.addElement(p); //cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setBorderWidth(borderWidth); cell.setVerticalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsRunways(Airport airport, Document document) { notifyAction("createSheetsRunways"); PdfPTable table = new PdfPTable(6); // titles//from www .j a v a2 s .co m com.lowagie.text.Font fontTitle = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL); { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(borderWidth); cell.setBorderWidthBottom(borderWidthThin); cell.setBorderWidthRight(borderWidthThin); cell.setBorderWidthLeft(borderWidth); Paragraph p = new Paragraph("RWY N" + degrees, fontTitle); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(borderWidth); cell.setBorderWidthBottom(borderWidthThin); cell.setBorderWidthRight(borderWidthThin); cell.setBorderWidthLeft(borderWidthThin); Paragraph p = new Paragraph("Dimension (ft) - Surface", fontTitle); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(borderWidth); cell.setBorderWidthBottom(borderWidthThin); cell.setBorderWidthRight(borderWidthThin); cell.setBorderWidthLeft(borderWidthThin); Paragraph p = new Paragraph("TORA (ft)", fontTitle); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(borderWidth); cell.setBorderWidthBottom(borderWidthThin); cell.setBorderWidthRight(borderWidthThin); cell.setBorderWidthLeft(borderWidthThin); Paragraph p = new Paragraph("LDA (ft)", fontTitle); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(borderWidth); cell.setBorderWidthBottom(borderWidthThin); cell.setBorderWidthRight(borderWidthThin); cell.setBorderWidthLeft(borderWidthThin); Paragraph p = new Paragraph("Strength", fontTitle); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(borderWidth); cell.setBorderWidthBottom(borderWidthThin); cell.setBorderWidthRight(borderWidth); cell.setBorderWidthLeft(borderWidthThin); Paragraph p = new Paragraph("Lights", fontTitle); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } // data com.lowagie.text.Font fontData = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 10, com.lowagie.text.Font.NORMAL); int rc = 0; for (final Runway runway : airport.getRunways()) { { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthLeft(borderWidth); if (rc < airport.getRunways().size() - 1) { // thin bottom if not last runway cell.setBorderWidthBottom(borderWidthThin); } else { cell.setBorderWidthBottom(borderWidth); } cell.setBorderWidthRight(borderWidthThin); Paragraph p = new Paragraph(runway.getNumber() + "\r\n" + runway.getOppositeNumber(), fontData); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthLeft(borderWidthThin); if (rc < airport.getRunways().size() - 1) { // thin bottom if not last runway cell.setBorderWidthBottom(borderWidthThin); } else { cell.setBorderWidthBottom(borderWidth); } cell.setBorderWidthRight(borderWidthThin); String runwayLength = new Integer(runway.getLength()).toString() + " x " + new Integer(runway.getWidth()).toString() + " " + runway.getSurfaceName(); Paragraph p = new Paragraph(runwayLength, fontData); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthLeft(borderWidthThin); if (rc < airport.getRunways().size() - 1) { // thin bottom if not last runway cell.setBorderWidthBottom(borderWidthThin); } else { cell.setBorderWidthBottom(borderWidth); } cell.setBorderWidthRight(borderWidthThin); Paragraph p = new Paragraph(runway.getLength() + "\r\n" + runway.getLength(), fontData); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthLeft(borderWidthThin); if (rc < airport.getRunways().size() - 1) { // thin bottom if not last runway cell.setBorderWidthBottom(borderWidthThin); } else { cell.setBorderWidthBottom(borderWidth); } cell.setBorderWidthRight(borderWidthThin); Paragraph p = new Paragraph((runway.getLength() - runway.getDisplacement()) + "\r\n" + (runway.getLength() - runway.getDisplacementOpposite()), fontData); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthLeft(borderWidthThin); if (rc < airport.getRunways().size() - 1) { // thin bottom if not last runway cell.setBorderWidthBottom(borderWidthThin); } else { cell.setBorderWidthBottom(borderWidth); } cell.setBorderWidthRight(borderWidthThin); Paragraph p = new Paragraph("to do...", fontData); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthLeft(borderWidthThin); cell.setBorderWidthRight(borderWidth); if (rc < airport.getRunways().size() - 1) { // thin bottom if not last runway cell.setBorderWidthBottom(borderWidthThin); } else { cell.setBorderWidthBottom(borderWidth); } Paragraph p = new Paragraph(); p.setLeading((p.leading() / 2) + 2); p.setAlignment(Element.ALIGN_CENTER); try { if (runway.hasALSF_I(true) || runway.hasALSF_I(false) || runway.hasALSF_II(true) || runway.hasALSF_II(false) || runway.hasPapi(true) || runway.hasPapi(false) || runway.hasSALSF(true) || runway.hasSALSF(false) || runway.hasSSLP(true) || runway.hasSSLP(false) || runway.hasVasi(true) || runway.hasVasi(false)) { p.add(new Chunk(Image.getInstance(getClass().getResource(Main.imgFolder + "light.png")), 0, 0)); } else { p.add(new Chunk("--", fontData)); } } catch (BadElementException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } cell.addElement(p); table.addCell(cell); } rc++; } float[] widths2 = { 1f, 2f, 1f, 1f, 2f, 1f }; try { table.setWidths(widths2); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheetsNotes(Airport airport, Document document) { // FREQs Nearest Navaid notifyAction("createSheetsNotes"); PdfPTable table = new PdfPTable(1); {//from w w w . j a v a 2 s. c o m PdfPCell cell = new PdfPCell(); cell.setVerticalAlignment(Element.ALIGN_CENTER); { Paragraph p = new Paragraph(); com.lowagie.text.Font fontWarning = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); p.add(new Chunk("Warning !", fontWarning)); cell.addElement(p); } { Paragraph p = new Paragraph(); com.lowagie.text.Font fontText = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.NORMAL); p.add(new Chunk( "Do not use this chart in real life, this is a chart suitable to be used only for FlightGear !!!", fontText)); cell.addElement(p); } cell.setBorderWidth(borderWidth); cell.setVerticalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheets2Name(Airport airport, Document document) { // FIRST ROW/*from w w w. j a v a2 s. c om*/ // AIRPORT NAME DATE FLIGHTGEAR notifyAction("createSheets2Name"); PdfPTable table = new PdfPTable(3); { com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.COURIER, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); PdfPCell cell = new PdfPCell(new Paragraph("FLIGHTGEAR", font)); cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); //cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); } { DateFormat dateFormat = new SimpleDateFormat("dd MMM yy", Locale.US); Date date = new Date(); String dateString = dateFormat.format(date).toUpperCase(); com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL); PdfPCell cell = new PdfPCell(new Paragraph(dateString, font)); cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); } { com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); Paragraph p = new Paragraph(airport.getName().toUpperCase(), font); PdfPCell cell = new PdfPCell(p); cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); //cell.setColspan(3); table.addCell(cell); } float[] widths2 = { 1f, 1f, 2f }; try { table.setWidths(widths2); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:airportpainter.util.AirportPainter.java
License:Open Source License
private void createSheets2Freqs(Airport airport, Document document) { // FREQs Nearest Navaid notifyAction("createSheets2Freqs"); PdfPTable table = new PdfPTable(2); {/*from w ww .j av a2s . c o m*/ PdfPCell cell = new PdfPCell(); { Paragraph p = new Paragraph("Within Airspace:", new com.lowagie.text.Font( com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL)); cell.addElement(p); } cell.setBorderWidth(borderWidth); cell.setBorderWidthBottom(borderWidthThin); //cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_TOP); table.addCell(cell); } { PdfPCell cell = new PdfPCell(); com.lowagie.text.Font fontBold = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD); com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.NORMAL); { Paragraph p = new Paragraph(airport.getId(), fontBold); cell.addElement(p); } { Paragraph p = new Paragraph(); p.add(new Chunk("Elev ", font)); int feets = (int) (airport.getElevation()); p.add(new Chunk(new Integer(feets).toString() + "'", fontBold)); int meters = (int) (feets / FEET_PER_METER); p.add(new Chunk("/" + new Integer(meters).toString() + "m", font)); cell.addElement(p); } { Paragraph p = new Paragraph(); p.add(new Chunk(airport.getLatitudeString1(airport.getLat(), "N", "S", 2, false) + "\r\n" + airport.getLatitudeString1(airport.getLong(), "W", "E", 3, true), font)); cell.addElement(p); } cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); } table.setWidthPercentage(100); try { document.add(table); } catch (DocumentException ex) { Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex); } }