【发布时间】:2018-11-09 21:40:31
【问题描述】:
请帮我解决问题。有两个 fxml 文件及其控制器:
sample.fxml, its controller ControllerMain (main window of the program)
find_win.fxml, its ControllerFind controller (modal window "text search")
在模态窗口find_win.fxml中有一个TextField用于输入搜索文本,而Find按钮,当被点击时,ControllerFind必须处理点击并调用搜索方法并在TextArea元素中高亮搜索文本sample.fxml 窗口。
<fx: include source = "sample.fxml" fx: id = "textAreaOne" />
并且ControllerFind控制器对ControllerMain的继承无助于实现解决方案-在第一种情况下,整个窗口标记完全包含在模态窗口中,在第二种情况下,java.lang.reflect.InvocationTargetException在对 TextArea 进行操作期间返回。
如何从另一个窗口对一个窗口的元素执行动作?
【问题讨论】: