JavaFX: Bound value cannot be thrown exception

In my javafx application, I created a table view where I have some projects. If the projects are visible in the table view, the delete button must be enabled, otherwise the delete button must be disabled.

Now the problem is that when I select the project and click the delete button, it throws the next exception.

How can i solve this?

This is my table code.

tableViewProject.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Project selectedProject = tableViewProject.getSelectionModel().getSelectedItem(); if (selectedProject != null) { currentProject = selectedProject; propertyChangeSupport.firePropertyChange("projectManagerController.projectIsSelected", null, selectedProject); btn_remove_project.setDisable(false); } else { btn_remove_project.setDisable(true); } } }); 
 Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Button.disable : A bound value cannot be set. at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:140) at javafx.scene.Node.setDisable(Node.java:1543) at com.virtusa.tempo.server.ui.controllers.ProjectManagerController$3.handle(ProjectManagerController.java:131) at com.virtusa.tempo.server.ui.controllers.ProjectManagerController$3.handle(ProjectManagerController.java:124) 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.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:3471) at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3399) at javafx.scene.Scene$MouseHandler.process(Scene.java:3767) at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3486) at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2495) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:350) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:275) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$350(GlassViewEventHandler.java:385) at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$355/919089086.get(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404) at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:384) at com.sun.glass.ui.View.handleMouseEvent(View.java:555) at com.sun.glass.ui.View.notifyMouse(View.java:927) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101) at com.sun.glass.ui.win.WinApplication$$Lambda$39/1633781598.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) 
+8
source share
2 answers

You probably tie it to some property. This is a one way binding. To send information from a control, you need to change it to bindBidirectional

+10
source

I have this problem in JavaFX ImageView when it binds to a property:

. ImageViewProfile.imageProperty () bind (imageProperty);

to unbind and fix this "JavaFX: cannot throw an exception for the bound value" error, I have to unbind with:

imageViewProfile.imageProperty () untie ().

0
source

Source: https://habr.com/ru/post/1235109/


All Articles