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

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

?? graphicsexampleframe.java

?? Examples From Java Examples in a Nutshell, 2nd Edition 書中的源碼
?? JAVA
字號:
/* * 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.graphics;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import java.awt.print.*;/** * This class displays one or more GraphicsExample objects in a * Swing JFrame and a JTabbedPane */public class GraphicsExampleFrame extends JFrame {    public GraphicsExampleFrame(final GraphicsExample[] examples) {	super("GraphicsExampleFrame");	Container cpane = getContentPane();   // Set up the frame 	cpane.setLayout(new BorderLayout());	final JTabbedPane tpane = new JTabbedPane(); // And the tabbed pane 	cpane.add(tpane, BorderLayout.CENTER);	// Add a menubar	JMenuBar menubar = new JMenuBar();         // Create the menubar	this.setJMenuBar(menubar);                 // Add it to the frame	JMenu filemenu = new JMenu("File");        // Create a File menu	menubar.add(filemenu);                     // Add to the menubar	JMenuItem print = new JMenuItem("Print");  // Create a Print item	filemenu.add(print);                       // Add it to the menu	JMenuItem quit = new JMenuItem("Quit");    // Create a Quit item	filemenu.add(quit);                        // Add it to the menu	// Tell the Print menu item what to do when selected	print.addActionListener(new ActionListener() {		public void actionPerformed(ActionEvent e) {		    // Get the currently displayed example, and call 		    // the print method (defined below)		    print(examples[tpane.getSelectedIndex()]);		}	    });	// Tell the Quit menu item what to do when selected	quit.addActionListener(new ActionListener() {		public void actionPerformed(ActionEvent e) { System.exit(0); }	    });	// In addition to the Quit menu item, also handle window close events	this.addWindowListener(new WindowAdapter() {		public void windowClosing(WindowEvent e) { System.exit(0); }	    });	// Insert each of the example objects into the tabbed pane	for(int i = 0; i < examples.length; i++) {	    GraphicsExample e = examples[i];	    tpane.addTab(e.getName(), new GraphicsExamplePane(e));	}    }    /**     * This inner class is a custom Swing component that displays     * a GraphicsExample object.     */    public class GraphicsExamplePane extends JComponent {	GraphicsExample example;  // The example to display	Dimension size;           // How much space it requires		public GraphicsExamplePane(GraphicsExample example) {	    this.example = example;	    size = new Dimension(example.getWidth(), example.getHeight());	}	/** Draw the component and the example it contains */	public void paintComponent(Graphics g) {	    g.setColor(Color.white);                    // set the background	    g.fillRect(0, 0, size.width, size.height);  // to white	    g.setColor(Color.black);             // set a default drawing color	    example.draw((Graphics2D) g, this);  // ask example to draw itself	}	// These methods specify how big the component must be	public Dimension getPreferredSize() { return size; }	public Dimension getMinimumSize() { return size; }    }    /** This method is invoked by the Print menu item */    public void print(final GraphicsExample example) {	// Start off by getting a printer job to do the printing	PrinterJob job = PrinterJob.getPrinterJob();	// Wrap the example in a Printable object (defined below)	// and tell the PrinterJob that we want to print it	job.setPrintable(new PrintableExample(example));	// Display the print dialog to the user	if (job.printDialog()) {	    // If they didn't cancel it, then tell the job to start printing	    try {		job.print();	    }	    catch(PrinterException e) {		System.out.println("Couldn't print: " + e.getMessage());	    }	}    }    /**     * This inner class implements the Printable interface in order to print     * a GraphicsExample object.     **/    class PrintableExample implements Printable  {	GraphicsExample example;  // The example to print	// The constructor.  Just remember the example	public PrintableExample(GraphicsExample example) {	    this.example = example;	}	/**	 * This method is called by the PrinterJob to print the example	 **/	public int print(Graphics g, PageFormat pf, int pageIndex) {	    // Tell the PrinterJob that there is only one page	    if (pageIndex != 0) return NO_SUCH_PAGE;	    // The PrinterJob supplies us a Graphics object to draw with.	    // Anything drawn with this object will be sent to the printer.	    // The Graphics object can safely be cast to a Graphics2D object.	    Graphics2D g2 = (Graphics2D)g;	    // Translate to skip the left and top margins.	    g2.translate(pf.getImageableX(), pf.getImageableY());	    // Figure out how big the printable area is, and how big	    // the example is.	    double pageWidth = pf.getImageableWidth();	    double pageHeight = pf.getImageableHeight();	    double exampleWidth = example.getWidth();	    double exampleHeight = example.getHeight();	    // Scale the example if needed	    double scalex = 1.0, scaley = 1.0;	    if (exampleWidth > pageWidth) scalex = pageWidth/exampleWidth;	    if (exampleHeight > pageHeight) scaley = pageHeight/exampleHeight;	    double scalefactor = Math.min(scalex, scaley);	    if (scalefactor != 1) g2.scale(scalefactor, scalefactor);	    // Finally, call the draw() method of the example, passing in	    // the Graphics2D object for the printer	    example.draw(g2, GraphicsExampleFrame.this);	    // Tell the PrinterJob that we successfully printed the page	    return PAGE_EXISTS;	}    }    /**      * The main program.  Use Java reflection to load and instantiate     * the specified GraphicsExample classes, then create a     * GraphicsExampleFrame to display them.     **/    public static void main(String[] args) {	GraphicsExample[] examples = new GraphicsExample[args.length];	// Loop through the command line arguments	for(int i=0; i < args.length; i++) {	    // The class name of the requested example	    String classname = args[i];	    	    // If no package is specified, assume it is in this package	    if (classname.indexOf('.') == -1)		classname = "com.davidflanagan.examples.graphics."+args[i];	    // Try to instantiate the named GraphicsExample class	    try {		Class exampleClass = Class.forName(classname);		examples[i] = (GraphicsExample) exampleClass.newInstance();	    }	    catch (ClassNotFoundException e) {  // unknown class		System.err.println("Couldn't find example: "  + classname);		System.exit(1);	    }	    catch (ClassCastException e) {      // wrong type of class		System.err.println("Class " + classname + 				   " is not a GraphicsExample");		System.exit(1);	    }	    catch (Exception e) {  // class doesn't have a public constructor		// catch InstantiationException, IllegalAccessException		System.err.println("Couldn't instantiate example: " +				   classname);		System.exit(1);	    }	}	// Now create a window to display the examples in, and make it visible	GraphicsExampleFrame f = new GraphicsExampleFrame(examples);	f.pack();	f.setVisible(true);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费观看高清| 91免费国产视频网站| fc2成人免费人成在线观看播放| 欧美亚一区二区| 欧美韩日一区二区三区| 欧美aa在线视频| 在线一区二区三区四区| 国产精品日韩精品欧美在线| 精品一区二区在线看| 欧美日韩成人一区| 亚洲视频一区二区免费在线观看| 经典一区二区三区| 91精品国产色综合久久不卡电影| 国产精品福利影院| 国产福利精品一区二区| 精品少妇一区二区三区| 青青草97国产精品免费观看无弹窗版 | 高清av一区二区| 在线观看91av| 亚洲第一成人在线| 91麻豆福利精品推荐| 中文字幕日本乱码精品影院| 国产成人精品网址| 国产调教视频一区| 丁香激情综合国产| 国产欧美日本一区二区三区| 国产麻豆精品在线观看| 欧美va亚洲va国产综合| 日韩av一区二区在线影视| 欧美日韩免费视频| 亚洲乱码国产乱码精品精可以看| 不卡影院免费观看| **网站欧美大片在线观看| 成人激情小说网站| 亚洲天堂网中文字| 色域天天综合网| 亚洲愉拍自拍另类高清精品| 欧美在线三级电影| 亚洲一区二区黄色| 欧美一区二区国产| 国产精品99久久久久久似苏梦涵 | 91丨porny丨首页| 1024成人网| 色综合久久综合中文综合网| 夜夜爽夜夜爽精品视频| 欧美群妇大交群的观看方式| 免费在线看成人av| 亚洲午夜在线观看视频在线| 欧美高清激情brazzers| 久久综合综合久久综合| 久久午夜色播影院免费高清 | 国产精品美女视频| 一本久道中文字幕精品亚洲嫩| 亚洲色图.com| 欧美猛男超大videosgay| 国产在线视视频有精品| 国产精品午夜久久| 91久久一区二区| 欧美aa在线视频| 中文字幕第一区| 欧美亚洲一区三区| 九九视频精品免费| 亚洲黄色小视频| 久久无码av三级| 在线影院国内精品| 国产伦精品一区二区三区免费| 亚洲欧洲精品一区二区精品久久久 | 久久久不卡网国产精品二区| 94-欧美-setu| 美日韩一区二区| 日韩毛片视频在线看| 欧美一级日韩免费不卡| av电影在线观看完整版一区二区| 日韩激情一二三区| 日韩一区日韩二区| 久久只精品国产| 欧美视频日韩视频| 成熟亚洲日本毛茸茸凸凹| 三级在线观看一区二区| 中文字幕中文字幕在线一区| 日韩视频不卡中文| 91成人国产精品| 丁香天五香天堂综合| 日韩制服丝袜av| 亚洲另类在线一区| 国产日韩亚洲欧美综合| 日韩网站在线看片你懂的| 色婷婷综合久久久中文一区二区| 国模冰冰炮一区二区| 三级欧美在线一区| 亚洲一区二区三区爽爽爽爽爽 | 国产午夜精品美女毛片视频| 欧美一级搡bbbb搡bbbb| 欧美亚洲丝袜传媒另类| av网站一区二区三区| 国产一区二区三区综合| 首页亚洲欧美制服丝腿| 亚洲成人资源网| 亚洲国产美女搞黄色| 亚洲欧美一区二区三区国产精品| 久久网站最新地址| 久久先锋资源网| 欧美成人精品福利| 日韩一级高清毛片| 欧美一区二区视频在线观看| 欧美日韩综合色| 欧洲色大大久久| 欧美吞精做爰啪啪高潮| 欧美在线不卡视频| 91久久人澡人人添人人爽欧美| 99久久精品免费看| 成人av电影免费在线播放| av中文字幕不卡| caoporen国产精品视频| 99精品视频在线观看免费| 不卡在线观看av| 一本一道波多野结衣一区二区| 91黄视频在线| 欧日韩精品视频| 欧美乱熟臀69xxxxxx| 7777精品伊人久久久大香线蕉的 | 国产综合色产在线精品| 亚洲综合一区二区| 五月婷婷激情综合| 亚洲mv在线观看| 美腿丝袜在线亚洲一区| 久久国产精品免费| 国产精品系列在线观看| 99久久综合精品| 欧美亚洲高清一区| 欧美人xxxx| 久久嫩草精品久久久精品| 国产欧美视频一区二区三区| 国产精品成人免费| 午夜精品久久久| 国内一区二区在线| 不卡免费追剧大全电视剧网站| av福利精品导航| 91精品国产91综合久久蜜臀| 2019国产精品| 色诱亚洲精品久久久久久| av午夜一区麻豆| 欧美日韩国产美女| 26uuu久久综合| 亚洲日本中文字幕区| 丁香一区二区三区| 欧美艳星brazzers| 欧美刺激脚交jootjob| 国产精品久久久久久妇女6080 | 亚洲精品国久久99热| 免费人成在线不卡| 成人在线视频一区| 欧美精品成人一区二区三区四区| 精品国产伦一区二区三区观看体验 | 精品对白一区国产伦| 亚洲精品欧美二区三区中文字幕| 免费观看成人av| 色综合色综合色综合色综合色综合 | 久久综合999| 亚洲尤物在线视频观看| 国产精品亚洲视频| 日韩一卡二卡三卡四卡| 国产精品久99| 久久精品久久综合| 欧美午夜免费电影| 欧美国产精品一区| 精品在线免费视频| 欧美裸体bbwbbwbbw| 国产精品国产自产拍在线| 美女一区二区三区| 欧美日韩亚洲另类| 一区二区三区不卡视频在线观看 | 欧美福利视频导航| 自拍偷自拍亚洲精品播放| 国内精品视频666| 欧美日韩一卡二卡| 一区二区国产视频| av色综合久久天堂av综合| 久久久国产精品午夜一区ai换脸| 日本欧美肥老太交大片| 欧美日韩精品欧美日韩精品一综合| 国产精品色哟哟| 成人激情小说网站| 国产拍揄自揄精品视频麻豆| 精品一区二区三区欧美| 欧美一区二区大片| 日本午夜精品视频在线观看| 欧美男人的天堂一二区| 亚洲成人福利片| 欧美亚洲动漫精品| 亚洲第一福利视频在线| 在线亚洲免费视频| 亚洲综合视频在线观看| 欧美在线999| 亚洲午夜精品17c| 欧美裸体bbwbbwbbw| 日韩福利电影在线观看| 日韩欧美中文字幕制服| 麻豆成人av在线| 久久久久久久久久久久久夜|