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

📄 currenttextareaevent.java

📁 具有不同语法高亮的编辑器实例
💻 JAVA
字号:
package org.fife.rtext;

import java.util.EventObject;


/**
 * Event that notifies when a property of the current text area changes.
 *
 * @author Robert Futrell
 * @version 0.5
 */
public class CurrentTextAreaEvent extends EventObject {

	private static final int MIN_TYPE_VALUE			= 0;
	public static final int TEXT_AREA_CHANGED		= 0;
	public static final int IS_MODIFIED_CHANGED		= 1;
	public static final int FILE_NAME_CHANGED		= 2;
	private static final int MAX_TYPE_VALUE			= 2;

	private int type;
	private Object oldValue;
	private Object newValue;


/*****************************************************************************/


	/**
	 * Constructor.
	 *
	 * @param mainView The main view whose current text area (or a property
	 *        of it) changed.
	 * @param type The type of property that changed.
	 * @param oldValue The old value of the property.
	 * @param newValue The new value of the property.
	 */
	public CurrentTextAreaEvent(AbstractMainView mainView, int type,
							Object oldValue, Object newValue) {
		super(mainView);
		if (type<MIN_TYPE_VALUE || type>MAX_TYPE_VALUE)
			throw new IllegalArgumentException("Invalid type: " + type);
		this.type = type;
		this.oldValue = oldValue;
		this.newValue = newValue;
	}


/*****************************************************************************/


	/**
	 * Returns the new value of the current text area property.
	 *
	 * @return The new value.
	 */
	public Object getNewValue() {
		return newValue;
	}


/*****************************************************************************/


	/**
	 * Returns the old value of the current text area property.
	 *
	 * @return The old value.
	 */
	public Object getOldValue() {
		return oldValue;
	}


/*****************************************************************************/


	/**
	 * Returns the main view whose current text area (or a property of it)
	 * changed.
	 *
	 * @return The main view.
	 */
	public AbstractMainView getMainView() {
		return (AbstractMainView)getSource();
	}


/*****************************************************************************/


	/**
	 * Returns the type of property that changed.  This allows you to know
	 * what type the old and new value objects are.
	 *
	 * @return The type of property that changed.
	 */
	public int getType() {
		return type;
	}


/*****************************************************************************/

}

⌨️ 快捷键说明

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