javaFX中可以与java类混用,是其一大优势。其中,为判别明确的类型,常使用javaFX的逻辑运算符.
[b]instanceof[/b],
意义, Is this object of the specified type
用法, Object instanceof Type
返回, Boolean
[b]as[/b],
意义, Convert this object to the specified type
用法, Object as Type
返回, Object (of type Type)
例如有java代码:
[b]instanceof[/b],
意义, Is this object of the specified type
用法, Object instanceof Type
返回, Boolean
[b]as[/b],
意义, Convert this object to the specified type
用法, Object as Type
返回, Object (of type Type)
例如有java代码:
public interface IMyEve
{
public void foo();
}
public class CMyEveBody implements IMyEve
{
public void foo() {...}
public void dome() {...}
}
在javaFX中使用强制类型转换调用,如
var e : IMyEve=new CMyEveBody();
(e as CMyEveBody).dome();