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

📄 intro.java

📁 这是ACCP的JAVA ppt课件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                } else {                    rotate = alpha = 0;                    zoom = 0;                }                if ((type & ZOOM) == 0) {                    generatePts(w, h, 0.5);                }            }            public void step(int w, int h) {                if ((type & ZOOM) != 0) {                    generatePts(w, h, zoom += zIncr);                }                if ((type & RI) != 0 || (type & RI) != 0) {                   rotate += rIncr;                }                if ((type & ACI) != 0 || (type & ACD) != 0) {                   alpha += aIncr;                }            }            public void render(int w, int h, Graphics2D g2) {                Composite saveAC = null;                if ((type & AC) != 0 && alpha >= 0 && alpha <= 1) {                    saveAC = g2.getComposite();                    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));                }                AffineTransform saveTx = null;                if ((type & R) != 0) {                    saveTx = g2.getTransform();                    AffineTransform at = new AffineTransform();                    at.rotate(Math.toRadians(rotate), w/2, h/2);                     g2.setTransform(at);                }                Point2D p1 = new Point2D.Double(w/2, h/2);                g2.setColor(Color.yellow);                for (int i = 0; i < pts.size()-1; i++) {                    g2.draw(new Line2D.Float(p1, (Point2D) pts.get(i)));                }                if (saveTx != null) {                   g2.setTransform(saveTx);                }                if (saveAC != null) {                   g2.setComposite(saveAC);                }            }            public int getBegin() {                return beginning;            }            public int getEnd() {                return ending;            }        } // End LnE class        /**         * Template for Features & Contributors consisting of translating         * blue and red rectangles and an image going from transparent to         * opaque.         */        static class Temp implements Part {            static final int NOANIM = 1;            static final int RECT   = 2;            static final int RNA    = RECT | NOANIM;            static final int IMG    = 4;            static final int INA    = IMG | NOANIM;            private int beginning, ending;            private float alpha, aIncr;            private int type;            private Rectangle rect1, rect2;            private int x, y, xIncr, yIncr;            private Image img;            public Temp(int type, Image img, int beg, int end) {                this.type = type;                this.img = img;                this.beginning = beg;                this.ending = end;                aIncr = 0.9f / (ending - beginning);                if ((type & NOANIM) != 0) {                    alpha = 1.0f;                }             }            public void reset(int w, int h) {                rect1 = new Rectangle(8, 20, w-20, 30);                rect2 = new Rectangle(20, 8, 30, h-20);                if ((type & NOANIM) == 0) {                    alpha = 0.0f;                    xIncr = w / (ending - beginning);                    yIncr = h / (ending - beginning);                    x = w+(int)(xIncr*1.4);                    y = h+(int)(yIncr*1.4);                }            }            public void step(int w, int h) {                if ((type & NOANIM) != 0) {                   return;                }                if ((type & RECT) != 0) {                    rect1.setLocation(x-=xIncr, 20);                    rect2.setLocation(20, y-=yIncr);                }                if ((type & IMG) != 0) {                    alpha += aIncr;                }            }            public void render(int w, int h, Graphics2D g2) {                if ((type & RECT) != 0) {                    g2.setColor(blue);                    g2.fill(rect1);                    g2.setColor(red);                    g2.fill(rect2);                }                if ((type & IMG) != 0) {                    Composite saveAC = g2.getComposite();                    if (alpha >= 0 && alpha <= 1) {                        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));                    }                    g2.drawImage(img, 30, 30, null);                    g2.setComposite(saveAC);                }            }            public int getBegin() {                return beginning;            }            public int getEnd() {                return ending;            }        } // End Temp class        /**         * Features of Java2D.  Single character advancement effect.         */        static class Features implements Part {            static final int GRAPHICS = 0;            static final int TEXT = 1;            static final int IMAGES = 2;            static final int COLOR = 3;            static Font font1 = new Font("serif", Font.BOLD, 38);            static Font font2 = new Font("serif", Font.PLAIN, 24);            static FontMetrics fm1 = Surface.getMetrics(font1);            static FontMetrics fm2 = Surface.getMetrics(font2);            static String table[][] =                 {{ "Graphics", "Antialiased rendering", "Bezier paths",                     "Transforms", "Compositing", "Stroking parameters" },                 { "Text", "Extended font support",                    "Advanced text layout",  "Dynamic font loading",                   "AttributeSets for font customization" },                 { "Images", "Flexible image layouts",                    "Extended imaging operations",                     "   Convolutions, Lookup Tables",                    "RenderableImage interface"},                 { "Color", "ICC profile support", "Color conversion",                    "Arbitrary color spaces"} };            private String list[];            private int beginning, ending;            private int strH;            private int endIndex, listIndex;            private Vector v = new Vector();                       public Features(int type, int beg, int end) {                list = table[type];                this.beginning = beg;                this.ending = end;            }            public void reset(int w, int h) {                strH = (int) (fm2.getAscent()+fm2.getDescent());                endIndex = 1;                listIndex = 0;                v.clear();                v.addElement(list[listIndex].substring(0,endIndex));            }            public void step(int w, int h) {                if (listIndex < list.length) {                    if (++endIndex > list[listIndex].length()) {                        if (++listIndex < list.length) {                            endIndex = 1;                            v.addElement(list[listIndex].substring(0,endIndex));                        }                    } else {                        v.set(listIndex, list[listIndex].substring(0,endIndex));                    }                }            }            public void render(int w, int h, Graphics2D g2) {                g2.setColor(white);                g2.setFont(font1);                g2.drawString((String) v.get(0), 90, 85);                g2.setFont(font2);                for (int i = 1, y = 90; i < v.size(); i++) {                    g2.drawString((String) v.get(i), 120, y += strH);                }            }            public int getBegin() {                return beginning;            }            public int getEnd() {                return ending;            }        } // End Features class        /**         * Scrolling text of Java2D contributors.         */        static class Contributors implements Part {            static String members[] =             {                 "Brian Lichtenwalter", "Jeannette Hung",                 "Thanh Nguyen", "Jim Graham", "Jerry Evans",                 "John Raley", "Michael Peirce", "Robert Kim",                 "Jennifer Ball", "Deborah Adair", "Paul Charlton",                 "Dmitry Feld", "Gregory Stone", "Richard Blanchard",                 "Link Perry", "Phil Race", "Vincent Hardy",                 "Parry Kejriwal", "Doug Felt", "Rekha Rangarajan",                 "Paula Patel", "Michael Bundschuh", "Joe Warzecha",                 "Joey Beheler", "Aastha Bhardwaj", "Daniel Rice",                "Chris Campbell", "Shinsuke Fukuda", "Dmitri Trembovetski",                "Chet Haase", "Jennifer Godinez", "Nicholas Talian",                "Raul Vera", "Ankit Patel", "Ilya Bagrak"            };            static Font font = new Font("serif", Font.PLAIN, 26);            static FontMetrics fm = Surface.getMetrics(font);            private int beginning, ending;            private int nStrs, strH, index, yh, height;            private Vector v = new Vector();            private Vector cast = new Vector(members.length+3);            private int counter, cntMod;            private GradientPaint gp;            public Contributors(int beg, int end) {                this.beginning = beg;                this.ending = end;                java.util.Arrays.sort(members);                cast.addElement("CONTRIBUTORS");                cast.addElement(" ");                for (int i = 0; i < members.length; i++) {                    cast.addElement(members[i]);                }                cast.addElement(" "); cast.addElement(" ");                cntMod = (ending - beginning) / cast.size() - 1;            }            public void reset(int w, int h) {                v.clear();                strH = (int) (fm.getAscent()+fm.getDescent());                nStrs = (h-40)/strH + 1;                height = strH * (nStrs-1) + 48;                index = 0;                gp = new GradientPaint(0,h/2,Color.white,0,h+20,Color.black);                counter = 0;            }            public void step(int w, int h) {                if (counter++%cntMod == 0) {                    if (index < cast.size()) {                        v.addElement(cast.get(index));                    }                    if ((v.size() == nStrs || index >= cast.size()) && v.size() != 0) {                        v.removeElementAt(0);                    }                    ++index;                }            }            public void render(int w, int h, Graphics2D g2) {                g2.setPaint(gp);                g2.setFont(font);                double remainder = counter%cntMod;                double incr = 1.0-remainder/cntMod;                incr = incr == 1.0 ? 0 : incr;                int y = (int) (incr * strH);                if (index >= cast.size()) {                    y = yh + y;                 } else {                    y = yh = height - v.size() * strH + y;                }                for (int i = 0; i < v.size(); i++) {                    String s = (String) v.get(i);                    g2.drawString(s, w/2-fm.stringWidth(s)/2, y += strH);                }            }            public int getBegin() {                return beginning;            }            public int getEnd() {                return ending;            }        } // End Contributors class    } // End Surface class} // End Intro class

⌨️ 快捷键说明

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