Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088332

[TextArea] scrollTop and scrollLeft are not bindable unidirectionally, because of exception A bound value cannot be set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P5 P5
    • None
    • fx2.1, 9
    • javafx

      Exception:
      java.lang.RuntimeException: A bound value cannot be set.
      at javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:118)
      at javafx.beans.property.DoubleProperty.setValue(DoubleProperty.java:39)
      at javafx.scene.control.TextArea.setScrollTop(TextArea.java:549)
      at com.sun.javafx.scene.control.skin.TextAreaSkin$5.changed(TextAreaSkin.java:365)
      at com.sun.javafx.scene.control.skin.TextAreaSkin$5.changed(TextAreaSkin.java:362)
      at com.sun.javafx.binding.ExpressionHelper$MultipleChange.fireValueChangedEvent(ExpressionHelper.java:382)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
      at javafx.beans.property.DoublePropertyBase.fireValueChangedEvent(DoublePropertyBase.java:82)
      at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:89)
      at javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:122)
      at javafx.scene.control.ScrollPane.setVvalue(ScrollPane.java:239)
      at com.sun.javafx.scene.control.skin.TextAreaSkin$12.changed(TextAreaSkin.java:434)
      at com.sun.javafx.scene.control.skin.TextAreaSkin$12.changed(TextAreaSkin.java:429)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
      at javafx.beans.property.DoublePropertyBase.fireValueChangedEvent(DoublePropertyBase.java:82)
      at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:89)
      at javafx.beans.property.DoublePropertyBase.bind(DoublePropertyBase.java:162)
      at javafx_textarea_scrolltopleft.JavaFX_TextArea_ScrollTopLeft$1.handle(JavaFX_TextArea_ScrollTopLeft.java:41)
      at javafx_textarea_scrolltopleft.JavaFX_TextArea_ScrollTopLeft$1.handle(JavaFX_TextArea_ScrollTopLeft.java:38)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:162)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:115)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Node.fireEvent(Node.java:6035)
      at javafx.scene.control.Button.fire(Button.java:179)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:189)
      at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:326)
      at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:319)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:162)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:115)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:2893)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:2687)
      at javafx.scene.Scene$MouseHandler.access$1300(Scene.java:2653)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1279)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:1911)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:204)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:326)
      at com.sun.glass.ui.View.notifyMouse(View.java:674)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
      at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
      at java.lang.Thread.run(Thread.java:722)

      Code:
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Slider;
      import javafx.scene.control.SliderBuilder;
      import javafx.scene.control.TextArea;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      /**
       * @author alexandr_kirov
       */
      public class JavaFX_TextArea_ScrollTopLeft extends Application {


          public static void main(String[] args) {
              launch();
          }

          @Override
          public void start(Stage stage) throws Exception {
              final TextArea ta = new TextArea();
              for (int i = 0; i < 1000; i++) {
                  ta.setText(ta.getText() + " some text");
                  if (i % 10 == 0)
                      ta.setText(ta.getText() + "\n");
              }
              
              Button setBindButton = new Button("Set bind button");
              
              final Slider s1 = SliderBuilder.create().max(200).min(0).value(10).showTickLabels(true).showTickMarks(true).build();
              final Slider s2 = SliderBuilder.create().max(200).min(0).value(10).showTickLabels(true).showTickMarks(true).build();
              
              setBindButton.setOnAction(new EventHandler<ActionEvent>(){
                  @Override
                  public void handle(ActionEvent t) {
                      ta.scrollTopProperty().bind(s1.valueProperty());
                      ta.scrollLeftProperty().bind(s2.valueProperty());
                  }
              });
              
              VBox vb = new VBox(5);
              vb.getChildren().addAll(ta, setBindButton, s1, s2);
              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }
      }

      Steps to reproduce:
      Click on button "Set bind button".

            kcr Kevin Rushforth
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: