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

📄 ledpanel.java

📁 这又是一个专家系统. 是用java写的. 初学者可看看此程序.个人觉得还不错.
💻 JAVA
字号:
/** LedPanel is an JComponent widget, written for use in the application ocrdemo. * It simulates a rectangular LED  which displays information via brightness. */public class LedPanel extends javax.swing.JComponent{    private int boundwidth, boundheight;    private int viswidth, visheight;    private float hue, sat, bright;        /** The default constructor. Creates a 40x40 LedPanel widget, with a "visible"dimension of 40x20 centered in the middle. The color is red, with 90%saturation.@returns LedPanel object     */    public LedPanel() {	this(40, 40, 40, 20, 0.01f, 0.9f);    }        /**The main constructor.@param tboundwidth The width (in pixels) of the widget.@param tboundheight The height (in pixels) of the widget.@param tviswidth The width (in pixels) of the actual light.@param tvisheight The height (in pixels) of the actual light.@param thue The hue of the LedPanel. Ranges from 0.0 (red) to 1.0 (violet)@param tsat The saturation of the LedPanel. Ranges from 0.0 (grayish) to 1.0(fully saturated).@return LedPanel object with the given properties.     */    public LedPanel(int tboundwidth, int tboundheight,    int tviswidth, int tvisheight, float thue, float tsat) {		super();	this.boundwidth = tboundwidth;	this.boundheight = tboundheight;	this.viswidth = tviswidth;	this.visheight = tvisheight;	this.hue = thue;	this.sat = tsat;	bright = 0;	//reshape(0,0,boundwidth,boundheight);	setPreferredSize( new java.awt.Dimension(boundwidth, boundheight) );    }        /**Sets the brightness of the LedPanel.@param tbright Brightness, ranging from 0.0 to 1.0.     */    public void setLED(double tbright) {	this.bright = (float)tbright;	repaint();    }        public void paintComponent(java.awt.Graphics g) {	g.setColor(java.awt.Color.getHSBColor(hue,sat,bright));	g.fill3DRect(((boundwidth-viswidth)/2),((boundheight-visheight)/2),	    viswidth,visheight,true);    }}

⌨️ 快捷键说明

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