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

📄 framedbarmeter.java~

📁 书籍"Java_面向事件编程"的附带光盘代码
💻 JAVA~
字号:
import objectdraw.*;import java.awt.*;// A FramedBarMeter displays a variable length rectangle on a// background framed by a distinct border.public class FramedBarMeter extends FramedDisplay{       // Space between the frame and the bar    private static final double INSET=2;        // The bar itself    private FilledRect bar;        // Create frame and bar filling a fraction of the display    public FramedBarMeter( double fraction,                           double x, double y,                           double width, double height,                           DrawingCanvas canvas )    {        super( x, y, width, height, canvas );                bar = new FilledRect( displayLeft()+INSET,                               displayTop()+INSET,                               (displayWidth() - 2*INSET) * fraction,                               displayHeight() - 2*INSET, canvas );        bar.setColor(Color.blue);    }        //  Change the fraction of the display filled by the bar    public void setFraction( double fraction ) {        bar.setWidth( (displayWidth() - 2*INSET)*fraction );    }    }

⌨️ 快捷键说明

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