⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdlmethods.java

📁 it is a basic library management project which provides all the features necessary for a library man
💻 JAVA
字号:
/*
 ****************************************************************
 ****************************************************************
 ******* 													*****
 ******* 	PROGRAMMER: JUNALD ASTRONOMO LAGOD				*****
 ******* 	CONTACT NUMBER: +639195671599					*****
 ******* 	E-MAIL ADDRESS: JUNALDLAGOD@YAHOO.COM			*****
 ******* 	WEBSITE: HTTP://WWW.JUNALDLAGOD.CJB.NET			*****
 ******* 													*****
 *******	SIKAT ANG MGA PINOY								*****
 *******	PLEASE DON'T FORGET TO VOTE	    				*****			*****
 ******* 													*****
 ****************************************************************
 ****************************************************************
 */


import java.awt.*;
import java.util.*;
import java.io.*;
import java.awt.PrintJob;
import javax.swing.*;

public class mdlMethods 
{
	public void printRecord (String rec,JFrame JFMainParent) 
	{

		StringReader SRReader = new StringReader (rec);
		LineNumberReader LNRReader = new LineNumberReader (SRReader);
		Font typeface = new Font ("Courier New", Font.PLAIN, 10);
		PrintJob PJPrint = Toolkit.getDefaultToolkit().getPrintJob (JFMainParent, "Print Customer Balance Report", new Properties());

		if (PJPrint != null) {
			Graphics GGraph = PJPrint.getGraphics ();
			if (GGraph != null) {
				FontMetrics FMFont = GGraph.getFontMetrics (typeface);
				int PAGE_HEIGHT = PJPrint.getPageDimension().height - 75;
    				int FONT_HEIGHT = FMFont.getHeight();
	    			int FONT_DESCENT = FMFont.getDescent();
    				int CURRENT_HEIGHT = 75;
				String NEXT_LINE;
				GGraph.setFont (typeface);

				try {
					do {
						NEXT_LINE = LNRReader.readLine ();
						if (NEXT_LINE != null) {         
							if ((CURRENT_HEIGHT + FONT_HEIGHT) > PAGE_HEIGHT) {
								GGraph.dispose();
								GGraph = PJPrint.getGraphics ();
								CURRENT_HEIGHT = 75;
							}							
							CURRENT_HEIGHT += FONT_HEIGHT;
							if (GGraph != null) {
								GGraph.setFont (typeface);
								GGraph.drawString (NEXT_LINE, 75, CURRENT_HEIGHT - FONT_DESCENT);
							}
						}
					}
					while (NEXT_LINE != null);					
				}
				catch (EOFException EOF_EXCEPTION) { }
				catch (Throwable TROW_ERR) { }
			}
			GGraph.dispose();
		}
		if (PJPrint != null)
			PJPrint.end ();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -