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

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

?? tableprintdemo3.java

?? java tutotrials or beginners
?? JAVA
字號:
/* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * *   - Redistributions of source code must retain the above copyright *     notice, this list of conditions and the following disclaimer. * *   - Redistributions in binary form must reproduce the above copyright *     notice, this list of conditions and the following disclaimer in the *     documentation and/or other materials provided with the distribution. * *   - Neither the name of Sun Microsystems nor the names of its *     contributors may be used to endorse or promote products derived *     from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package misc;import javax.swing.*;import java.awt.*;import java.awt.event.*;import javax.swing.table.*;import javax.swing.event.*;import javax.swing.border.*;import java.awt.print.*;import java.text.MessageFormat;import javax.imageio.ImageIO;import java.io.IOException;import java.awt.image.BufferedImage;/** * Demonstration of how to provide a custom {@code JTable} * {@code Printable} implementation, that wraps the default * with extra decoration. This example prints the table inside * a clipboard image. * <p> * Requires the following other files: * <ul> *     <li>TablePrintDemo1.java *     <li>TablePrintDemo2.java *     <li>images/passed.png *     <li>images/failed.png *     <li>images/passed-BW.png *     <li>images/failed-BW.png *     <li>images/clipBottom.png *     <li>images/clipBottomLeft.png *     <li>images/clipBottonRight.png *     <li>images/clipLeft.png *     <li>images/clipRight.png *     <li>images/clipTop.png *     <li>images/clipTopCenter.png *     <li>images/clipTopLeft.png *     <li>images/clipTopRight.png *     <li>images/finalGrades.png * </ul> * * @author Shannon Hickey */public class TablePrintDemo3 extends TablePrintDemo2 {    /**     * Constructs an instance of the demo.     */    public TablePrintDemo3() {        setTitle("Table Print Demo 3");        /* hide these fields - our printable will render its own header/footer */        String tooltipText = "Disabled - This Demo Prints Custom Header/Footers";        headerBox.setEnabled(false);        headerBox.setSelected(false);        headerBox.setToolTipText(tooltipText);        headerField.setEnabled(false);        headerField.setText("<Custom>");        headerField.setToolTipText(tooltipText);        footerBox.setEnabled(false);        footerBox.setSelected(false);        footerBox.setToolTipText(tooltipText);        footerField.setEnabled(false);        footerField.setText("<Custom>");        footerField.setToolTipText(tooltipText);    }    /**     * Overridden to return a subclass of JTable with a custom Printable     * implementation.     */    protected JTable createTable(TableModel model) {        return new FancyPrintingJTable(model);    }    /**     * Start the application.     */    public static void main(final String[] args) {        /* Schedule for the GUI to be created and shown on the EDT */        SwingUtilities.invokeLater(new Runnable() {            public void run() {                /* Don't want bold fonts if we end up using metal */                UIManager.put("swing.boldMetal", false);                try {                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());                } catch (Exception e) {                }                new TablePrintDemo3().setVisible(true);            }        });    }    /**     * Subclass of JTable that returns a fancy printable implementation.     */    private static class FancyPrintingJTable extends JTable {                public FancyPrintingJTable(TableModel model) {            super(model);        }        /**         * Overridden to return a fancier printable, that wraps the default.         * Ignores the given header and footer. Renders its own header.         * Always uses the page number as the footer.         */        public Printable getPrintable(PrintMode printMode,                                      MessageFormat headerFormat,                                      MessageFormat footerFormat) {            MessageFormat pageNumber = new MessageFormat("- {0} -");            /* Fetch the default printable */            Printable delegate = super.getPrintable(printMode, null, pageNumber);            /* Return a fancy printable that wraps the default */            return new FancyPrintable(delegate);        }    }    /**     * A custom Printable implementation that wraps another printable and     * decorates the output by placing the table inside an image of a clipboard.     */    private static class FancyPrintable implements Printable {        /* The Printable to wrap */        private Printable delegate;        /* Images used to assemble a clipboard image around the painted table */        private BufferedImage clipTopLeft;        private BufferedImage clipTop;        private BufferedImage clipTopCenter;        private BufferedImage clipTopRight;        private BufferedImage clipBottomLeft;        private BufferedImage clipBottom;        private BufferedImage clipBottomRight;        private BufferedImage clipLeft;        private BufferedImage clipRight;                /* Image with text saying "Final Grades..." */        private BufferedImage finalGrades;        /* Whether or not the images loaded successfully */        boolean imagesLoaded;        /* Load the images */        {            try {                clipTopLeft = ImageIO.read(getClass().getResource("images/clipTopLeft.png"));                clipTop = ImageIO.read(getClass().getResource("images/clipTop.png"));                clipTopCenter = ImageIO.read(getClass().getResource("images/clipTopCenter.png"));                clipTopRight = ImageIO.read(getClass().getResource("images/clipTopRight.png"));                clipBottomLeft = ImageIO.read(getClass().getResource("images/clipBottomLeft.png"));                clipBottom = ImageIO.read(getClass().getResource("images/clipBottom.png"));                clipBottomRight = ImageIO.read(getClass().getResource("images/clipBottomRight.png"));                                clipLeft = ImageIO.read(getClass().getResource("images/clipLeft.png"));                clipRight = ImageIO.read(getClass().getResource("images/clipRight.png"));                finalGrades = ImageIO.read(getClass().getResource("images/finalGrades.png"));                imagesLoaded = true;            } catch (IOException ioe) {                // can't load the image, so no clipboard                imagesLoaded = false;            }        }        /**         * Constructs a FancyPrintable to wrap the given Printable.         */        public FancyPrintable(Printable delegate) {            this.delegate = delegate;        }        /**         * Prints the delegate Printable, wrapped inside an image of a clipboard.         * Gives the wrapped printable a smaller area to print into (which substracts         * the area needed to render the clipboard image), and then prints the         * clipboard image around the outside.         */        public int print(Graphics g,                         final PageFormat pf,                         int pageIndex) throws PrinterException {            /*             * If we weren't able to load the images, we have nothing to wrap with,             * so just have the wrapped Printable do its thing, and return.             */            if (!imagesLoaded) {                return delegate.print(g, pf, pageIndex);            }            /*             * Note: Since this is just a demo, we assume that there's enough room             * on the page to render the clipboard image and the table. A more robust             * application should check first, and render only the table if there's             * not enough room.             */            /* top left of the imageable area */            int ix = (int)pf.getImageableX();            int iy = (int)pf.getImageableY();            /* width and height of the imageable area */            int iw = (int)pf.getImageableWidth();            int ih = (int)pf.getImageableHeight();            /* width of the clipboard image pieces to be painted on the left */            int leftWidth = clipLeft.getWidth();                        /* width of the clipboard image pieces to be painted on the right */            int rightWidth = clipRight.getWidth();            /* height of the clipboard image pieces to be painted on the top */            int topHeight = clipTop.getHeight();            /* height of the clipboard image pieces to be painted on the bottom */            int bottomHeight = clipBottom.getHeight();                        /* height of the final grades label */            int finalGradesHeight = finalGrades.getHeight();            /*             * First, calculate the shrunken area that we want the table to print             * into.             */            /* inset the table from the left and right images by 10 */            final int tableX = ix + leftWidth + 10;            final int tableW = iw - (leftWidth + 10) - (rightWidth + 10);            /*             * inset the table top to leave space for the top image +             * 10 pixels + the final grades label + 10 pixels.             */            final int tableY = iy + topHeight + 10 + finalGradesHeight + 10;            /* inset the table bottom by the height of the bottom image */            final int tableH = ih - (topHeight + 10) - (finalGradesHeight + 10) - bottomHeight;            /*             * Now print the table into this smaller area.             */            /* create a new page format representing the shrunken area to print the table into */            PageFormat format = new PageFormat() {                public double getImageableX() {return tableX;}                public double getImageableY() {return tableY;}                public double getImageableWidth() {return tableW;}                public double getImageableHeight() {return tableH;}            };            /*             * We'll use a copy of the graphics to print the table to. This protects             * us against changes that the delegate printable could make to the graphics             * object.             */            Graphics gCopy = g.create();            /* print the table into the shrunken area */            int retVal = delegate.print(gCopy, format, pageIndex);            /* if there's no pages left, return */            if (retVal == NO_SUCH_PAGE) {                return retVal;            }            /* dispose of the graphics copy */            gCopy.dispose();            /*             * Now that we've printed the table, assemble the clipboard image around             * the outside.             */            int leftEnd = ix + leftWidth;            int clipTopCenterStart = ix + (int)((iw - clipTopCenter.getWidth()) / 2.0f);            int clipTopCenterEnd = clipTopCenterStart + clipTopCenter.getWidth();            int rightStart = ix + iw - rightWidth;                        /* draw top left corner */            g.drawImage(clipTopLeft, ix, iy, null);                        /* stretch top from top left corner to center image */            g.drawImage(clipTop, leftEnd, iy, clipTopCenterStart - leftEnd, topHeight, null);            /* stretch top from center image to top right corner */            g.drawImage(clipTop, clipTopCenterEnd, iy, rightStart - clipTopCenterEnd, topHeight, null);            /* draw top right corner */            g.drawImage(clipTopRight, rightStart, iy, null);            /* draw top center */            g.drawImage(clipTopCenter, clipTopCenterStart, iy, null);            int finalGradesStart = ix + (int)((iw - finalGrades.getWidth()) / 2.0f);                        /* draw label */            g.drawImage(finalGrades, finalGradesStart, iy + topHeight + 10, null);            int bottomY = iy + ih - bottomHeight;            /* draw bottom left corner */            g.drawImage(clipBottomLeft, ix, bottomY, null);                        /* draw bottom right corner */            g.drawImage(clipBottomRight, rightStart, bottomY, null);                        /* stretch the bottom image from left to right */            g.drawImage(clipBottom, leftEnd, bottomY, rightStart - leftEnd, bottomHeight, null);                        /* stretch left side  from top to bottom */            g.drawImage(clipLeft, ix, iy + topHeight, leftWidth, bottomY - iy - topHeight, null);                        /* stretch right side from top to bottom */            g.drawImage(clipRight, rightStart, iy + topHeight, rightWidth, bottomY - iy - topHeight, null);            return PAGE_EXISTS;        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区精品在线视频| 麻豆成人免费电影| 中文字幕精品一区| 中文字幕第一区二区| 久久99精品国产麻豆不卡| 亚洲在线视频一区| 亚洲曰韩产成在线| 亚洲va欧美va人人爽| 亚洲国产精品精华液网站| 亚洲 欧美综合在线网络| 樱桃视频在线观看一区| 一区视频在线播放| 亚洲乱码国产乱码精品精98午夜| 一区二区三区在线免费观看| 亚洲一区二区美女| 日韩国产欧美视频| 久久国产尿小便嘘嘘尿| 国产一区二区三区四区五区美女| 国产原创一区二区| 成人在线视频首页| 91在线国产福利| 欧美怡红院视频| 日韩三级电影网址| 亚洲国产精品成人综合| 亚洲人成网站精品片在线观看| 一区二区三区在线视频观看58| 午夜精品久久久久久不卡8050| 奇米影视在线99精品| 国产乱对白刺激视频不卡| av成人动漫在线观看| 在线免费观看成人短视频| 欧美日韩黄色一区二区| 精品日韩在线观看| 国产精品久久久久7777按摩| 亚洲一区二区在线免费看| 捆绑调教一区二区三区| 高清成人在线观看| 在线观看日韩国产| 日韩午夜在线观看视频| 中文字幕av在线一区二区三区| 一区二区不卡在线视频 午夜欧美不卡在| 亚洲第一搞黄网站| 国产精选一区二区三区| 色综合久久久久久久久| 欧美一卡二卡在线观看| 中文字幕免费不卡| 日韩国产精品久久久久久亚洲| 国产精品一二三四区| 欧洲激情一区二区| 精品福利视频一区二区三区| 亚洲人成网站色在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产99久久久国产精品免费看| 色综合中文综合网| 欧美日韩激情一区二区| 精品国产一区久久| 国产精品嫩草99a| 日韩福利电影在线观看| 成人aa视频在线观看| 欧美精品在线观看一区二区| 国产欧美一区二区在线| 亚洲一区在线观看免费| 国产精品中文有码| 欧美三级电影网站| 久久精品欧美一区二区三区不卡| 中文字幕日韩精品一区| 美女视频一区在线观看| 韩国精品主播一区二区在线观看| www.视频一区| 精品日韩在线观看| 亚洲自拍都市欧美小说| 成人黄色大片在线观看| 日韩一区二区免费高清| 亚洲一区二区美女| av一二三不卡影片| 久久久久久久久99精品| 天天爽夜夜爽夜夜爽精品视频| 色哟哟精品一区| 在线免费观看日韩欧美| 国产精品久久久久永久免费观看 | 欧美亚洲综合一区| 亚洲视频资源在线| 国产成a人亚洲精| 精品国产免费久久| 麻豆精品视频在线| 制服丝袜成人动漫| 亚洲成人精品一区| 91国在线观看| 亚洲免费观看高清完整版在线观看 | 午夜一区二区三区视频| 国产成人99久久亚洲综合精品| 欧美成人a视频| 日韩精品一级二级 | 色综合久久久久久久久久久| 中文字幕第一区| 国产精品888| 欧美mv日韩mv国产网站app| 五月天一区二区三区| 欧美性猛交xxxx黑人交| 一区二区日韩av| 色天使久久综合网天天| 亚洲色图.com| 91在线一区二区三区| 国产欧美一二三区| 成人综合在线网站| 国产欧美一区二区精品性色| 粉嫩嫩av羞羞动漫久久久 | 免费视频最近日韩| 911精品国产一区二区在线| 亚洲成av人片一区二区梦乃| 欧美老肥妇做.爰bbww视频| 国产精品毛片大码女人| av在线播放不卡| 亚洲欧洲精品天堂一级 | 椎名由奈av一区二区三区| 成人理论电影网| 成人欧美一区二区三区小说| 99久久精品国产一区二区三区| 成人免费在线视频| 91激情五月电影| 婷婷国产在线综合| 精品国产自在久精品国产| 国产一区在线观看视频| 中文字幕欧美日韩一区| av中文字幕亚洲| 亚洲另类色综合网站| 91成人在线精品| 日韩精品一区第一页| 久久综合九色综合欧美98 | 九九精品一区二区| 久久久电影一区二区三区| av电影在线观看完整版一区二区| 亚洲激情成人在线| 3d动漫精品啪啪| 国产麻豆91精品| 亚洲摸摸操操av| 91精品福利在线一区二区三区| 精品一区二区三区久久久| 中文字幕国产一区二区| 欧美在线你懂得| 精品一区二区久久久| 中文字幕在线不卡视频| 精品污污网站免费看| 狠狠色狠狠色综合日日91app| 国产精品久久久久久久久果冻传媒 | 麻豆一区二区三| 日本一区二区综合亚洲| 欧洲一区二区三区免费视频| 蜜桃视频在线观看一区| 欧美国产精品久久| 欧美福利一区二区| 国产成人免费在线观看| 亚洲制服丝袜在线| 久久久91精品国产一区二区精品| 日本久久一区二区三区| 蜜臀av一区二区在线免费观看| 国产精品日产欧美久久久久| 91超碰这里只有精品国产| 国产精品一线二线三线精华| 亚洲一区二三区| 国产精品乱码一区二区三区软件| 欧美日本一区二区三区| 成人国产一区二区三区精品| 日韩黄色一级片| 国产精品国产自产拍在线| 日韩一区二区三区四区| 91美女福利视频| 日韩欧美一区二区视频| 91福利在线导航| 国产成人免费av在线| 视频一区二区三区在线| 国产精品二三区| 精品久久久久久综合日本欧美| 在线观看亚洲精品视频| 成人高清av在线| 黑人精品欧美一区二区蜜桃| 一区二区三区欧美激情| 国产欧美一区二区在线观看| 日韩一区二区免费在线电影| 欧美三级电影网站| 色婷婷亚洲综合| 岛国精品在线观看| 久久99久久99| 日本视频免费一区| 亚洲成人精品在线观看| 亚洲精品日韩综合观看成人91| 国产日韩v精品一区二区| 欧美一区二区免费视频| 99精品国产99久久久久久白柏| 精品影视av免费| 午夜精品久久久久久| 亚洲一区二区三区在线| 亚洲欧洲国产日韩| 国产日韩欧美精品在线| 精品日产卡一卡二卡麻豆| 欧美高清一级片在线| 欧美在线观看视频一区二区 | 91国偷自产一区二区三区成为亚洲经典 | 亚洲裸体在线观看| 国产精品久久久久婷婷二区次|