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

📄 tools.java

📁 这是ACCP的JAVA ppt课件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                setPreferredSize(new Dimension(200,38));            } else {                setPreferredSize(new Dimension(200,6));            }            toolbarPanel.setVisible(isExpanded);            if (sliderPanel != null) {                sliderPanel.setVisible(isExpanded);            }            getParent().validate();            toggleB.getModel().setRollover(false);            return;        }        if (obj.equals(printB)) {            start();            return;        }               if (obj.equals(startStopB)) {            if (startStopB.getToolTipText().equals("Stop Animation")) {                startStopB.setIcon(startIcon);                startStopB.setToolTipText("Start Animation");                surface.animating.stop();            } else {                startStopB.setIcon(stopIcon);                startStopB.setToolTipText("Stop Animation");                surface.animating.start();            }        } else if (obj.equals(aliasB)) {            if (aliasB.getToolTipText().equals("Antialiasing On")) {                aliasB.setToolTipText("Antialiasing Off");            } else {                aliasB.setToolTipText("Antialiasing On");            }            surface.setAntiAlias(aliasB.isSelected());        } else if (obj.equals(renderB)) {            if (renderB.getToolTipText().equals("Rendering Quality")) {                renderB.setToolTipText("Rendering Speed");            } else {                renderB.setToolTipText("Rendering Quality");            }            surface.setRendering(renderB.isSelected());        } else if (obj.equals(textureB)) {            Object texture = null;            if (textureB.getToolTipText().equals("Texture On")) {                textureB.setToolTipText("Texture Off");                surface.setTexture(null);                surface.clearSurface = true;            } else {                textureB.setToolTipText("Texture On");                surface.setTexture(TextureChooser.texture);            }        } else if (obj.equals(compositeB)) {            if (compositeB.getToolTipText().equals("Composite On")) {                compositeB.setToolTipText("Composite Off");            } else {                compositeB.setToolTipText("Composite On");            }            surface.setComposite(compositeB.isSelected());        } else if (obj.equals(screenCombo)) {            surface.setImageType(screenCombo.getSelectedIndex());        }        if (issueRepaint && surface.animating != null) {            if (surface.getSleepAmount() != 0) {                if (surface.animating.thread != null) {                    surface.animating.thread.interrupt();                }            }        } else if (issueRepaint) {            surface.repaint();        }    }    public void stateChanged(ChangeEvent e) {        int value = slider.getValue();        label.setText("sleep = " + String.valueOf(value) + " ms");        label.repaint();        surface.setSleepAmount(value);    }    public void mouseClicked(MouseEvent e) {    }    public void mousePressed(MouseEvent e) {    }    public void mouseReleased(MouseEvent e) {    }    public void mouseEntered(MouseEvent e) {        focus = true;        bumpyIcon.start();    }    public void mouseExited(MouseEvent e) {        focus = false;        bumpyIcon.stop();    }    public void start() {        thread = new Thread(this);        thread.setPriority(Thread.MAX_PRIORITY);        thread.setName("Printing " + surface.name);        thread.start();    }    public synchronized void stop() {        thread = null;        notifyAll();    }    public void run() {        boolean stopped = false;        if (surface.animating != null && surface.animating.thread != null) {            stopped = true;            startStopB.doClick();        }        try {            PrinterJob printJob = PrinterJob.getPrinterJob();            printJob.setPrintable(surface);            boolean pDialogState = true;            PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();            if (!Java2Demo.printCB.isSelected()) {                pDialogState = printJob.printDialog(aset);            }            if (pDialogState) {                printJob.print(aset);            }        } catch (java.security.AccessControlException ace) {            String errmsg = "Applet access control exception; to allow " +                            "access to printer, run policytool and set\n" +                            "permission for \"queuePrintJob\" in " +                            "RuntimePermission.";            JOptionPane.showMessageDialog(this, errmsg, "Printer Access Error",                                          JOptionPane.ERROR_MESSAGE);        } catch (Exception ex) {            ex.printStackTrace();        }        if (stopped) {            startStopB.doClick();        }        thread = null;    }    /**     * Expand and Collapse the Tools Panel with this bumpy button.     */    static class ToggleIcon implements Icon, Runnable {        private Color topColor = new Color(153, 153, 204);        private Color shadowColor = new Color(102, 102, 153);        private Color backColor = new Color(204, 204, 255);        private Tools tools;        private Thread thread;        private Color fillColor;        public ToggleIcon(Tools tools, Color fillColor) {            this.tools = tools;            this.fillColor = fillColor;        }            public void paintIcon(Component c, Graphics g, int x, int y ) {	    int w = getIconWidth();	    int h = getIconHeight();	    g.setColor(fillColor);	    g.fillRect(0, 0, w, h);            for (; x < w-2; x+=4) {                g.setColor(Color.white);                g.fillRect(x, 1, 1, 1);                g.fillRect(x+2, 3, 1, 1);                g.setColor(shadowColor);                g.fillRect(x+1, 2, 1, 1);                g.fillRect(x+3, 4, 1, 1);            }        }        public int getIconWidth() {            return tools.getSize().width;        }        public int getIconHeight() {            return 6;        }        public void start() {            thread = new Thread(this);            thread.setPriority(Thread.MIN_PRIORITY);            thread.setName("ToggleIcon");            thread.start();        }        public synchronized void stop() {            if (thread != null) {                thread.interrupt();            }            thread = null;        }        public void run() {            try {               thread.sleep(400);            } catch (InterruptedException e) { }            if (tools.focus && thread != null) {                tools.toggleB.doClick();            }            thread = null;        }    }} // End Tools class

⌨️ 快捷键说明

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