integerproperty.java

来自「JAVA 数学程序库 提供常规的数值计算程序包」· Java 代码 · 共 50 行

JAVA
50
字号
package jmathlib.core.graphics.properties;import java.text.DecimalFormat;import jmathlib.core.graphics.*;public class IntegerProperty extends Property{	private int value;	public IntegerProperty(PropertySet parent, String name, int value)	{		super(parent, name);		this.value = value;	}	public Object get()	{		return new Integer(value);	}	public void set(Object val) throws PropertyException	{		if (val instanceof Number)			value = ((Number)val).intValue();		else			throw new PropertyException("invalid property value - " + val.toString());	}    public double intValue()    {        return value;    }    public double doubleValue()	{		return (double)value;	}	public float floatValue()	{		return (float)value;	}	public String toString()	{		DecimalFormat fmt = new DecimalFormat("0.0000");		return fmt.format(value);	}}

⌨️ 快捷键说明

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