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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? scribbleprinter2.java

?? Examples From Java Examples in a Nutshell, 2nd Edition 書中的源碼
?? JAVA
字號(hào):
/* * 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.awt.print.*;import java.awt.geom.*;import javax.swing.*;import java.util.*;/**  * A "scribble" application that remembers the scribble and allows the user * to print it.  It displays a Swing API and uses the Java 1.2 printing API. * It also uses Java2D features to draw and represent the scribble. **/public class ScribblePrinter2 extends JComponent implements Printable {    Stroke linestyle = new BasicStroke(3.0f); // Draw with wide lines    GeneralPath scribble = new GeneralPath(); // Holds the scribble    public ScribblePrinter2() {	// Register event types we're interested in for scribbling	enableEvents(AWTEvent.MOUSE_EVENT_MASK |		     AWTEvent.MOUSE_MOTION_EVENT_MASK);	// Add a print button to he layout, and respond to it by printing	JButton b = new JButton("Print");	b.addActionListener(new ActionListener() {		public void actionPerformed(ActionEvent e) { printScribble(); }	    });	this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));	this.add(b);    }        /** Redraw (or print) the scribble based on stored lines */    public void paintComponent(Graphics g) {	super.paintComponent(g);   // Allow the superclass to draw itself	Graphics2D g2 = (Graphics2D) g;	g2.setStroke(linestyle);   // Specify wide lines	g2.draw(scribble);         // Draw the scribble    }        /**     * Print out the scribble.  This is the method invoked by the Print button;     * it is not part of the Printable interface     **/    public void printScribble() {	// Obtain a java.awt.print.PrinterJob  (not java.awt.PrintJob)	PrinterJob job = PrinterJob.getPrinterJob();	// Tell the PrinterJob to print us (since we implement Printable)	// using the default page layout	job.setPrintable(this, job.defaultPage());	// Display the print dialog that allows the user to set options.	// The method returns false if the user cancelled the print request	if (job.printDialog()) {	    // If not cancelled, start printing!  This will call the print()	    // method defined by the Printable interface.	    try { job.print(); }	    catch (PrinterException e) { System.err.println(e);  }	}    }    /**     * This is the method defined by the Printable interface.  It prints the     * scribble to the specified Graphics object, respecting the paper size     * and margins specified by the PageFormat.  If the specified page number     * is not page 0, it returns a code saying that printing is complete.  The     * method must be prepared to be called multiple times per printing request     **/    public int print(Graphics g, PageFormat format, int pagenum) {	// We are only one page long; reject any other page numbers	if (pagenum > 0) return Printable.NO_SUCH_PAGE;	// The Java 1.2 printing API passes us a Graphics object, but we	// can always cast it to a Graphics2D object	Graphics2D g2 = (Graphics2D) g;	// Translate to accomodate the requested top and left margins.	g2.translate(format.getImageableX(), format.getImageableY());	// Figure out how big the drawing is, and how big the page 	// (excluding margins) is	Dimension size = this.getSize();                  // Scribble size	double pageWidth = format.getImageableWidth();    // Page width	double pageHeight = format.getImageableHeight();  // Page height	// If the scribble is too wide or tall for the page, scale it down	if (size.width > pageWidth) {	    double factor = pageWidth/size.width;  // How much to scale	    g2.scale(factor, factor);              // Adjust coordinate system	    pageWidth /= factor;                   // Adjust page size up	    pageHeight /= factor;	}	if (size.height > pageHeight) {   // Do the same thing for height	    double factor = pageHeight/size.height;	    g2.scale(factor, factor);	    pageWidth /= factor;	    pageHeight /= factor;	}	// Now we know the scribble will fit on the page.  Center it by	// translating as necessary.	g2.translate((pageWidth-size.width)/2,(pageHeight-size.height)/2);	// Draw a line around the outside of the drawing area	g2.drawRect(-1, -1, size.width+2, size.height+2);		// Set a clipping region so the scribbles don't go out of bounds	g2.setClip(0, 0, size.width, size.height);	// Finally, print the component by calling the paintComponent() method.	// Or, call paint() to paint the component, its background, border, and	// children, including the Print JButton	this.paintComponent(g);	// Tell the PrinterJob that the page number was valid	return Printable.PAGE_EXISTS;    }        /** Called when the user clicks to begin a scribble */    public void processMouseEvent(MouseEvent e) {	if (e.getID() == MouseEvent.MOUSE_PRESSED) {	    scribble.moveTo(e.getX(), e.getY());  // Start a new line 	}	else super.processMouseEvent(e);    }        /** Called when the the user drags the mouse: does the scribbling */    public void processMouseMotionEvent(MouseEvent e) {	if (e.getID() == MouseEvent.MOUSE_DRAGGED) {	    scribble.lineTo(e.getX(), e.getY());  // Add a line to the scribble	    repaint();  // Redraw the whole scribble. Clean but a little slow	}	else super.processMouseMotionEvent(e);    }        /** The main method.  Create a ScribblePrinter2 object and away we go! */    public static void main(String[] args) {	JFrame frame = new JFrame("ScribblePrinter2");	ScribblePrinter2 s = new ScribblePrinter2();	frame.getContentPane().add(s, BorderLayout.CENTER);	frame.setSize(400, 400);	frame.setVisible(true);    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
1000部国产精品成人观看| 色欧美日韩亚洲| 日韩欧美卡一卡二| 一二三区精品福利视频| 国产精品911| 精品毛片乱码1区2区3区| 日本三级亚洲精品| 欧美人xxxx| 日韩黄色在线观看| 884aa四虎影成人精品一区| 亚洲精品你懂的| 欧美综合亚洲图片综合区| 亚洲精品伦理在线| 日本福利一区二区| 亚洲午夜久久久| 成人精品亚洲人成在线| 久久人人97超碰com| 久久电影网站中文字幕| 日韩免费一区二区三区在线播放| 青青国产91久久久久久| 日韩欧美一区二区免费| 国内成人自拍视频| 国产日韩一级二级三级| 成人av集中营| 亚洲美腿欧美偷拍| 欧美无砖专区一中文字| 午夜视频在线观看一区二区 | 在线观看日韩高清av| 亚洲精品成人少妇| 欧美肥妇free| 久久av资源站| 国产精品乱码人人做人人爱 | 欧美激情中文不卡| 色噜噜狠狠成人中文综合| 中文字幕制服丝袜成人av | 欧美亚洲国产bt| 天堂成人免费av电影一区| 91精品国产麻豆| 国产成人精品网址| 一区二区三区资源| 欧美精品日韩精品| 国产99精品国产| 亚洲精品国产成人久久av盗摄| 欧美精品久久99久久在免费线 | 欧美日韩亚洲综合| 久国产精品韩国三级视频| 日韩视频免费观看高清在线视频| 精品亚洲国内自在自线福利| 欧美激情一二三区| 欧美午夜视频网站| 国模冰冰炮一区二区| 中文字幕一区二区三区四区不卡 | 日韩欧美另类在线| av电影在线观看完整版一区二区| 亚洲在线视频免费观看| 日韩欧美在线不卡| 91玉足脚交白嫩脚丫在线播放| 天堂av在线一区| 国产精品人成在线观看免费| 3751色影院一区二区三区| 久久99这里只有精品| 亚洲精品va在线观看| 精品国产免费一区二区三区香蕉| 91亚洲精品久久久蜜桃| 国产福利一区二区三区视频| 一区二区三区毛片| 欧美韩国日本综合| 91精品国产美女浴室洗澡无遮挡| 91在线观看美女| 风流少妇一区二区| 另类小说视频一区二区| 亚洲国产综合色| 国产精品福利av| 久久综合一区二区| 制服视频三区第一页精品| aaa亚洲精品一二三区| 激情成人综合网| 日本伊人色综合网| 亚洲人成人一区二区在线观看| 久久久不卡网国产精品一区| 欧美一区二区免费观在线| 色综合天天综合网天天看片| 国产老肥熟一区二区三区| 免费高清视频精品| 亚洲午夜免费电影| 日韩码欧中文字| 国产精品系列在线| 国产亚洲综合av| 久久久噜噜噜久久中文字幕色伊伊 | 久久五月婷婷丁香社区| 日韩精品中文字幕在线一区| 欧美精品 国产精品| 欧美日韩五月天| 色菇凉天天综合网| 91视频免费播放| 99国产精品久久久久久久久久| 国产精品系列在线观看| 激情综合网最新| 天堂va蜜桃一区二区三区漫画版| 香蕉久久夜色精品国产使用方法 | 欧洲一区二区av| 欧美在线一区二区三区| 91久久奴性调教| 在线观看日韩国产| 欧美日韩国产另类一区| 欧美日韩高清一区二区| 欧美另类久久久品| 91精品蜜臀在线一区尤物| 欧美视频在线观看一区| 欧美另类变人与禽xxxxx| 日韩欧美一二三四区| 欧美电影免费观看高清完整版在| 日韩欧美在线1卡| 久久新电视剧免费观看| 国产精品美女一区二区在线观看| 国产精品美女一区二区三区 | 日韩三级免费观看| 日韩精品一区在线| 国产精品人妖ts系列视频| 欧美高清在线一区二区| 亚洲你懂的在线视频| 无码av中文一区二区三区桃花岛| 毛片不卡一区二区| 国产呦萝稀缺另类资源| 91网址在线看| 国产.欧美.日韩| 国产电影精品久久禁18| 欧美色精品天天在线观看视频| 69堂亚洲精品首页| 久久蜜桃一区二区| 国产精品国产三级国产| 婷婷久久综合九色国产成人| 国产一区二区三区四区五区入口| 97精品超碰一区二区三区| 欧美日韩mp4| 国产日韩av一区二区| 亚洲综合成人在线| 黄一区二区三区| 一本久久综合亚洲鲁鲁五月天| 欧美日韩中文字幕一区| 精品电影一区二区| 亚洲天堂久久久久久久| 午夜成人免费电影| 波多野结衣精品在线| 欧美乱熟臀69xxxxxx| 国产欧美一区二区精品婷婷| 性感美女久久精品| 国产91对白在线观看九色| 欧美丰满嫩嫩电影| 亚洲另类在线视频| 国产精品一区二区久久不卡 | 日韩电影在线观看电影| 成人av一区二区三区| 日韩午夜精品视频| 亚洲黄色免费电影| 国产v日产∨综合v精品视频| 国产高清久久久| 91麻豆精品国产91久久久久| 国产精品久久久久影院色老大| 亚洲高清视频中文字幕| 日韩av一区二区在线影视| 国产一区二区剧情av在线| 99精品视频在线观看| 久久久欧美精品sm网站| 青青草原综合久久大伊人精品 | 天天免费综合色| 91视频xxxx| 国产精品日韩成人| 国产电影一区在线| 精品国产区一区| 蜜臀av亚洲一区中文字幕| 一本到高清视频免费精品| 中文一区二区在线观看| 国产一区在线观看视频| 宅男在线国产精品| 亚洲资源在线观看| 欧美日韩在线播放| 日本一区免费视频| 国产成人午夜精品影院观看视频| 欧美一级片在线| 麻豆精品一区二区| 日韩欧美的一区| 美腿丝袜亚洲色图| 91精品国产入口在线| 首页综合国产亚洲丝袜| 欧美日韩成人在线| 无码av中文一区二区三区桃花岛| 欧美色视频在线| 亚洲午夜激情网站| 欧美高清性hdvideosex| 日一区二区三区| 91精品国产综合久久久久久| 亚洲电影第三页| 日韩无一区二区| 韩国av一区二区三区四区| 精品91自产拍在线观看一区| 国产丶欧美丶日本不卡视频| 国产亚洲一区二区在线观看| 国产不卡高清在线观看视频| 中文久久乱码一区二区|