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

📄 frameddisplay.java

📁 书籍"Java_面向事件编程"的附带光盘代码
💻 JAVA
字号:
import objectdraw.*;import java.awt.*;// A FramedDisplay is a composite graphic intended to serve// as a frame in which a program can display various forms// of information.public class FramedDisplay {        protected static final int BORDER = 3;    // Border thickness    private static final int ROUNDNESS = 5; // Corner roundess        // Colors used for the frame    private static final Color BORDERCOLOR = Color.gray;    private static final Color HIGHLIGHTCOLOR = Color.red;        private FilledRoundedRect body;            // The background    private FilledRoundedRect border;        // The border        // Create the display area's background and border and set    // their colors appropriately    public FramedDisplay( double x, double y,                          double width, double height,                          DrawingCanvas canvas ) {                border = new FilledRoundedRect( x, y,                                        width, height,                                        ROUNDNESS, ROUNDNESS,                                        canvas );                body = new FilledRoundedRect( x + BORDER, y + BORDER,                                      width - 2*BORDER, height - 2*BORDER,                                      ROUNDNESS, ROUNDNESS,                                      canvas );                border.setColor( BORDERCOLOR );    }        // Change the border's color to make it stand out    public void highlight(  ) {        border.setColor( HIGHLIGHTCOLOR );    }        // Restore the standard border color    public void unHighlight( ) {        border.setColor( BORDERCOLOR );    }    }

⌨️ 快捷键说明

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