java生成pdf表格并插入图片

以下的方法只是一个模板,有些功能并没有完全覆盖。可根据自己的需求查询其他资料。

1.引入jar包或者pom依赖

	    <dependency>  
        	<groupId>com.itextpdf</groupId>  
         	<artifactId>itextpdf</artifactId>  
         	<version>5.5.10</version>  
        </dependency>
        <dependency>  
			<groupId>com.itextpdf</groupId>  
	    	<artifactId>itext-asian</artifactId>  
	    	<version>5.2.0</version>  
	    </dependency>

2.工具类 PDFCommon.java

package com.pdf.common;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.itextpdf.text.Chunk;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;

public class PDFCommon {
	// 生成空表格
	public static PdfPCell getEmptyCell() throws Exception {
		PdfPCell pdfPCell = getBodyPdfPCell_center();
		pdfPCell.setPhrase(new Paragraph("  ", getPdfBodyFont()));
		return pdfPCell;
	}

	// 设置表体的表格样式 字体居右
	public static PdfPCell getBodyPdfPCell_right() {
		PdfPCell pdfPCell = new PdfPCell();
		pdfPCell.setMinimumHeight(12);
		pdfPCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
		pdfPCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
		return pdfPCell;
	}

	// 设置表体的表格样式 字体居左
	public static PdfPCell getBodyPdfPCell_left() {
		PdfPCell pdfPCell = new PdfPCell();
		pdfPCell.setMinimumHeight(12);
		pdfPCell.setHorizontalAlignment(Element.ALIGN_LEFT);
		pdfPCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
		return pdfPCell;
	}

	public static PdfPCell getBodyPdfPCell_image() {
		PdfPCell pdfPCell = new PdfPCell();
		pdfPCell.setMinimumHeight(40);
		pdfPCell.setHorizontalAlignment(Element.ALIGN_CENTER);
		pdfPCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
		return pdfPCell;
	}

	// 设置表体的表格样式 字体居左
	public static PdfPCell getBodyPdfPCell_left_top() {
		PdfPCell pdfPCell = new PdfPCell();
		pdfPCell.setMinimumHeight(12);
		pdfPCell.setHorizontalAlignment(Element.ALIGN_LEFT);
		pdfPCell.setVerticalAlignment(Element.ALIGN_TOP);
		return pdfPCell;
	}

	// 设置表体的表格样式 字体居中
	public static PdfPCell getBodyPdfPCell_center() {
		PdfPCell pdfPCell = new PdfPCell();
		pdfPCell.setMinimumHeight(12);
		pdfPCell.setHorizontalAlignment(Element.ALIGN_CENTER);
		pdfPCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
		return pdfPCell;
	}

	// 设置表头
	public static Font getPdfTitleFont() throws Exception {
		BaseFont bfChinese = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
		Font fontChinese = new Font(bfChinese, 14F, Font.NORMAL);
		fontChinese.setStyle("bold");
		return fontChinese;
	}

	// 设置表体
	public static Font getPdfBodyFont() throws Exception {
		BaseFont bfChinese = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
		Font fontChinese = new Font(bfChinese, 10F, Font.NORMAL);
		return fontChinese;
	}

	// 设置表体-字体加粗
	public static Font getPdfBodyFont_bold() throws Exception {
		BaseFont bfChinese = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
		Font fontChinese = new Font(bfChinese, 8.5F, Font.NORMAL);
		fontChinese.setStyle("bold");
		return fontChinese;
	}

	// 设置下划线 -> 内容下方
	public static Chunk setUnderlineBlank(String content, float thickness, float yPosition) throws Exception {
		Chunk chunk = new Chunk(content, PDFCommon.getPdfBodyFont());
		chunk.setUnderline(thickness, yPosition);
		return chunk;
	}

}

3.导出的实现方法

package com.pdf;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.itextpdf.text.BadElementException;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import com.itextpdf.text.Image;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import com.pdf.common.PDFCommon;

public class ExportPDF {
	public void export(HttpServletResponse response, HttpServletRequest request) throws Exception {

		// 创建文件
		Document document = new Document();
		document.setPageSize(PageSize.A4); // 设置A4

		// 导出到浏览器
		// response.reset();
		// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
		// String pdfFileName = "导出pdf-" + PDFCommon.getYYYYMMDD(nowDate);//文件的名称
		// response.setHeader("Content-Disposition",
		// "attachment;filename=" + URLEncoder.encode(pdfFileName, "UTF-8") + ".pdf");
		// // 为了解决在IE浏览器中汉字乱码的问题
		// response.setHeader("Last-Modified", new
		// SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
		//
		// PdfWriter writer = PdfWriter.getInstance(document,
		// response.getOutputStream());
		// 导出到本地
		PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(new File("D:/导出pdf.pdf")));
		// 设置页面布局
		writer.setViewerPreferences(PdfWriter.PageLayoutOneColumn);
		// 打开文件
		document.open();

		float[] widths = { 125, 125, 125, 170, 125, 160, 125 };// 有几个表格
		PdfPTable table = new PdfPTable(widths);
		table.setWidthPercentage(95); // 设置表格占A4纸的95%

		// 设置表头
		PdfPCell total_1 = new PdfPCell();
		total_1.setRowspan(1);
		total_1.setColspan(10);
		total_1.setHorizontalAlignment(Element.ALIGN_CENTER);
		total_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
		total_1.disableBorderSide(13);//消除周围的表格线
		// total_1.setBackgroundColor(BaseColor.YELLOW);
		Paragraph paragraph = new Paragraph("导出pdf的表格 \r\n", PDFCommon.getPdfTitleFont());
		total_1.setPhrase(paragraph);
		table.addCell(total_1);

		// 第1行
		PdfPCell total_1_1 = PDFCommon.getBodyPdfPCell_center();
		total_1_1.setRowspan(1);
		total_1_1.setColspan(1);
		total_1_1.setPhrase(new Paragraph("人员姓名", PDFCommon.getPdfBodyFont()));
		table.addCell(total_1_1);

		PdfPCell total_1_2 = PDFCommon.getBodyPdfPCell_center();
		total_1_2.setRowspan(1);
		total_1_2.setColspan(1);
		total_1_2.setPhrase(new Paragraph("张三", PDFCommon.getPdfBodyFont()));
		table.addCell(total_1_2);

		PdfPCell total_1_3 = PDFCommon.getBodyPdfPCell_center();
		total_1_3.setRowspan(1);
		total_1_3.setColspan(1);
		total_1_3.setPhrase(new Paragraph("身份证号码", PDFCommon.getPdfBodyFont()));
		table.addCell(total_1_3);

		PdfPCell total_1_4 = PDFCommon.getBodyPdfPCell_center();
		total_1_4.setRowspan(1);
		total_1_4.setColspan(1);
		total_1_4.setPhrase(new Paragraph("100002100110121211", PDFCommon.getPdfBodyFont()));
		table.addCell(total_1_4);

		PdfPCell total_1_5 = PDFCommon.getBodyPdfPCell_center();
		total_1_5.setRowspan(1);
		total_1_5.setColspan(1);
		total_1_5.setPhrase(new Paragraph("户籍地址", PDFCommon.getPdfBodyFont()));
		table.addCell(total_1_5);

		PdfPCell total_1_67 = PDFCommon.getBodyPdfPCell_center();
		total_1_67.setRowspan(1);
		total_1_67.setColspan(2);
		total_1_67.setPhrase(new Paragraph("北京市金融街", PDFCommon.getPdfBodyFont()));
		table.addCell(total_1_67);

