我正在尝试创建一个表格视图来查看/编辑注册菜单选项卡

问题描述 投票:0回答:1

我在月底有最后一次到期,我失去了创建表格视图的想法。我希望它看起来像下面这样。 在此输入图片描述

仅当选择查看/编辑注册时,我才收到按钮的奇怪重复子错误。好消息是,它仍然运行并且其他一切正常。我还没有实现任何捕获输入或显示的方法,但它仍然只是骨架。

https://onlinegdb.com/ZXsegAPs7 这是我的主要代码以及所需的 Student.java、Course.java、Enrollment.java 类。

谢谢!

按“注册”->“查看/编辑注册”时,我收到以下消息。

Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Prism ES2 Error - nInitialize: glXChooseFBConfig failed
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = ButtonBarSkin$1@77240d5a[styleClass=container]
    at [email protected]/javafx.scene.Parent$3.onProposedChange(Parent.java:561)
    at [email protected]/com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:205)
    at [email protected]/javafx.scene.control.skin.ButtonBarSkin.doButtonOrderLayout(ButtonBarSkin.java:205)
    at [email protected]/javafx.scene.control.skin.ButtonBarSkin.layoutButtons(ButtonBarSkin.java:174)
    at [email protected]/javafx.scene.control.skin.ButtonBarSkin.<init>(ButtonBarSkin.java:108)
    at [email protected]/javafx.scene.control.ButtonBar.createDefaultSkin(ButtonBar.java:503)
    at [email protected]/javafx.scene.control.Control.doProcessCSS(Control.java:899)
    at [email protected]/javafx.scene.control.Control$1.doProcessCSS(Control.java:89)
    at [email protected]/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(ControlHelper.java:67)
    at [email protected]/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:146)
    at [email protected]/javafx.scene.Parent.doProcessCSS(Parent.java:1400)
    at [email protected]/javafx.scene.Parent$1.doProcessCSS(Parent.java:125)
    at [email protected]/com.sun.javafx.scene.ParentHelper.processCSSImpl(ParentHelper.java:98)
    at [email protected]/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:146)
    at [email protected]/javafx.scene.Node.processCSS(Node.java:9477)
    at [email protected]/javafx.scene.Scene.doCSSPass(Scene.java:572)
    at [email protected]/javafx.scene.Scene.preferredSize(Scene.java:1770)
    at [email protected]/javafx.scene.Scene$2.preferredSize(Scene.java:396)
    at [email protected]/com.sun.javafx.scene.SceneHelper.preferredSize(SceneHelper.java:66)
    at [email protected]/javafx.stage.Window$12.invalidated(Window.java:1163)
    at [email protected]/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
    at [email protected]/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
    at [email protected]/javafx.stage.Window.setShowing(Window.java:1239)
    at [email protected]/javafx.stage.Window.show(Window.java:1254)
    at [email protected]/javafx.stage.Stage.show(Stage.java:277)
    at [email protected]/javafx.stage.Stage.showAndWait(Stage.java:467)
    at [email protected]/javafx.scene.control.HeavyweightDialog.showAndWait(HeavyweightDialog.java:162)
    at [email protected]/javafx.scene.control.Dialog.showAndWait(Dialog.java:346)
    at Main.editEnrollmentItem(Main.java:632)
    at Main.lambda$start$17(Main.java:126)
    at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
    at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at [email protected]/javafx.event.Event.fireEvent(Event.java:198)
    at [email protected]/javafx.scene.control.MenuItem.fire(MenuItem.java:459)
    at [email protected]/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1385)
    at [email protected]/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.lambda$createChildren$12(ContextMenuContent.java:1338)
    at [email protected]/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
    at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
    at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at [email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at [email protected]/javafx.event.Event.fireEvent(Event.java:198)
    at [email protected]/javafx.scene.Scene$MouseHandler.process(Scene.java:3881)
    at [email protected]/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
    at [email protected]/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2607)
    at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
    at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
    at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
    at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
    at [email protected]/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
    at [email protected]/com.sun.glass.ui.View.notifyMouse(View.java:937)
    at [email protected]/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
    at [email protected]/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:316)
    at java.base/java.lang.Thread.run(Thread.java:833)
java javafx
1个回答
0
投票

可以解决此问题的一件事是将

Alert dialog = new Alert(Alert.AlertType.CONFIRMATION);
更改为
Dialog dialog = new Dialog();

这看起来并不完全像

Confirmation Alert
,但您可以自定义它以获得外观。

© www.soinside.com 2019 - 2024. All rights reserved.