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

📄 ch16l03.txt

📁 《Web编程专家指南》
💻 TXT
字号:
Listing 16.3 PopDial class.import java.awt.*;class PopDial extends Dial    {        public PopDial(String aName, int aLowVal, int aHighVal,                       int aTicksEvery, long aSweepTime, Color fColor){            super(aName, aLowVal, aHighVal, aTicksEvery, aSweepTime, fColor);        }        public void paint(Graphics g){            Rectangle myExtent = this.bounds();            g.drawOval(0, 0, myExtent.width, myExtent.height);            if(flash == true){                long curTime = java.lang.System.currentTimeMillis();                long millisSince = curTime - 836327000000L;                long population = millisSince / sweepTime + 265232323;                String myLabel = "U.S. Pop: " + population;                g.setColor(flashColor);                g.fillOval(0, 0, myExtent.width, myExtent.height);                g.setColor(Color.black);                g.drawString(myLabel, 0, myExtent.height / 2);                System.out.println(myLabel);                flash = false;            }else{                //convert percent done into an arc...                int arcDegrees = (int) (percent * 360);                g.fillArc(0, 0, myExtent.width, myExtent.height, 90,                          arcDegrees);            }        }    }

⌨️ 快捷键说明

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