		for (int q = 0; q < 8; q++) {// 画8个大表格

			PdfPCell total_Q = PDFCommon.getBodyPdfPCell_center();
			total_Q.setRowspan(3);// 每一个大表格里有三个小表格
			total_Q.setColspan(2);
			total_Q.setPhrase(new Paragraph("大表格" + (q + 1), PDFCommon.getPdfBodyFont()));
			table.addCell(total_Q);

			for (int c = 0; c < 3; c++) {
				PdfPCell total_Q_d = PDFCommon.getBodyPdfPCell_left();
				total_Q_d.setRowspan(1);
				total_Q_d.setColspan(4);
				total_Q_d.setPhrase(new Paragraph("小表格" + (c + 1), PDFCommon.getPdfBodyFont()));
				table.addCell(total_Q_d);
				if (c == 0) {//第一列进行合并
					PdfPCell total_Q_score = PDFCommon.getBodyPdfPCell_center();
					total_Q_score.setRowspan(3);
					total_Q_score.setColspan(1);
					Chunk sigUnderline = new Chunk("  " + 5 + "  ");
					sigUnderline.setUnderline(0.1f, -2f);// 设置下划线
					Paragraph pp = new Paragraph("", PDFCommon.getPdfBodyFont());
					pp.add(sigUnderline);
					pp.add("分");
					total_Q_score.setPhrase(pp);
					table.addCell(total_Q_score);
				}
			}
		}
		// 总分
		PdfPCell total_ht = PDFCommon.getBodyPdfPCell_center();
		total_ht.setRowspan(1);
		total_ht.setColspan(6);
		total_ht.setPhrase(new Paragraph("合计", PDFCommon.getPdfBodyFont()));
		total_ht.setMinimumHeight(16F);
		table.addCell(total_ht);

		PdfPCell total_h = PDFCommon.getBodyPdfPCell_center();
		total_h.setRowspan(1);
		total_h.setColspan(1);
		Chunk sigUnderline = new Chunk("  " + 100 + "  ");
		sigUnderline.setUnderline(0.1f, -2f);// 设置下划线
		Paragraph pp = new Paragraph("", PDFCommon.getPdfBodyFont());
		pp.add(sigUnderline);
		pp.add("分");
		total_h.setPhrase(pp);
		table.addCell(total_h);

		// 大专家意见
		PdfPCell total_kb = PDFCommon.getBodyPdfPCell_center();
		total_kb.setRowspan(1);
		total_kb.setColspan(7);
		total_kb.disableBorderSide(2);
		total_kb.setPhrase(new Paragraph(" ", PDFCommon.getPdfBodyFont()));
		table.addCell(total_kb);

		PdfPCell total_zj = PDFCommon.getBodyPdfPCell_left_top();
		total_zj.setRowspan(3);
		total_zj.setColspan(2);
		total_zj.disableBorderSide(9);
		total_zj.setPhrase(new Paragraph(" 大专家:", PDFCommon.getPdfBodyFont()));
		table.addCell(total_zj);

		PdfPCell total_zj_1 = PDFCommon.getBodyPdfPCell_left();
		total_zj_1.setRowspan(1);
		total_zj_1.setColspan(5);
		total_zj_1.disableBorderSide(7);
		total_zj_1.setPhrase(new Paragraph("  ", PDFCommon.getPdfBodyFont()));
		table.addCell(total_zj_1);
		// 专家签字图片
		Image zjImage = loadingPicture();
		PdfPCell imCell = PDFCommon.getBodyPdfPCell_image();
		imCell.setPhrase(new Paragraph(new Chunk(zjImage, 0, 0)));
		imCell.setHorizontalAlignment(Element.ALIGN_LEFT);
		imCell.setRowspan(1);
		imCell.setColspan(5);
		imCell.disableBorderSide(7);
		table.addCell(imCell);

		// 专家评估日期
		PdfPCell total_zjdate = PDFCommon.getBodyPdfPCell_right();
		total_zjdate.setRowspan(1);
		total_zjdate.setColspan(5);
		total_zjdate.disableBorderSide(5);
		total_zjdate.setPhrase(
				new Paragraph("第一个时间:   " + PDFCommon.getYYYYMMDD_f(new Date()), PDFCommon.getPdfBodyFont()));
		table.addCell(total_zjdate);

