亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hardcopywriter.java

?? 164個完整的Java代碼,資源比較大
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * Copyright (c) 2000 David Flanagan.  All rights reserved. * This code is from the book Java Examples in a Nutshell, 2nd Edition. * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied. * You may study, use, and modify it for any non-commercial purpose. * You may distribute it non-commercially as long as you retain this notice. * For a commercial use license, or to purchase the book (recommended), * visit http://www.davidflanagan.com/javaexamples2. */package com.davidflanagan.examples.print;import java.awt.*;import java.awt.event.*;import java.io.*;import java.text.*;import java.util.*;/**  * A character output stream that sends output to a printer. **/public class HardcopyWriter extends Writer {    // These are the instance variables for the class    protected PrintJob job;                 // The PrintJob object in use    protected Graphics page;                // Graphics object for current page    protected String jobname;               // The name of the print job    protected int fontsize;                 // Point size of the font    protected String time;                  // Current time (appears in header)    protected Dimension pagesize;           // Size of the page (in dots)    protected int pagedpi;                  // Page resolution in dots per inch    protected Font font, headerfont;        // Body font and header font    protected FontMetrics metrics;          // Metrics for the body font    protected FontMetrics headermetrics;    // Metrics for the header font    protected int x0, y0;                   // Upper-left corner inside margin    protected int width, height;            // Size (in dots) inside margins    protected int headery;                  // Baseline of the page header    protected int charwidth;                // The width of each character    protected int lineheight;               // The height of each line    protected int lineascent;               // Offset of font baseline    protected int chars_per_line;           // Number of characters per line    protected int lines_per_page;           // Number of lines per page    protected int charnum = 0, linenum = 0; // Current column and line position    protected int pagenum = 0;              // Current page number    // A field to save state between invocations of the write() method    private boolean last_char_was_return = false;    // A static variable that holds user preferences between print jobs    protected static Properties printprops = new Properties();    /**     * The constructor for this class has a bunch of arguments:       * The frame argument is required for all printing in Java.     * The jobname appears left justified at the top of each printed page.     * The font size is specified in points, as on-screen font sizes are.     * The margins are specified in inches (or fractions of inches).     **/    public HardcopyWriter(Frame frame, String jobname, int fontsize, 			  double leftmargin, double rightmargin,			  double topmargin, double bottommargin) 	throws HardcopyWriter.PrintCanceledException    {	// Get the PrintJob object with which we'll do all the printing.	// The call is synchronized on the static printprops object, which 	// means that only one print dialog can be popped up at a time.	// If the user clicks Cancel in the print dialog, throw an exception.	Toolkit toolkit = frame.getToolkit();   // get Toolkit from Frame	synchronized(printprops) {	    job = toolkit.getPrintJob(frame, jobname, printprops);	}	if (job == null) 	    throw new PrintCanceledException("User cancelled print request");		pagesize = job.getPageDimension();      // query the page size	pagedpi = job.getPageResolution();      // query the page resolution		// Bug Workaround:	// On windows, getPageDimension() and getPageResolution don't work, so	// we've got to fake them.	if (System.getProperty("os.name").regionMatches(true,0,"windows",0,7)){	    // Use screen dpi, which is what the PrintJob tries to emulate	    pagedpi = toolkit.getScreenResolution();	    // Assume a 8.5" x 11" page size.  A4 paper users must change this.	    pagesize = new Dimension((int)(8.5 * pagedpi), 11*pagedpi);	    // We also have to adjust the fontsize.  It is specified in points,	    // (1 point = 1/72 of an inch) but Windows measures it in pixels.	    fontsize = fontsize * pagedpi / 72;	}		// Compute coordinates of the upper-left corner of the page.	// I.e. the coordinates of (leftmargin, topmargin).  Also compute	// the width and height inside of the margins.	x0 = (int)(leftmargin * pagedpi);	y0 = (int)(topmargin * pagedpi);	width = pagesize.width - (int)((leftmargin + rightmargin) * pagedpi);	height = pagesize.height - (int)((topmargin + bottommargin) * pagedpi);		// Get body font and font size	font = new Font("Monospaced", Font.PLAIN, fontsize);  	metrics = frame.getFontMetrics(font);	lineheight = metrics.getHeight();	lineascent = metrics.getAscent();	charwidth = metrics.charWidth('0');  // Assumes a monospaced font!		// Now compute columns and lines will fit inside the margins	chars_per_line = width / charwidth;	lines_per_page = height / lineheight;		// Get header font information	// And compute baseline of page header: 1/8" above the top margin	headerfont = new Font("SansSerif", Font.ITALIC, fontsize);	headermetrics = frame.getFontMetrics(headerfont);	headery = y0 - (int)(0.125 * pagedpi) -  	    headermetrics.getHeight() + headermetrics.getAscent();		// Compute the date/time string to display in the page header	DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG,						       DateFormat.SHORT);	df.setTimeZone(TimeZone.getDefault());	time = df.format(new Date());		this.jobname = jobname;                 // save name	this.fontsize = fontsize;               // save font size    }        /**     * This is the write() method of the stream.  All Writer subclasses      * implement this.  All other versions of write() are variants of this one     **/    public void write(char[] buffer, int index, int len) {	synchronized(this.lock) {  // For thread safety	    // Loop through all the characters passed to us	    for(int i = index; i < index + len; i++) {		// If we haven't begun a page (or a new page), do that now.		if (page == null) newpage();				// If the character is a line terminator, then begin new line, 		// unless it is a \n immediately after a \r.		if (buffer[i] == '\n') {		    if (!last_char_was_return) newline();		    continue;		}		if (buffer[i] == '\r') {		    newline();		    last_char_was_return = true;		    continue;		}		else last_char_was_return = false;				// If it some other non-printing character, ignore it.		if (Character.isWhitespace(buffer[i]) &&		    !Character.isSpaceChar(buffer[i]) && (buffer[i] != '\t'))		    continue;				// If no more characters will fit on the line, start new line.		if (charnum >= chars_per_line) {		    newline();		    // Also start a new page, if necessary		    if (page == null) newpage();  		}				// Now print the character:		// If it is a space, skip one space, without output.		// If it is a tab, skip the necessary number of spaces.		// Otherwise, print the character.		// It is inefficient to draw only one character at a time, but		// because our FontMetrics don't match up exactly to what the		// printer uses we need to position each character individually		if (Character.isSpaceChar(buffer[i])) charnum++;		else if (buffer[i] == '\t') charnum += 8 - (charnum % 8);		else {		    page.drawChars(buffer, i, 1, 				   x0 + charnum * charwidth, 				   y0 + (linenum*lineheight) + lineascent);		    charnum++;		}	    }	}    }        /**      * This is the flush() method that all Writer subclasses must implement.     * There is no way to flush a PrintJob without prematurely printing the     * page, so we don't do anything.     **/    public void flush() { /* do nothing */ }        /**     * This is the close() method that all Writer subclasses must implement.     * Print the pending page (if any) and terminate the PrintJob.     */    public void close() {	synchronized(this.lock) {	    if (page != null) page.dispose();   // Send page to the printer	    job.end();                          // Terminate the job	}    }        /**     * Set the font style.  The argument should be one of the font style      * constants defined by the java.awt.Font class.  All subsequent output     * will be in that style.  This method relies on all styles of the     * Monospaced font having the same metrics.     **/    public void setFontStyle(int style) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99在线观看| 国产精品99久久久久久久vr| 欧美videos中文字幕| 欧美视频中文字幕| 91欧美一区二区| 色综合天天综合网天天狠天天| 国产精品综合二区| 国产成人精品一区二| 国产精品一区二区91| 国产精品18久久久久久久网站| 国产精品亲子伦对白| 在线不卡中文字幕播放| 97精品国产97久久久久久久久久久久 | 99久久伊人精品| 日韩av在线发布| 另类成人小视频在线| 麻豆成人在线观看| 国产美女主播视频一区| 国产精品99久久久久久久vr| 成人亚洲精品久久久久软件| 97se狠狠狠综合亚洲狠狠| 91视频观看免费| 欧美日高清视频| 日韩免费视频线观看| 欧美经典一区二区| 亚洲欧美视频一区| 日本91福利区| 国产成人aaa| 在线国产亚洲欧美| 日韩免费观看高清完整版| 久久久精品天堂| 亚洲综合丁香婷婷六月香| 日本不卡一二三| a级精品国产片在线观看| 欧美三级午夜理伦三级中视频| 欧美一区二区成人| 成人免费在线播放视频| 日韩福利电影在线观看| 国产资源精品在线观看| 日本丰满少妇一区二区三区| 日韩欧美国产一区在线观看| 中日韩av电影| 久久国产夜色精品鲁鲁99| 毛片av一区二区| 国产精品一线二线三线精华| 麻豆精品精品国产自在97香蕉| 国产精品一区三区| 欧美精选一区二区| 中文字幕乱码久久午夜不卡| 五月激情丁香一区二区三区| 成人午夜视频网站| 日韩你懂的在线观看| 亚洲一区二区三区小说| 成人免费高清视频在线观看| 欧美一区二区三区爱爱| 一区二区三区四区蜜桃| av在线不卡电影| 久久免费精品国产久精品久久久久| 亚洲在线一区二区三区| av激情综合网| 中文av一区特黄| 国产一区91精品张津瑜| 欧美v日韩v国产v| 日韩国产欧美视频| 欧美精品123区| 亚洲国产精品视频| 在线国产电影不卡| 亚洲综合无码一区二区| 色诱视频网站一区| 国产精品麻豆欧美日韩ww| 同产精品九九九| 亚洲精品视频自拍| 精品第一国产综合精品aⅴ| 国产亚洲精品资源在线26u| 久久精品久久久精品美女| 欧美巨大另类极品videosbest | 欧美写真视频网站| 综合电影一区二区三区| 99re亚洲国产精品| 国产精品久久福利| 91理论电影在线观看| 亚洲欧美日韩人成在线播放| 91蜜桃婷婷狠狠久久综合9色| 日本一区二区三区高清不卡| 成人精品亚洲人成在线| 国产精品久久久久四虎| 91麻豆免费视频| 亚洲影院久久精品| 欧美一区二区视频观看视频| 久久国产夜色精品鲁鲁99| 精品99999| 成人国产精品免费| 亚洲一区二区三区不卡国产欧美 | 精品一区二区影视| 亚洲乱码国产乱码精品精小说 | 日韩精品自拍偷拍| 蜜臀久久久99精品久久久久久| 91麻豆精品国产无毒不卡在线观看 | 欧美人动与zoxxxx乱| 日本成人在线一区| 国产婷婷一区二区| bt欧美亚洲午夜电影天堂| 亚洲成人综合网站| 日韩精品一区二区三区四区| 成人黄色国产精品网站大全在线免费观看| 中文字幕 久热精品 视频在线| 色激情天天射综合网| 免费欧美在线视频| 国产精品国产三级国产普通话蜜臀| 成人精品一区二区三区四区| 2024国产精品| 亚洲最新视频在线观看| 1000部国产精品成人观看| 亚洲免费毛片网站| 777久久久精品| 国产99久久久久久免费看农村| 亚洲国产高清不卡| 9191成人精品久久| 国产福利91精品一区| 亚洲国产精品一区二区www在线| 精品欧美一区二区三区精品久久 | 欧美大片在线观看一区| 91同城在线观看| 国产福利一区在线观看| 亚洲一区二区在线免费看| 久久这里只有精品视频网| 欧美色网一区二区| 精品一区二区三区久久| 亚洲一区二区av在线| 成人精品一区二区三区四区| 日本在线不卡一区| 亚洲精品ww久久久久久p站| 精品国产成人在线影院| 欧美日韩在线播放| 91视频免费播放| 高清国产一区二区三区| 精品一二三四区| 日本亚洲天堂网| 午夜精品123| 伊人性伊人情综合网| 国产精品久久午夜| 久久影院午夜论| 精品国产青草久久久久福利| 在线综合+亚洲+欧美中文字幕| 在线观看不卡视频| 色8久久精品久久久久久蜜| 成人av在线资源网| 成人av网在线| 成人高清在线视频| 岛国精品一区二区| 高清av一区二区| 成人综合激情网| 99久久久国产精品免费蜜臀| 国产91对白在线观看九色| 国产乱子伦视频一区二区三区| 裸体歌舞表演一区二区| 蜜臀久久久久久久| 久久精品国产77777蜜臀| 久久超碰97中文字幕| 国产在线国偷精品产拍免费yy | 欧美变态口味重另类| 91精品国产综合久久精品图片| 欧美日本在线看| 日韩免费看的电影| 久久精品一区四区| 国产精品久久久久一区二区三区 | 亚洲欧洲日韩综合一区二区| 自拍偷自拍亚洲精品播放| 亚洲精品成人少妇| 午夜久久福利影院| 久久不见久久见免费视频7| 国产麻豆精品在线| 成人aa视频在线观看| 亚洲免费av网站| 亚洲一区在线电影| 日韩精品一级中文字幕精品视频免费观看 | 欧美人狂配大交3d怪物一区| 欧美一区二区三区影视| 久久久久99精品一区| 亚洲欧美aⅴ...| 日本欧美大码aⅴ在线播放| 国产一区二区三区观看| 91视频免费看| 欧美成人国产一区二区| 国产精品国产三级国产三级人妇 | 午夜电影网亚洲视频| 久久精品国产99国产| 91小宝寻花一区二区三区| 3d成人h动漫网站入口| 亚洲国产成人午夜在线一区| 亚洲国产精品成人综合色在线婷婷 | 5858s免费视频成人| 精品少妇一区二区三区视频免付费| 欧美成人一区二区三区片免费| 国产精品嫩草影院av蜜臀| 亚洲午夜视频在线| 国产不卡在线播放| 欧美欧美欧美欧美首页| 国产精品色眯眯| 男人的天堂亚洲一区|