JavaFX AnchorPane和Tab调整和擦除底层屏幕元素
回复:JavaFX Anchorpane和Tab调整和删除底层屏幕元素 读取堆栈溢出日志后- 在这里: 在这里: 我能够获得如下所示的JavaFX代码,将选项卡调整为最大值 锚烷容许尺寸;if()块起作用了。但是在else街区 执行底层窗格(主舞台的场景)被 选项卡最小化。我已经找了好几个小时,尝试了各种方法来刷新主舞台的屏幕,但是仍然没有显示所有的UI元素。我可以从程序启动时重新加载stage,但是所有的用户数据 在被擦除的屏幕上,必须保存等 我曾想过刷新、重新喷漆等,但我真的不知道在这种情况下该怎么办。就像我说的,我会彻底搜索这些信息(特别是。 各种堆栈溢出日志。) 谢谢你的评论JavaFX AnchorPane和Tab调整和擦除底层屏幕元素,java,javafx,Java,Javafx,回复:JavaFX Anchorpane和Tab调整和删除底层屏幕元素 读取堆栈溢出日志后- 在这里: 在这里: 我能够获得如下所示的JavaFX代码,将选项卡调整为最大值 锚烷容许尺寸;if()块起作用了。但是在else街区 执行底层窗格(主舞台的场景)被 选项卡最小化。我已经找了好几个小时,尝试了各种方法来刷新主舞台的屏幕,但是仍然没有显示所有的UI元素。我可以从程序启动时重新加载stage,但是所有的用户数据 在被擦除的屏幕上,必须保存等 我曾想过刷新、重新喷漆等,但我真的不知道在这种
if (mouseEvent.getClickCount() == 2) {
if (!isTabMaximized) {
TabPane tabPane = (TabPane) namespace.get("tabPane");
AnchorPane applAnchorPane =
(AnchorPane) namespace.get("applAnchorPane");
applAnchorPane.getChildren().forEach( node -> {
System.out.println("Node: " + node.getId());
});
applAnchorPane.setLeftAnchor(tabPane, 0.0d);
applAnchorPane.setTopAnchor(tabPane, 0.0d);
applAnchorPane.setRightAnchor(tabPane, 0.0d);
applAnchorPane.setBottomAnchor(tabPane, 0.0d);
applAnchorPane.getChildren().setAll(tabPane);
isTabMaximized = true;
}else {
TabPane tabPane = (TabPane) namespace.get("tabPane");
AnchorPane applAnchorPane =
(AnchorPane) namespace.get("applAnchorPane");
applAnchorPane.setLeftAnchor(tabPane, 0.0d);
applAnchorPane.setTopAnchor(tabPane, 495.0d);
applAnchorPane.setRightAnchor(tabPane, 0.0d);
applAnchorPane.setBottomAnchor(tabPane, 0.0d);
//not used commented out -->
// applAnchorPane.getChildren().setAll(tabPane);
isTabMaximized = false;
applAnchorPane.toBack();
applAnchorPane.getChildren().forEach( node -> {
node.toFront();
System.out.println("Node: " + node.getId());
node.setVisible(true);
});
}
}
if()中println()的我的控制台输出: 节点:mainFlowPane else中println()的我的控制台输出: 节点:选项卡窗格 我的fxml具有以下结构(在选项卡窗格之前): 锚烷 FlowPane-命名为mainFlowPane
- HBox-包含在FlowPane中
- GridPane-包含在FlowPane中
- TabPane-包含在FlowPane中,名为TabPane
- TabPane-包含在FlowPane中,名为TabPane
我发现我从FlowPane的HBox和GridPane中省略了fx:id: 一旦我添加了这些,异常就会消失。现在,我的输出如下: jfx项目运行: 执行 C:\NetBeans\workspace8\u 0\WordCounterFXApp\dist\run923058183\WordCounterFXApp.jar 使用平台C:\Program Files\Java\jdk1.8.0\u 101\jre/bin/Java 最大化选项卡窗格之前-节点:ApplanCorpane 最大化选项卡窗格之前-节点:mainFlowPane 选项卡窗格最大化之前-节点:FlowPaneBox 选项卡窗格最大化之前-节点:flowPaneGridPane 在TabPane最大化之前-节点:TabPane 最小化选项卡窗格后-节点:ApplanCorpane 最小化TabPane后-节点:TabPane 最小化选项卡窗格后-节点:mainFlowPane 最小化选项卡窗格后-节点:FlowPaneBox 最小化选项卡窗格后-节点:flowPaneGridPane 删除目录 C:\NetBeans\workspace8\u 0\WordCounterFXApp\dist\run923058183 jfxsa运行: 生成成功(总时间:10秒) 此打印输出显示已推送FlowPane及其子节点 在选项卡窗格下面 所以,这可能会说明发生了什么。流程窗格可能位于 可见区域。在这一点上,我不知道如何修复它,但
2016年10月26日 要结束此调试练习 问题是:JavaFX AnchorPane和Tab调整和删除底层屏幕元素 分析:在TabPane最小化上,javafxui不呈现我的流程窗格 正确使用其3个结构节点: 锚烷 FlowPane-命名为mainFlowPane
- HBox-包含在FlowPane中
- GridPane-包含在FlowPane中
- TabPane-包含在FlowPane中,名为TabPane
- TabPane-包含在FlowPane中,名为TabPane
- HBox-包含在FlowPane中
- GridPane-包含在FlowPane中
多亏了Blip/StackExchange commentor,我才能够成功地调试这个问题。干得漂亮!非常感谢您的帮助。您是否收到任何错误或异常?感谢您的回复。不,我没有收到任何错误或异常。您是如何运行该程序的?你在用ide吗?我在用NetBeans,最新的开发版本。我在上个月左右更新了IDE
Node: null
Exception in thread "JavaFX Application Thread" java.util.ConcurrentModificationException
at com.sun.javafx.collections.VetoableListDecorator$VetoableIteratorDecorator.checkForComodification(VetoableListDecorator.java:714)
at com.sun.javafx.collections.VetoableListDecorator$VetoableIteratorDecorator.hasNext(VetoableListDecorator.java:682)
at java.lang.Iterable.forEach(Iterable.java:74)
at wordcounterfxapp.WordCounterFXApp$4.handle(WordCounterFXApp.java:963)
at wordcounterfxapp.WordCounterFXApp$4.handle(WordCounterFXApp.java:897)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:380)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:294)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:416)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:415)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Deleting directory C:\NetBeans\workspace8_0\WordCounterFXApp\dist\run2084430703
jfxsa-run:
BUILD SUCCESSFUL (total time: 13 seconds)