		// 集体评审
		PdfPCell total_jtyj_1 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_1.setRowspan(1);
		total_jtyj_1.setColspan(7);
		total_jtyj_1.disableBorderSide(2);
		total_jtyj_1.setPhrase(new Paragraph("小专家意见:   ", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_1);

		PdfPCell total_jtyj_2 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_2.setRowspan(1);
		total_jtyj_2.setColspan(7);
		total_jtyj_2.disableBorderSide(3);
		;
		total_jtyj_2.setPhrase(new Paragraph(" ", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_2);

		PdfPCell total_jtyj_3_1 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_3_1.setRowspan(1);
		total_jtyj_3_1.setColspan(2);
		total_jtyj_3_1.disableBorderSide(11);
		total_jtyj_3_1.setPhrase(new Paragraph(" ", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_3_1);

		PdfPCell total_jtyj_3_2 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_3_2.setRowspan(1);
		total_jtyj_3_2.setColspan(2);
		total_jtyj_3_2.disableBorderSide(15);
		total_jtyj_3_2.setPhrase(new Paragraph("通过  [ √ ]", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_3_2);

		PdfPCell total_jtyj_3_3 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_3_3.setRowspan(1);
		total_jtyj_3_3.setColspan(3);
		total_jtyj_3_3.disableBorderSide(7);
		total_jtyj_3_3.setPhrase(new Paragraph("不通过  [  ]", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_3_3);

		// 补充意见 头
		PdfPCell total_jtyj_4_1 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_4_1.setRowspan(1);
		total_jtyj_4_1.setColspan(7);
		total_jtyj_4_1.disableBorderSide(3);
		total_jtyj_4_1.setPhrase(new Paragraph("补充意见:", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_4_1);
		// 补充意见 体
		PdfPCell total_jtyj_5_1 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_5_1.setRowspan(1);
		total_jtyj_5_1.setColspan(7);
		total_jtyj_5_1.disableBorderSide(3);
		total_jtyj_5_1.setPhrase(
				new Paragraph(new Paragraph("             专家的意见是通过! \r\n \r\n ", PDFCommon.getPdfBodyFont())));
		table.addCell(total_jtyj_5_1);

		// 专家
		PdfPCell total_jtyj_6_1 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_6_1.setRowspan(1);
		total_jtyj_6_1.setColspan(2);
		total_jtyj_6_1.disableBorderSide(11);
		total_jtyj_6_1.setPhrase(new Paragraph("专家1: ", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_6_1);

		// 专家
		PdfPCell total_jtyj_6_2 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_6_2.setRowspan(1);
		total_jtyj_6_2.setColspan(2);
		total_jtyj_6_2.disableBorderSide(15);
		total_jtyj_6_2.setPhrase(new Paragraph("    专家2:", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_6_2);

		// 专家
		PdfPCell total_jtyj_6_3 = PDFCommon.getBodyPdfPCell_left();
		total_jtyj_6_3.setRowspan(1);
		total_jtyj_6_3.setColspan(3);
		total_jtyj_6_3.disableBorderSide(7);
		total_jtyj_6_3.setPhrase(new Paragraph("专家3:", PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtyj_6_3);

		// 图片1
		Image image_1 = loadingPicture();
		PdfPCell imCell_1 = PDFCommon.getBodyPdfPCell_image();
		imCell_1.setRowspan(1);
		imCell_1.setColspan(2);
		imCell_1.setPhrase(new Paragraph(new Chunk(image_1, 0, 0)));
		imCell_1.disableBorderSide(11);
		table.addCell(imCell_1);
		// 图片2
		Image image_2 = loadingPicture();
		PdfPCell imCell_2 = PDFCommon.getBodyPdfPCell_image();
		imCell_2.setRowspan(1);
		imCell_2.setColspan(2);
		imCell_2.setPhrase(new Paragraph(new Chunk(image_2, 0, 0)));
		imCell_2.disableBorderSide(15);
		table.addCell(imCell_2);
		// 图片3
		Image image_3 = loadingPicture();
		PdfPCell imCell_3 = PDFCommon.getBodyPdfPCell_image();
		imCell_3.setRowspan(1);
		imCell_3.setColspan(3);
		imCell_3.setPhrase(new Paragraph(new Chunk(image_3, 0, 0)));
		imCell_3.disableBorderSide(7);
		table.addCell(imCell_3);

		// 专家评估日期
		PdfPCell total_jtdate = PDFCommon.getBodyPdfPCell_right();
		total_jtdate.setRowspan(1);
		total_jtdate.setColspan(7);
		total_jtdate.disableBorderSide(1);
		total_jtdate
				.setPhrase(new Paragraph("第二个时间:   " + PDFCommon.getYYYYMMDD_f(new Date()), PDFCommon.getPdfBodyFont()));
		table.addCell(total_jtdate);

		document.add(table);
		document.close();
	}

	// 查询图片组装image
	private Image loadingPicture() throws BadElementException, MalformedURLException, IOException {
		File file = new File("E:/aa.png");
		byte[] by = File2byte(file);
		Image image = Image.getInstance(by);
		image.scaleAbsolute(60, 20);// 调整图片大小(宽度 高度)
		return image;
	}

	private byte[] File2byte(File tradeFile) {
		byte[] buffer = null;
		try {
			FileInputStream fis = new FileInputStream(tradeFile);
			ByteArrayOutputStream bos = new ByteArrayOutputStream();
			byte[] b = new byte[1024];
			int n;
			while ((n = fis.read(b)) != -1) {
				bos.write(b, 0, n);
			}
			fis.close();
			bos.close();
			buffer = bos.toByteArray();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return buffer;
	}


}

4.测试方法

	public static void main(String[] args) {
		ExportPDF exportPDF = new ExportPDF();
		try {
			exportPDF.export(null, null);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

5.导出的效果

 

  • 5
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
<br/>CuteEditor功能特点 <br/>是什么使CuteEditor成为Html在线编辑器的领航者?除了其强大的功能和方便的使用, 这里还有一些顶尖的技术因素是CuteEditor编辑器成为你编辑和发布Web内容的最佳选择: <br/> 界面简洁加载速度快 <br/><br/>由于才有了很多优化方法,所以CuteEditor非常简单、小巧、装载速度快,但仍然保持功能强大、执行效率高的特点。 <br/> <br/> 跨浏览器,跨平台的所见即所得在线html编辑器 <br/><br/>兼容市面上最流行的ie5.5+,firefox1.0+,mozilla1.3+, netscape7+和Safari(1.3+)浏览器,并且包括Mac和Linux操作平台。 <br/> <br/> CuteEditor遵循Web标准,没有类似 <FONT> 这种标签 <br/><br/>你的Html编辑器还在使用类似 <FONT>这种标签么? CuteEditor帮助你构建用户最新Web标准的html代码标签,自动生成简洁的HTML/XHTML代码。 为什么要遵循Web标准? <br/><br/>学习应用Web标准有很多益处,下面给几个简单例子:<br/><br/>获得好的搜索引擎排名: The separation of content and presentation makes the content represent a larger part of the total file size. Combined with semantic markup this will improve search engine rankings. <br/>更快的下载和加载网页: Less HTML results in smaller file sizes and quicker downloads. Modern web browsers render pages faster when they are in their standards mode than when they are in their backwards compatible mode. <br/>适应未来网页浏览器: When you use defined standards and valid code you future-proof your documents by reducing the risk of future web browsers not being able to understand the code you have used. <br/>代码编写简单,维护方便: Using more semantic and structured HTML makes it easier and quicker to understand code created by somebody else. <br/>适应其他设备: Semantic HTML, where structure is separated from presentation, makes it easier for screen readers and alternative browsing devices to interpret the content. <br/>非常好的适应性: A semantically marked up document can be easily adapted to print and alternative browsing devices, like handheld computers and cellular phones, just by linking to a different CSS file. You can also make site-wide changes to presentation by editing a single file. <br/>Read more:<br/>我的网页符合Web标准,你的呢? <br/> 能自动清理HTML代码中Word标记 <br/><br/>When text is pasted from Microsoft Word allot of unnecessary word specific markup is carried across. This can result in web pages that take an unnecessarily long time to download. The Paste from Word button solves this by removing word markup before pasting the text into your page. <br/> <br/> 支持W3C WAI和section 508的无障碍引导 <br/><br/>Cute Editor optional accessibility settings ensure your site complies with Section 508, so people with disabilities can have full access to your content.<br/> <br/> 输出的HTML或不错的XHTML供你选择 (Demo)<br/><br/>Cute Editor supports output well-formed XHTML. Your choice of XHTML 1.0 or HTML 4.01 output. <br/><br/> <br/> 无限次的撤销/恢复<br/><br/>Many of the other editors on the market cannot undo or redo certain actions, and certain table operations - such as cell merge or column deletion. Cute Editor 4.0 has a new custom undo/redo implementation to make you can now safely undo those actions. <br/><br/> <br/> 多语言支持,通过简单设置XML即可完成 (Demo)<br/><br/>All labels, buttons, tooltips and messages are located in external XML files, so that the language of the editor can be switched with a single property. You can also create a new language in a matter of minutes. <br/> <br/> 完全支持页面编辑(从 <HTML> 到 </HTML>) (Demo)<br/><br/>Cute Editor 4.0 allows you to edit a full HTML page, including <title>, <!DOCTYPE...> and some other options. You can also insert Form elements (checkbox, button, textarea, etc.) and modify certain properties of the element.<br/> <br/> 默认换行为软回车 (Demo)<br/><br/>Most other editors insert double line returns which can be annoying for clients who are used to editing in Microsoft Word. CuteEditor can be configured to use <div>, <br> or <p> tags when you press enter. In either mode <br> tags can be created by using shift+enter.<br/> <br/> 支持代码缩进和小写字母<br/><br/>Cute Editor displays nicely indented code in the HTML mode and the generating HTML tags and Attributes are in lower case. This is very convenient and important for the advanced users. <br/> <br/> 支持全屏编辑 (Demo)<br/><br/>It does not open a new window, instead it will resize to fit the browser screen. Edit in full screen mode, maximizing your available space. <br/><br/> <br/> 没有打开较慢的Java或ActiveX组件<br/><br/>100% DHTML, JavaScript ASP.Net code. There are no slow Java or ActiveX components to worry about and everything is handled in the browser! <br/><br/> <br/> 支持相对地址和URL自动关联(Demo)<br/><br/>With Cute Editor, you have the choice of using either a relative or absolute URL. <br/> <br/> 部署简单<br/><br/>The perfect addition to your content management system! Only a couple lines of code , you don't need to be an expert. Allows you to add an online HTML editing functionality that works with standard HTML form.<br/> <br/> 可以简单的通过API隐藏按钮和标签 <br/><br/>Cute Editor allows developers to set the image directory, set the controls width, disable image uploading and deleting, restrict access to the source/preview tabs, hide buttons and lists that you don't want your clients to see or access. <br/> <br/> 支持图片的文字环绕 <br/><br/>Locate the image you want to wrap text around, and click any justify button in the toolbar. The image will float to the desired direction. Text will be positioned around the image. <br/> <br/> 支持文件下载 <br/><br/>You can upload document files, create a link from your HTML content to the document files (zip files, ppt files...). <br/> <br/> CSS型皮肤 (Demo)<br/><br/>Cute Editor provides several built in themes that are ready to use. Developers can completely change the appearance of the toolbar and the dialogs by simply modifying the supplied classes and images. <br/> <br/> 高级的表格管理<br/><br/>Create and modify tables and table cells. Set their border color, alignment, cellspacing and more! Once you've created a table, simply right click inside of it and use the handy popup menu to change its attributes. <caption>,<summary>,<thead>,<tfoot>,<th> tags are supported. <br/><br/> <br/> 图片插入和自动上传<br/><br/>Built-in thumbnail generator. Thumbnail images are dynamically created; Supports upload new images. Paging - specify how many images. Support auto resize images.<br/> <br/> 具有特殊的对话框<br/><br/>With Style builder dialog box you can apply CSS style attributes directly to any HTML elements on your Web page.<br/> <br/> 支持内容模板 (Demo)<br/><br/>The basic idea behind a Content Management System (CMS) is to separate the management of content from design. Cute Editor allows the site designer to easily create and establish templates to give the site a uniform look. Templates may be modified when desired. <br/> <br/> 通过限制html和文字的长度来保护你的数据库 (Demo)<br/><br/>If you tried to insert a record whose text length is greater than allowed by your table, an error will be reported. To prevent this type of error from occurring, developers can use MaxHTMLLength or MaxTextLength in the Cute Editor to limit the length of the user抯 input. <br/> <br/> Apply security to control user access to resources <br/><br/>Cute Editor allows developers to assign a pre-defined set of permissions by group or individual. This prevents a normal user to access the administration functionality. <br/><br/>The details of permissions are specified by an XML security policy file. Each level maps to a specific file. The default mappings: <br/><br/>admin设置 admin.config <br/>default设置 default.config <br/>guest设置 guest.config <br/>You can customize and extend each policy file by editing the XML security policy file. You can also create your own policy files that define arbitrary permission sets.<br/><br/>Comparison of the sample security policy file <br/><br/> <br/>Permissions/Resource Setting Admin Default Guest <br/>AllowUpload <br/>AllowDelete <br/>AllowCopy <br/>AllowMove <br/>AllowCreateFolder <br/>AllowDeleteFolder <br/>RestrictUploadedImageDimension <br/>AutoResizeUploadedImages <br/>MaxImageWidth 6400 640 640 <br/>MaxImageHeight 4800 480 480 <br/>MaxImageSize 10000 100 100 <br/>MaxMediaSize 10000 100 100 <br/>MaxFlashSize 10000 100 100 <br/>MaxDocumentSize 10000 100 100 <br/>ImageGalleryPath ~/uploads ~/uploads/member ~/uploads/guest <br/>MediaGalleryPath ~/uploads ~/uploads/member ~/uploads/guest <br/>FlashGalleryPath ~/uploads ~/uploads/member ~/uploads/guest <br/>FilesGallaryPath ~/uploads ~/uploads/member ~/uploads/guest <br/>ImageFilters .jpg <br/>.jpeg <br/>.gif <br/>.png .jpg <br/>.jpeg <br/>.gif <br/> .jpg <br/>.jpeg <br/>.gif <br/> <br/>MediaFilters .avi <br/>.mpg <br/>.mpeg <br/>.mp3 .avi <br/>.mpg <br/>.mpeg <br/> .avi <br/>.mpg <br/>.mpeg <br/> <br/>DocumentFilters .txt, .doc<br/>.pdf, .zip<br/>.rar, .avi<br/>.mpg, .mpeg<br/>.mp3, .jpg<br/>.jpeg,.gif<br/>.png .pdf, .doc<br/> .txt, .doc<br/>.pdf, .zip<br/> <br/> <br/> 在线图片编辑<br/><br/>People that input content on a website are generally not web designers, so most don't have that design & technical fibre in them. With online image editor, you can now edit image file with no image editing software to download or install! Easy drag and drop familiar interface. Resize, change dimensions, scale, crop, add text, optimize, rotate, flip, mirror and add watermark. <br/> <br/> 控制上传文件夹大小<br/><br/>Max Upload Folder size(Including all subfolders and files. A must have feature for people who have limited hosting space.) Dynamic display of available free space in the Upload Folder.Limits the size of your upload folder. If the max is reached uploads will be disabled. <br/> <br/> 支持图片热点<br/><br/>Image maps are pictures with clickable regions also known as "hotspots." When users click on one of the hotspots, they're directed to the page you designate. CuteEditor 5.0 lets you easily create image maps to add fun and excitement to a page<br/> <br/> <div> 的盒模式<br/><br/><div> boxes offer a much greater ability to control the layout of a page. With CuteEditor, you can put any content between <div> tags and then use CSS to style all sorts of borders, backgrounds, etc. <br/> <br/> 通用虚拟键盘<br/><br/>Virtual Keyboard does not require changes to language settings of your system and even speeds up the entire text input process for your customers. It lets your native speaking clients to access your web resources from any location in the world without changing national keyboard layouts and fonts on their machines. <br/> <br/> 把图片存到数据库<br/><br/>With CuteEditor you can easily use a Sql Server database or access database as the file storage. <br/> <br/> RTF和HTML之间互相转换<br/><br/>With CuteEditor you can easily convert an HTML document into an RTF file and RTF file into HTML or XHTML document. <br/> <br/> 生成PDF文件<br/><br/>CuteEditor also allows you dynamically create Adobe PDF documents from ASP.NET.<br/> cuteEditor6.0多语言版(集成lic文件) <br/><br/>目前功能强大,最好的Asp.net编辑器之一 <br/>除了一般html编辑器具有的功能外,还有word过滤、图片在线处理、加水印等实用功能 <br/>使用关键步骤: <br/><br/>1、引用bin下的cuteEditor文件 <br/>2、在aspx页面顶部中添加引用 <br/>3、在aspx页面中加入代码 <br/>4、最后可以在.cs文件中通过来读取Editor1.Text的值来进行任意的扩展和控制了 <br/>具体配置可参照default.aspx和default.aspx.cs <br/><br/>关于cuteEditor6.0的特征及体验请浏览cuteEditor.cn,系统集成了lic授权文件,仅供体验测试使用,请不要用于任何商业用途! <br/><br/> <br/>
书名:《Java开发实战1200例(第I卷)》(清华大学出版社.李钟尉,陈丹丹) PDF格式扫描版,全书分为24章,共817页。2011年1月出版。 全书压缩打包成4部分,这是第3部分 注:本系列图书的第I、II卷再版均相应改名为《xxx开发实例大全》(基础卷)及(提高卷),但内容基本无变化,需要的童鞋可自由匹配查找。 内容简介   《Java开发实战1200例》分为I、II两卷共计1200个例子,包括了开发中各个方面最常用的实例,是目前市场上实例最全面的开发类图书;书中实例来源于多位工程师的多年积累,具有很强的实用性。 本书是第II卷,以开发人员在项目开发中经常遇到的问题和必须掌握的技术为中心,介绍了应用Java进行桌面程序开发各个方面的知识和技巧,主要包括Java语法与面向对象技术、Java高级应用、窗体与控件应用、文件操作典型应用和数据库应用。全书分5篇24章,共计603个实例和603个经验技巧。每个实例都是经过笔者精心筛选的,具有很强的实用性,其中一些实例是开发人员难于寻觅的解决方案。 本书两卷共计1200个例子,包括了开发中各个方面最常用的实例,是目前市场上实例最全面的开发类图书;本书实例来源于多位工程师的多年积累,具有很强的实用性。   本书非常适合Java的初学者,如高校学生、求职人员作为练习、速查、学习使用,也适合Java程序员参考、查阅。 目 录 第1篇 Java语法与面向对象技术 第1章 开发环境的应用 2 1.1 Java环境 3 实例001 下载JDK开发工具包 3 实例002 把JDK工具包安装到指定磁盘 4 实例003 设置JDK的环境变量 6 实例004 验证Java开发环境 7 实例005 下载并安装JRE执行环境 8 实例006 编程输出星号组成的等腰三角形 9 1.2 开发工具 11 实例007 下载最新的Eclipse 11 实例008 为最新的Eclipse安装中文语言包 12 实例009 活用Eclipse的工作空间 14 实例010 在Eclipse项目中编程输出字符表情 15 实例011 为Eclipse添加新的JDK环境 17 实例012 设置Eclipse中文API提示信息 18 实例013 为项目添加类库 20 实例014 使当前项目依赖另一个项目 21 1.3 界面设计器 22 实例015 安装界面设计器 22 实例016 设计Windows系统的运行对话框 界面 23 实例017 设计计算器程序界面 26 实例018 设计关于进销存管理系统的界面 27 第2章 Java基础应用 29 2.1 基本语法 30 实例019 输出错误信息与调试信息 30 实例020 从控制台接收输入字符 31 实例021 重定向输出流实现程序日志 31 实例022 自动类型转换与强制类型转换 33 2.2 运算符 34 实例023 加密可以这样简单(位运算) 34 实例024 用三元运算符判断奇数和偶数 35 实例025 更精确地使用浮点数 35 实例026 不用乘法运算符实现2×16 37 实例027 实现两个变量的互换(不借助 第3个变量) 37 2.3 条件语句 38 实例028 判断某一年是否为闰年 38 实例029 验证登录信息的合法性 39 实例030 为新员工分配部门 40 实例031 用Switch语句根据消费金额计算折扣 41 实例032 判断用户输入月份的季节 42 2.4 循环控制 43 实例033 使用while与自增运算符循环遍历 数组 43 实例034 使用for循环输出杨辉三角 43 实例035 使用嵌套循环在控制台上输出 九九乘法表 44 实例036 用while循环计算1+1/2!+1/3!&hellip;1/20! 45 实例037 for循环输出空心的菱形 46 实例038 foreach循环优于for循环 47 实例039 终止循环体 48 实例040 循环体的过滤器 49 实例041 循环的极限 50 第3章 数组与集合的应用 51 3.1 数组演练 52 实例042 获取一维数组最小值 52 实例043 将二维数组中的行列互换 53 实例044 利用数组随机抽取幸运观众 54 实例045 用数组设置JTable表格的列名与列宽 55 3.2 数组操作 57 实例046 数组的下标界限 57 实例047 按钮控件数组实现计数器界面 58 实例048 复选框控件数组 59 实例049 用数组反转字符串 60 3.3 数组排序与查询 61 实例050 使用选择排序法 61 实例051 使用冒泡排序法 62 实例052 使用快速排序法 64 实例053 使用直接插入法 65 实例054 使用sort方法对数组进行排序 67 实例055 反转数组中元素的顺序 68 3.4 常用集合的使用 69 实例056 用动态数组保存学生姓名 69 实例057 用List集合传递学生信息 70 实例058 用TreeSet生成不重复自动排序 随机数组 71 实例059 Map映射集合实现省市级联选择框 73 第4章 字符串处理技术 75 4.1 格式化字符串 76 实例060 把数字格式化为货币字符串 76 实例061 格式化当前日期 77 实例062 货币金额大写格式 78 实例063 String类格式化当前日期 80 实例064 字符串大小写转换 82 实例065 字符与Unicode码的转换 83 4.2 辨别字符串 84 实例066 判断用户名是否正确 84 实例067 用户名排序 85 实例068 判断网页请求与FTP请求 86 实例069 判断文件类型 87 实例070 判断字符串是否为数字 89 实例071 验证IP地址的有效性 90 实例072 鉴别非法电话号码 91 4.3 操作字符串 92 实例073 根据标点符号对字符串进行分行 92 实例074 将字符串的每个字符进行倒序输出 94 实例075 获取字符串中汉字的个数 94 实例076 批量替换某一类字符串 95 实例077 把异常与错误信息显示到窗体中 97 实例078 从字符串中分离文件路径、 文件名及扩展名 98 实例079 判断手机号的合法性 99 实例080 用字符串构建器追加字符 100 实例081 去掉字符串中的所有空格 101 实例082 汉字与区位码的转换 102 第5章 面向对象技术应用 103 5.1 Java中类的定义 104 实例083 自定义图书类 104 实例084 温度单位转换工具 105 实例085 域的默认初始化值 106 实例086 编写同名的方法 107 实例087 构造方法的应用 108 5.2 修饰符的使用 109 实例088 单例模式的应用 109 实例089 祖先的止痒药方 110 实例090 统计图书的销售量 111 实例091 汉诺塔问题求解 112 实例092 不能重写的方法 113 5.3 包装类的使用 114 实例093 将字符串转换成整数 114 实例094 整数进制转换器 115 实例095 查看数字的取值范围 116 实例096 ASCII编码查看器 117 实例097 Double类型的比较 118 5.4 面向对象的特征 119 实例098 经理与员工的差异 119 实例099 重写父类中的方法 121 实例100 计算几何图形的面积 122 实例101 提高产品质量的方法 123 实例102 简单的汽车销售商场 124 5.5 Object类的应用 126 实例103 两只完全相同的宠物 126 实例104 简化equals()方法的重写 127 实例105 重新计算对象的哈希码 129 实例106 简化hashCode()方法的重写 130 实例107 使用字符串输出对象 132 实例108 简化toString()方法的重写 133 5.6 克隆与序列化 134 实例109 Java对象的假克隆 134 实例110 Java对象的浅克隆 135 实例111 Java对象的深克隆 137 实例112 序列化与对象克隆 139 实例113 深克隆效率的比较 141 实例114 transient关键字的应用 143 5.7 接口和内部类 145 实例115 使用sort()方法排序 145 实例116 简化compareTo()方法的重写 146 实例117 策略模式的简单应用 148 实例118 适配器模式的简单应用 149 实例119 普通内部类的简单应用 151 实例120 局部内部类的简单应用 152 实例121 匿名内部类的简单应用 153 实例122 静态内部类的简单应用 154 第2篇 Java高级应用 第6章 多线程技术 158 6.1 线程的基础 159 实例123 新建无返回值的线程 159 实例124 查看线程的运行状态 160 实例125 查看JVM中的线程名 161 实例126 查看和修改线程名称 163 实例127 查看和修改线程优先级 165 实例128 使用守护线程 166 实例129 休眠当前线程 167 实例130 终止指定线程 169 实例131 线程的插队运行 170 6.2 线程的同步 171 实例132 非同步的数据读写 171 实例133 使用方法实现线程同步 172 实例134 使用代码块实现线程同步 174 实例135 使用特殊域变量实现线程同步 175 实例136 使用重入锁实现线程同步 176 实例137 使用线程局部变量实现线程同步 177 实例138 简单的线程通信 179 实例139 简单的线程死锁 180 实例140 解决线程的死锁问题 182 6.3 线程的进阶 183 实例141 使用阻塞队列实现线程同步 183 实例142 新建有返回值的线程 184 实例143 使用线程池优化多线程编程 186 实例144 Object类中线程相关的方法 187 实例145 哲学家就餐问题 189 实例146 使用信号量实现线程同步 190 实例147 使用原子变量实现线程同步 191 实例148 使用事件分配线程更新Swing控件 193 实例149 使用SwingWorker类完成耗操作 194 第7章 反射与异常处理 195 7.1 反射的基础 196 实例150 实例化Class类的5种方式 196 实例151 获得Class对象表示实体的名称 197 实例152 查看类的声明 198 实例153 查看类的成员 199 实例154 按继承层次对类排序 201 实例155 查看内部类信息 202 7.2 反射的进阶 203 实例156 动态设置类的私有域 203 实例157 动态调用类中的方法 204 实例158 动态实例化类 205 实例159 创建长度可变的数组 206 实例160 利用反射重写toString()方法 208 实例161 反射与动态代理 209 7.3 常见的未检查型异常 210 实例162 算数异常 210 实例163 数组存值异常 211 实例164 数组下标越界异常 212 实例165 空指针异常 213 7.4 常见的已检查型异常 214 实例166 类未发现异常 214 实例167 非法访问异常 215 实例168 文件未发现异常 216 实例169 数据库操作异常 217 7.5 处理异常 218 实例170 方法中抛出异常 218 实例171 方法上抛出异常 219 实例172 自定义异常类 220 实例173 捕获单个异常 221 实例174 捕获多个异常 222 第8章 枚举与泛型的应用 223 8.1 枚举使用的简介 224 实例175 查看枚举类型的定义 224 实例176 枚举类型的基本特性 225 实例177 增加枚举元素的信息 226 实例178 选择合适的枚举元素 227 实例179 高效的枚举元素集合 228 实例180 高效的枚举元素映射 229 实例181 遍历枚举接口的元素 230 实例182 简单的文件合并工具 231 8.2 泛型使用的简介 233 实例183 自定义非泛型栈结构 233 实例184 使用泛型实现栈结构 234 实例185 自定义泛型化数组类 235 实例186 泛型方法与数据查询 236 实例187 泛型化方法与最小值 238 实例188 泛型化接口与最大值 239 实例189 使用通配符增强泛型 240 实例190 泛型化的折半查找法 241 第9章 编程常用类 343 9.1 Calendar类的使用 244 实例191 简单的数字钟 244 实例192 简单的电子钟 245 实例193 简单的模拟钟 246 实例194 简单的公历万年历 248 实例195 查看生日相关信息 249 9.2 SimpleDateFormat与TimeZone 类的使用 250 实例196 日期格式有效性判断 250 实例197 常见日期格式使用 252 实例198 查看本地区 253 实例199 简单的区转换工具 254 9.3 System类的使用 255 实例200 查看常用系统属性 255 实例201 重定向标准输出 256 实例202 计算程序运行间 257 实例203 从控制台输入密码 258 9.4 Math类的使用 259 实例204 角度和弧度的转换 259 实例205 三角函数的使用 260 实例206 反三角函数的使用 261 实例207 双曲函数的使用 262 实例208 指数与对数运算 263 9.5 其他常用类的使用 264 实例209 高精度整数运算 264 实例210 高精度浮点运算 265 实例211 七星彩号码生成器 266 实例212 大乐透号码生成器 267 实例213 监视JVM内存状态 268 实例214 启动默认文本工具 269 实例215 简单的截图软件 270 第10章 Commons组件 272 10.1 Commons Lang组件简介 273 实例216 数组元素的增加 273 实例217 数组元素的删除 274 实例218 生成随机字符串 275 实例219 序列化与反序列化 276 实例220 分数的常见运算 277 实例221 整数取值范围判断 279 10.2 Commons Math组件简介 280 实例222 描述统计学应用 280 实例223 绘制简单直方图 281 实例224 一元线性回归计算 282 实例225 实数矩阵的运算 283 实例226 复数的常见运算 284 实例227 T分布常用计算 285 10.3 Commons IO组件简介 286 实例228 简化文件(夹)删除 286 实例229 简化文件(夹)复制 287 实例230 简化文件(夹)排序 288 实例231 简化文件(夹)过滤 289 实例232 简化文件的读写操作 290 10.4 Commons BeanUtils组件简介 291 实例233 设置JavaBean简单属性 291 实例234 设置JavaBean级联属性 293 实例235 动态生成JavaBean 295 实例236 复制JavaBean属性 296 实例237 动态排序JavaBean 298 10.5 其他Commons组件简介 299 实例238 优雅的JDBC代码 299 实例239 结果集与Bean列表 301 实例240 编写MD5查看器 302 实例241 基于Base64编码 304 实例242 基于Base64解码 305 实例243 发送简单的Email 306 实例244 发送带附件的Email 308 实例245 读取XML文件属性 310 第3篇 窗体与控件应用 第11章 窗体设计 314 11.1 设置窗体位置 315 实例246 控制窗体加载的位置 315 实例247 设置窗体在屏幕中的位置 315 实例248 从上次关闭位置启动窗体 316 实例249 始终在桌面最顶层显示的窗体 317 11.2 设置窗体大小 319 实例250 设置窗体大小 319 实例251 根据桌面大小调整窗体大小 320 实例252 自定义最大化、最小化和关闭按钮 321 实例253 禁止改变窗体的大小 323 11.3 设置窗体的标题栏 324 实例254 指定窗体标题栏图标 324 实例255 拖动没有标题栏的窗体 325 实例256 取消窗体标题栏与边框 326 实例257 设置闪烁的标题栏 328 11.4 设置窗体的背景 329 实例258 设置窗体背景颜色为淡蓝色 329 实例259 实现带背景图片的窗体 330 实例260 使背景图片自动适应窗体的大小 331 实例261 背景为渐变色的主界面 332 实例262 随机更换窗体背景 334 11.5 窗体形状及应用 335 实例263 椭圆形窗体界面 335 实例264 钻石形窗体 336 实例265 创建透明窗体 337 11.6 对话框 338 实例266 模态对话框与非模态对话框 338 实例267 信息提示对话框 340 实例268 设置信息提示对话框的图标 341 实例269 文件选择对话框指定数据库备份文件 342 实例270 指定打开对话框的文件类型 343 实例271 文件的保存对话框 344 实例272 为保存对话框设置默认文件名 346 实例273 支持图片预览的文件选择对话框 347 实例274 颜色选择对话框 348 实例275 信息输入对话框 350 实例276 定制信息对话框 350 11.7 MDI窗体的使用 352 实例277 创建内部子窗体 352 实例278 使子窗体最大化显示 353 实例279 对子窗体进行平铺排列 354 实例280 禁用MDI窗体控制栏中的“最大化” 按钮 355 第12章 窗体特效 357 12.1 让窗体更有活力 358 实例281 右下角弹出信息窗体 358 实例282 淡入淡出的窗体 359 实例283 窗体顶层的进度条 361 实例284 设置窗体的鼠标光标 362 实例285 窗体抖动 363 实例286 窗体标题显示计器 364 实例287 动态展开窗体 365 实例288 仿QQ隐藏窗体 366 实例289 窗体百叶窗登场特效 367 实例290 关闭窗体打开网址 368 12.2 窗体与控件外观 369 实例291 Nimbus外观 369 实例292 本地系统外观 370 实例293 分割的窗体界面 371 实例294 圆周运动的窗体 373 第13章 基本控件应用 375 13.1 顶层容器的应用 376 实例295 框架容器的背景图片 376 实例296 更多选项的框架容器 377 实例297 拦截事件的玻璃窗格 378 实例298 简单的每日提示信息 379 实例299 震动效果的提示信息 380 13.2 布局管理器应用 382 实例300 边框布局的简单应用 382 实例301 流式布局的简单应用 383 实例302 网格布局的简单应用 384 实例303 制作圆形布局管理器 385 实例304 制作阶梯布局管理器 386 13.3 输入控件的应用 387 实例305 可以打开网页的标签 387 实例306 密码域控件的简单应用 389 实例307 给文本域设置背景图片 390 实例308 给文本区设置背景图片 391 实例309 简单的字符统计工具 392 13.4 选择控件的应用 393 实例310 能预览图片的复选框 393 实例311 简单的投票计数软件 394 实例312 单选按钮的简单应用 395 实例313 能显示图片的组合框 396 实例314 使用滑块来选择日期 398 13.5 菜单控件的应用 400 实例315 模仿记事本的菜单栏 400 实例316 自定义纵向的菜单栏 401 实例317 复选框与单选按钮菜单 402 实例318 包含图片的弹出菜单 404 实例319 工具栏的实现与应用 405 13.6 其他技术的应用 406 实例320 自定义软件安装向导 406 实例321 查看系统支持的外观 407 实例322 制作软件的闪屏界面 408 实例323 自定义系统托盘图标 410 实例324 使用撤销与重做功能 412 第14章 复合数据类型控件应用 414 14.1 列表的简单应用 415 实例325 修改列表项显示方式 415 实例326 修改列表项选择模式 416 实例327 列表项的全选与不选 417 实例328 列表元素与提示信息 419 实例329 监听列表项单击事件 420 实例330 监听列表项双击事件 421 14.2 列表的高级应用 422 实例331 实现自动排序的列表 422 实例332 列表项的增加与删除 423 实例333 查找特定的列表元素 425 实例334 包含边框的列表元素 426 实例335 包含图片的列表元素 427 实例336 可以预览字体的列表 428 14.3 表格的简单应用 430 实例337 表头与列的高度设置 430 实例338 调整表格各列的宽度 431 实例339 设置表格的选择模式 433 实例340 为表头增添提示信息 434 实例341 单元格的粗粒度排序 436 实例342 实现表格的查找功能 437 14.4 表格的高级应用 438 实例343 在表格中应用组合框 438 实例344 删除表格中选中的行 440 实例345 实现表格的分页技术 442 实例346 为单元格绘制背景色 444 实例347 实现表格的栅栏效果 445 实例348 单元格的细粒度排序 446 14.5 树控件简单应用 448 实例349 编写中国省市信息树 448 实例350 树控件常用遍历方式 449 实例351 自定义树节点的图标 451 实例352 监听节点的选择事件 452 实例353 设置树控件选择模式 453 实例354 查看节点的各种状态 455 14.6 树控件高级应用 456 实例355 在树控件中增加节点 456 实例356 在树控件中删除节点 458 实例357 在树控件中查找节点 459 实例358 自定义树节点的外观 460 实例359 为树节点增加提示信息 463 实例360 双击编辑树节点功能 464 第15章 其他高级控件应用 466 15.1 JTextPane控件的应用 467 实例361 自定义文档标题的样式 467 实例362 文档中显示自定义图片 468 实例363 检查代码中的括号是否匹配 469 实例364 描红显示100以内的质数 471 15.2 JEditorPane控件的应用 472 实例365 自定义RTF文件查看器 472 实例366 编写简单的浏览器 474 实例367 支持超链接的浏览器 474 实例368 高亮用户指定的关键字 476 15.3 其他文本控件的应用 477 实例369 只能输入整数的文本域 477 实例370 强制输入合法的整数 478 实例371 使用微调控件调整间 479 实例372 使用微调控件浏览图片 480 15.4 进度指示器的应用 481 实例373 显示完成情况的进度条 481 实例374 监听进度条的变化事件 482 实例375 进度监视器控件的应用 484 实例376 监视文件读入的进度 485 15.5 控件组织器的应用 487 实例377 分割面板的简单应用 487 实例378 为选项卡增加快捷键 488 实例379 为选项卡标题设置图标 489 实例380 记录选项卡的访问状态 490 第16章 控件特效与自定义控件 492 16.1 控件边框效果 493 实例381 实现标签控件的立体边框 493 实例382 实现按钮控件边框留白 494 实例383 实现文本域控件的浮雕化边框 495 实例384 为文本框控件添加LineBorder 线形边框 496 实例385 控件的纯色边框与图标边框 498 实例386 实现带标题边框的面板容器 499 实例387 指定字体的标题边框 501 实例388 嵌套的标题边框 502 实例389 带图标边框的标题边框 503 实例390 文本框的下划线边框 504 16.2 控件渲染让界面UI更灵活 506 实例391 支持图标的列表控件 506 实例392 在列表控件中显示单选按钮 507 实例393 列表控件折行显示列表项 508 实例394 使用图片制作绚丽按钮 510 实例395 实现按钮关键字描红 511 实例396 忙碌的按钮控件 512 实例397 实现透明效果的表格控件 513 实例398 在表格中显示工作进度百分比 515 实例399 在表格中显示图片 517 16.3 让控件活起来 518 实例400 鼠标经过按钮放大效果 518 实例401 迟到的登录按钮 520 实例402 焦点按钮的缩放 521 实例403 标签文本的跑马灯特效 522 实例404 延迟生效的按钮 524 实例405 动态加载表格数据 525 16.4 自定义控件 526 实例406 石英钟控件 526 实例407 IP输入文本框控件 527 实例408 日历控件 530 实例409 平移面板控件 531 实例410 背景图面板控件 533 第4篇 文件操作典型应用 第17章 文件与文件夹操作 536 17.1 文件操作 537 实例411 修改文件属性 537 实例412 显示指定类型的文件 538 实例413 以树结构显示文件路径 540 实例414 查找替换文本文件内容 541 实例415 支持图片预览的文件选择对话框 543 实例416 设置Windows的文件属性 545 实例417 文件批量重命名 547 实例418 快速批量移动文件 549 实例419 删除磁盘中所有的.tmp临文件 551 17.2 文件与数据库 553 实例420 提取数据库内容到文件 553 实例421 提取文本文件的内容到MySQL数据库 555 实例422 将图片文件保存到SQL Server数据库 556 实例423 显示数据库中的图片信息 558 实例424 提取技术网站数据到文件夹 559 实例425 读取文件路径到数据库 561 实例426 在数据库中建立磁盘文件索引 562 17.3 操作磁盘文件夹 564 实例427 窗体动态加载磁盘文件 564 实例428 删除文件夹中所有文件 565 实例429 创建磁盘索引文件 567 实例430 快速全盘查找文件 568 实例431 获取磁盘所有文本文件 570 实例432 网络文件夹备份 571 第18章 文件的读取、写入、整理和控制 573 18.1 文件的读取与写入 574 实例433 键盘录入内容保存到文本文件 574 实例434 将数组写入到文件中并逆序输出 575 实例435 利用StringBuffer避免文件的多次写入 576 实例436 合并多个txt文件 577 实例437 实现文件简单加密与解密 579 实例438 对大文件实现分割处理 581 实例439 将分割后的文件重新合并 583 实例440 读取属性文件的单个属性值 584 实例441 向属性文件中添加信息 585 实例442 在复制文件使用进度条 586 实例443 从XML文件中读取数据 587 实例444 读取Jar文件属性 589 实例445 电子通讯录 590 18.2 实现文件整理 592 实例446 批量复制指定扩展名的文件 592 实例447 计数器小程序 594 实例448 将某文件夹中的文件进行分类存储 595 18.3 文件控制 597 实例449 利用StreamTokenizer统计文件的 字符数 597 实例450 在指定目录下搜索文件 598 实例451 序列化和反序列化对象 600 实例452 文件锁定 602 实例453 投票统计 603 第19章 文件压缩 605 19.1 Java实现文件压缩 606 实例454 压缩所有文本文件 606 实例455 压缩包解压到指定文件夹 607 实例456 压缩所有子文件夹 608 实例457 深层文件夹压缩包的释放 610 实例458 解决压缩包中文乱码 611 实例459 Apache实现文件解压缩 612 实例460 把窗体压缩成ZIP文件 613 实例461 解压缩Java对象 615 19.2 RAR文件压缩 616 实例462 文件压缩为RAR文档 616 实例463 解压缩RAR压缩包 619 实例464 文件分卷压缩 621 实例465 为RAR压缩包添加注释 623 实例466 获取压缩包详细文件列表 625 实例467 从RAR压缩包中删除文件 627 实例468 在压缩文件中查找字符串 628 实例469 重命名RAR压缩包中的文件 629 实例470 创建自解压RAR压缩包 631 实例471 设置RAR压缩包密码 632 19.3 数据压缩的网络应用 634 实例472 以压缩格式传输网络数据 634 实例473 压缩远程文件夹 637 实例474 压缩存储网页 638 第20章 操作办公文档 640 20.1 操作Word 641 实例475 把文本文件导入到Word中 641 实例476 浏览本地Word文件 642 实例477 将员工表插入到Word文档中 644 实例478 将员工照片插入到Word简历 645 实例479 将Word文档保存为HTML格式 646 20.2 操作Excel 647 实例480 将员工信息保存到Excel表中 647 实例481 通过Excel公式计算出商品表中的 总售价 649 实例482 将数据库表中的内容写入到Excel 651 实例483 将Excel表中的内容保存到数据库 653 实例484 将Excel文件转换为HTML格式 654 20.3 操作PDF 655 实例485 应用iText组件生成PDF 655 实例486 在窗体中显示PDF文件 657 实例487 应用PDF Renderer组件实现放大 PDF文件 658 实例488 应用PDF Renderer组件实现缩小 PDF文件 660 实例489 应用PDF Renderer组件实现抓手功能 661 实例490 全屏显示PDF文件 662 第5篇 数据库应用 第21章 SQL应用 666 21.1 排序和分组函数应用 667 实例491 对数据进行降序查询 667 实例492 对数据进行多条件排序查询 669 实例493 对统计结果进行排序 670 实例494 查询SQL Server数据库中的前3条 数据 671 实例495 查询SQL Server数据库中的后3 条数据 672 实例496 查询MySQL数据库中的前3条数据 673 实例497 查询MySQL数据库中的后3条数据 674 实例498 按照字母顺序对留学生表进行排序 675 实例499 按姓氏笔画排序 677 实例500 将汉字按音序排序 678 实例501 按列的编号排序 679 实例502 从表中随机返回记录 680 实例503 使用GROUP BY子句实现对数据的 分组统计 681 实例504 使用GROUP BY子句实现多表 分组统计 682 21.2 聚集函数与日期查询 683 实例505 利用SUM函数实现数据汇总 683 实例506 利用AVG函数实现计算平均值 684 实例507 利用MIN函数求数据表中的最小值 685 实例508 利用MAX函数求数据表中的最大值 686 实例509 利用COUNT函数求销售额大于某值的 图书种类 688 实例510 查询编程词典6月的销售量 689 实例511 查询与张静同一天入司的员工信息 690 实例512 使用IN谓词查询某几个间的数据 692 实例513 日期查询中避免千年虫问题 693 21.3 大小比较与逻辑应用 694 实例514 在查询结果中不显示重复记录 694 实例515 使用NOT查询不满足条件的记录 695 实例516 使用between进行区间查询 697 实例517 列出销量表中的重复记录和记录条数 698 实例518 使用关系运算符查询某一间段数据 699 实例519 计算两个日期之间的月份数 700 实例520 格式化金额 702 实例521 在查询语句中过滤掉字符串中的空格 703 第22章 数据库操作 705 22.1 通过JDBC-ODBC桥连接数据库 706 实例522 通过JDBC-ODBC桥连接SQL Server 2000数据库 706 实例523 JDBC-ODBC桥连接Access数据库 708 实例524 JDBC-ODBC桥与Oracle数据库 建立连接 710 22.2 JDBC技术连接数据库 711 实例525 通过JDBC连接SQL Server 2000 数据库 711 实例526 JDBC连接MySQL数据库 713 实例527 JDBC连接SQL Server 2005数据库 714 实例528 JDBC技术连接Oracle数据库 715 实例529 JDBC连接JavaDB数据库 716 22.3 数据库与数据表 717 实例530 列举SQL Server数据库下的数据表 717 实例531 列举MySQL数据库下的数据表 718 实例532 查看数据表结构 719 实例533 动态维护投票数据库 721 实例534 SQL Server数据备份 722 实例535 SQL Server数据恢复 725 实例536 MySQL数据备份 728 实例537 MySQL数据恢复 730 实例538 动态附加数据库 731 实例539 生成SQL数据库脚本 733 实例540 获取SQL Server数据表字段的描述信息 734 22.4 数据增加、更新与删除操作 736 实例541 将员工信息添加到数据表 736 实例542 添加数据使用数据验证 737 实例543 插入用户登录日志信息 739 实例544 生成有规律的编号 740 实例545 生成无规律的编号 742 实例546 在插入数据过滤掉危险字符 743 实例547 将用户选择的爱好以字符串形式保存 到数据库 744 实例548 将数据从一张表复制到另一张表 745 实例549 使用UNION ALL语句批量插入数据 746 实例550 更新指定记录 747 实例551 在删除数据给出提示信息 748 实例552 将数据表清空 749 实例553 字符串大小写转换 750 第23章 数据查询 752 23.1 使用子查询 753 实例554 将子查询作为表达式 753 实例555 用子查询作为派生表 754 实例556 通过子查询关联数据 755 实例557 使用IN谓词限定查询范围 756 实例558 使用NOT IN子查询实现差集运算 758 实例559 使用NOT IN子查询实现反向查询 759 实例560 返回笛卡尔乘积 760 实例561 比较运算符引入子查询 761 实例562 在子查询中使用聚集函数 762 实例563 在删除数据使用子查询 763 23.2 嵌套查询 764 实例564 查询平均成绩在85分以上的学生信息 764 实例565 查询本科部门经理月收入情况 766 实例566 在嵌套中使用EXISTS关键字 767 实例567 动态指定查询条件 768 23.3 连接查询 769 实例568 使用UNION运算符使学生档案归档 769 实例569 内连接获取指定课程的教师信息 771 实例570 左外连接查询员工信息 772 实例571 右外连接查询员工信息 773 实例572 多表外连接查询 774 实例573 完全连接查询 775 23.4 函数查询 777 实例574 在查询中使用patindex()函数进行 模糊查询 777 实例575 对查询结果进行格式化 778 实例576 在查询中使用字符串函数 780 实例577 在查询中使用ALL谓词 781 实例578 在查询中使用ANY谓词 782 实例579 使用UNION运算符消除重复的行 784 实例580 使用UNION ALL运算符保留重复的行 785 实例581 计算商品销售额所占的百分比 786 第24章 数据库高级应用 787 24.1 在Java程序中使用存储过程 788 实例582 调用存储过程实现用户身份验证 788 实例583 应用存储过程添加数据 789 实例584 调用加密存储过程 791 实例585 获取数据库中所有存储过程 792 实例586 修改存储过程 793 实例587 删除存储过程 795 24.2 使用触发器 796 实例588 应用触发器添加日志信息 796 实例589 在删除成绩表将学生表中的数据删除 798 实例590 在程序中调用UPDATE触发器 799 实例591 获取数据库中的触发器名称 801 实例592 创建带有触发条件的触发器 802 24.3 使用批处理 803 实例593 使用批处理删除数据 803 实例594 使用批处理提升部门员工工资 805 实例595 将教师表中的数据全部添加到选课表 806 实例596 在批处理中使用事务 807 24.4 使用视图 809 实例597 创建视图 809 实例598 使用视图过滤不想要的数据 810 实例599 使用视图与计算数据 812 实例600 使用视图重新格式化检索出来的数据 813 实例601 获取数据库中的全部用户视图 814 实例602 修改视图 815 实例603 删除视图 816
Java中使用iText生成PDF并在页眉中插入图片的方法如下: 首先,你可以创建一个页眉页脚类,根据实际情况使用,如果不需要页眉页脚可以忽略这一步。通过参考中的链接可以了解更多关于页眉页脚带图片的详细信息。 接下来,你需要使用iText生成PDF。你可以通过参考中的链接找到一个示例代码,并在生成PDF的过程中插入图片。具体来说,在创建表格的过程中,你可以在表格的某一行中插入图片,例如在createHardwarePDF方法的第九行。 最后,你可以参考中的链接来了解更多关于JavaiText生成PDF插入图片的信息和效果演示。 这样,你就可以在Java中使用iText生成PDF并在页眉中插入图片了。希望对你有所帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [itextpdf 使用之 html 转 pdf 页眉页脚带图片](https://download.csdn.net/download/z1353095373/85382971)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [JavaItext生成Pdf,并给PdfCell添加图片](https://blog.csdn.net/qq_17847881/article/details/130180328)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Itextpdf添加页眉页脚页码,页眉中需要添加logo图片](https://blog.csdn.net/qb170217/article/details/118718685)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值