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

📄 abstractbutton.java

📁 基于eclipse的工具开发代码
💻 JAVA
字号:
package com.cownew.uidesigner.model;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;

import com.cownew.uidesigner.common.ComponentUtils;

public abstract class AbstractButton extends Component
{
	public static final String TEXT = "TEXT";

	private static IPropertyDescriptor[] descriptors = new IPropertyDescriptor[] { new TextPropertyDescriptor(
			TEXT, "Text") };

	private String text;

	public AbstractButton()
	{
		super();
		text = "";
	}

	public String getText()
	{
		return text;
	}

	public void setText(String text)
	{
		String oldValue = getText();
		this.text = text;
		this.firePropertyChange(TEXT, oldValue, text);
	}

	public IPropertyDescriptor[] getPropertyDescriptors()
	{
		IPropertyDescriptor[] sd = super.getPropertyDescriptors();
		return ComponentUtils.mergePropDesc(sd, descriptors);
	}

	public Object getPropertyValue(Object id)
	{
		Object v = super.getPropertyValue(id);
		if (v != null)
		{
			return v;
		}
		if (id.equals(TEXT))
		{
			return getText();
		}
		return null;

	}

	public void setPropertyValue(Object id, Object value)
	{
		super.setPropertyValue(id, value);
		if (id.equals(TEXT))
		{
			setText((String) value);
		}
	}
}

⌨️ 快捷键说明

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