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

📄 intro.java

📁 这是ACCP的JAVA ppt课件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            notifyAll();        }        public void reset() {            index = 0;            Dimension d = getSize();            for (int i = 0; i < director.size(); i++) {                ((Scene) director.get(i)).reset(d.width, d.height);            }        }            public void run() {            Thread me = Thread.currentThread();            while (thread == me && !isShowing() || getSize().width <= 0) {                try {                    thread.sleep(500);                } catch (InterruptedException e) { return; }            }            if (index == 0) {                reset();            }            while (thread == me) {                Scene scene = (Scene) director.get(index);                if (((Boolean) scene.participate).booleanValue()) {                    repaint();                    try {                        thread.sleep(sleepAmt);                    } catch (InterruptedException e) { break; }                    if (scene.index > scene.length) {                        scene.pause(thread);                        if (++index >= director.size()) {                            reset();                        }                    }                } else {                   if (++index >= director.size()) {                        reset();                   }                }            }            thread = null;        }        /**         * Part is a piece of the scene.  Classes must implement Part         * inorder to participate in a scene.         */        interface Part {            public void reset(int newwidth, int newheight);            public void step(int w, int h);            public void render(int w, int h, Graphics2D g2);            public int getBegin();            public int getEnd();        }        /**         * Director is the holder of the scenes, their names & pause amounts         * between scenes.         */        static class Director extends Vector {            GradientPaint gp = new GradientPaint(0,40,blue,38,2,black);            Font f1 = new Font("serif", Font.PLAIN, 200);            Font f2 = new Font("serif", Font.PLAIN, 120);            Font f3 = new Font("serif", Font.PLAIN, 72);            Object parts[][][] = {               { { "J  -  scale text on gradient", "0" },                 { new GpE(GpE.BURI, black, blue, 0, 20),                   new TxE("J", f1, TxE.SCI, yellow, 2, 20) } },               { { "2  -  scale & rotate text on gradient" , "0" },                 { new GpE(GpE.BURI, blue, black, 0, 22),                   new TxE("2", f1, TxE.RI | TxE.SCI, yellow, 2, 22) } },               { { "D  -  scale text on gradient", "0" },                 { new GpE(GpE.BURI, black, blue, 0, 20),                   new TxE("D", f1, TxE.SCI, yellow, 2, 20) } },               { { "Java2D  -  scale & rotate text on gradient", "1000" },                 { new GpE(GpE.SIH, blue, black, 0, 40),                   new TxE("Java2D", f2, TxE.RI | TxE.SCI, yellow, 0, 40) }},               { { "Previous scene dither dissolve out", "0"},                 { new DdE(0, 20, 1) }},               { { "Graphics Features", "999" },                 { new Temp(Temp.RECT, null, 0, 15),                   new Temp(Temp.IMG, java_logo, 2, 15),                   new Temp(Temp.RNA | Temp.INA, java_logo, 16, 130),                   new Features(Features.GRAPHICS, 16, 130) }},               { { "Java2D  -  texture text on gradient", "1000"},                 { new GpE(GpE.WI, blue, black, 0, 20),                   new GpE(GpE.WD, blue, black, 21, 40),                   new TpE(TpE.OI | TpE.NF, black, yellow, 4, 0, 10),                   new TpE(TpE.OD | TpE.NF, black, yellow, 4, 11, 20),                   new TpE(TpE.OI | TpE.NF | TpE.HAF, black, yellow,5,21,40),                   new TxE("Java2D", f2, 0, null, 0, 40) }},               { { "Previous scene random close out", "0"},                 { new CoE(CoE.RAND, 0, 20) } },               { { "Text Features", "999" },                 { new Temp(Temp.RECT, null, 0, 15),                   new Temp(Temp.IMG, java_logo, 2, 15),                   new Temp(Temp.RNA | Temp.INA, java_logo, 16, 130),                   new Features(Features.TEXT, 16, 130) }},               { { "Java2D  -  composite text on texture", "1000"},                 { new TpE(TpE.RI, black, gp, 40, 0, 20),                   new TpE(TpE.RD, black, gp, 40, 21, 40),                   new TpE(TpE.RI, black, gp, 40, 41, 60),                   new TxE("Java2D", f2, TxE.AC, yellow, 0, 60) }},               { { "Previous scene dither dissolve out", "0"},                 { new DdE(0, 20, 4) }},               { { "Imaging Features", "999" },                 { new Temp(Temp.RECT, null, 0, 15),                   new Temp(Temp.IMG, java_logo, 2, 15),                   new Temp(Temp.RNA | Temp.INA, java_logo, 16, 130),                   new Features(Features.IMAGES, 16, 130) }},               { { "Java2D  -  text on gradient", "1000" },                 { new GpE(GpE.SDH, blue, black, 0, 20),                   new GpE(GpE.SIH, blue, black, 21, 40),                   new GpE(GpE.SDH, blue, black, 41, 50),                   new GpE(GpE.INC | GpE.NF, red, yellow, 0, 50),                   new TxE("Java2D", f2, TxE.NOP, null, 0, 50) }},               { { "Previous scene ellipse close out", "0"},                 { new CoE(CoE.OVAL, 0, 20) } },               { { "Color Features", "999" },                 { new Temp(Temp.RECT, null, 0, 15),                   new Temp(Temp.IMG, java_logo, 2, 15),                   new Temp(Temp.RNA | Temp.INA, java_logo, 16, 99),                   new Features(Features.COLOR, 16, 99) }},               { { "Java2D  -  composite and rotate text on paints", "2000" },                 { new GpE(GpE.BURI, black, blue, 0, 20),                   new GpE(GpE.BURD, black, blue, 21, 30),                   new TpE(TpE.OI | TpE.HAF, black, blue, 10, 31, 40),                   new TxE("Java2D", f2, TxE.AC | TxE.RI, yellow, 0, 40) }},               { { "Previous scene subimage transform out", "0" },                 { new SiE(60, 60, 0, 40) }},               { { "CREDITS  -  transform in", "1000" },                 { new LnE(LnE.ACI | LnE.ZOOMI | LnE.RI, 0, 60),                   new TxE("CREDITS", f3, TxE.AC | TxE.SCI, Color.red,20,30),                   new TxE("CREDITS", f3, TxE.SCXD, Color.red, 31, 38),                   new TxE("CREDITS", f3, TxE.SCXI, Color.red, 39, 48),                   new TxE("CREDITS", f3, TxE.SCXD, Color.red, 49, 54),                   new TxE("CREDITS", f3, TxE.SCXI, Color.red, 55, 60) }},               { { "CREDITS  -  transform out", "0" },                 { new LnE(LnE.ACD | LnE.ZOOMD | LnE.RD, 0, 45),                   new TxE("CREDITS", f3, 0, Color.red, 0, 9),                   new TxE("CREDITS", f3, TxE.SCD | TxE.RD, Color.red,10,30)}},               { { "Contributors", "1000" },                 { new Temp(Temp.RECT, null, 0, 30),                   new Temp(Temp.IMG, cupanim, 4, 30),                   new Temp(Temp.RNA | Temp.INA, cupanim, 31, 200),                   new Contributors(34, 200) } },            };            public Director() {                for (int i = 0; i < parts.length; i++) {                    Vector v = new Vector();                    for (int j = 0; j < parts[i][1].length; j++) {                        v.addElement(parts[i][1][j]);                    }                    addElement(new Scene(v, parts[i][0][0], parts[i][0][1]));                }            }        }                /**         * Scene is the manager of the parts.         */        static class Scene extends Object {            public Object name;            public Object participate = new Boolean(true);            public Object pauseAmt;            public Vector parts;            public int index;            public int length;            public Scene(Vector parts, Object name, Object pauseAmt) {                this.name = name;                this.parts = parts;                this.pauseAmt = pauseAmt;                for (int i = 0; i < parts.size(); i++) {                    if (((Part) parts.get(i)).getEnd() > length) {                        length = ((Part) parts.get(i)).getEnd();                    }                }            }            public void reset(int w, int h) {                index = 0;                for (int i = 0; i < parts.size(); i++) {                    ((Part) parts.get(i)).reset(w, h);                }            }            public void step(int w, int h) {                for (int i = 0; i < parts.size(); i++) {                    Part part = (Part) parts.get(i);                    if (index >= part.getBegin() && index <= part.getEnd()) {                        part.step(w, h);                    }                }            }            public void render(int w, int h, Graphics2D g2) {                for (int i = 0; i < parts.size(); i++) {                    Part part = (Part) parts.get(i);                    if (index >= part.getBegin() && index <= part.getEnd()) {                        part.render(w, h, g2);                    }                }            }            public void pause(Thread thread) {                try {                    thread.sleep(Long.parseLong((String) pauseAmt));                } catch (Exception e) { }                System.gc();            }        } // End Scene class        /**         * Text Effect.  Transformation of characters.  Clip or fill.         */        static class TxE implements Part {            static final int INC  = 1;            static final int DEC  = 2;            static final int R    = 4;            // rotate            static final int RI   = R | INC;            static final int RD   = R | DEC;            static final int SC   = 8;            // scale            static final int SCI  = SC | INC;            static final int SCD  = SC | DEC;                static final int SCX  = 16;           // scale invert x            static final int SCXI = SCX | SC | INC;            static final int SCXD = SCX | SC | DEC;             static final int SCY  = 32;           // scale invert y            static final int SCYI = SCY | SC | INC;            static final int SCYD = SCY | SC | DEC;             static final int AC   = 64;           // AlphaComposite            static final int CLIP = 128;          // Clipping            static final int NOP  = 512;          // No Paint             private int beginning, ending;            private int type;            private double rIncr, sIncr;            private double sx, sy, rotate;            private Shape shapes[], txShapes[];            private int sw;            private int numRev;            private Paint paint;            public TxE(String text,                            Font font,                            int type,                            Paint paint,                           int beg,                            int end) {                this.type = type;                this.paint = paint;                this.beginning = beg;                this.ending = end;                setIncrements(2);                                char[] chars = text.toCharArray();                shapes = new Shape[chars.length];                txShapes = new Shape[chars.length];                FontRenderContext frc = new FontRenderContext(null,true,true);                TextLayout tl = new TextLayout(text, font, frc);                sw = (int) tl.getOutline(null).getBounds().getWidth();                for (int j = 0; j < chars.length; j++) {                    String s = String.valueOf(chars[j]);                    shapes[j] = new TextLayout(s, font, frc).getOutline(null);                }            }            public void setIncrements(double numRevolutions) {                this.numRev = (int) numRevolutions;                rIncr = 360.0 / ((ending - beginning) / numRevolutions);                sIncr = 1.0 / (ending - beginning);                if ((type & SCX) != 0 || (type & SCY) != 0) {                    sIncr *= 2;                }                if ((type & DEC) != 0) {                    rIncr = -rIncr;                    sIncr = -sIncr;                }            }            public void reset(int w, int h) {                if (type == SCXI) {                    sx = -1.0;  sy = 1.0;                } else if (type == SCYI) {                    sx = 1.0;  sy = -1.0;                } else {                    sx = sy = (type & DEC) != 0 ? 1.0 : 0.0;                  }                rotate = 0;            }                   public void step(int w, int h) {                        float charWidth = w/2-sw/2;                        for (int i = 0; i < shapes.length; i++) {                    AffineTransform at = new AffineTransform();                    Rectangle2D maxBounds = shapes[i].getBounds();                    at.translate(charWidth, h/2+maxBounds.getHeight()/2);                    charWidth += (float) maxBounds.getWidth() + 1;                    Shape shape = at.createTransformedShape(shapes[i]);                    Rectangle2D b1 = shape.getBounds2D();                            if ((type & R) != 0) {                        at.rotate(Math.toRadians(rotate));                     }                    if ((type & SC) != 0) {                        at.scale(sx, sy);                    }                    shape = at.createTransformedShape(shapes[i]);

⌨️ 快捷键说明

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