indexbeanlistener.java

来自「java模式设计」· Java 代码 · 共 33 行

JAVA
33
字号
//spackage beans;

import java.beans.*;

public class IndexBeanListener implements VetoableChangeListener
{

	public void vetoableChange(PropertyChangeEvent ve)throws PropertyVetoException 
	{
		Object temp=ve.getNewValue();	        
	    if(temp instanceof String)
		{
			String t=(String)temp;
			if(t.equals("tmd"))
			{
			    System.out.println("不能说脏话");
			    throw new PropertyVetoException("脏话",ve);
			}
		}
		else
		{
			String[]tv=(String[])temp;
		    for(int cn=0;cn<tv.length;cn++)
		    {
		       if(tv[cn].equals("tmd"))
		       {
		        	System.out.println("不能说脏话");
		        	throw new PropertyVetoException("脏话",ve);
		       }
		    }
		}
	}
}

⌨️ 快捷键说明

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