JavaFX Trigger an action while a button is pressed -


I am trying to create a scroll button using an image button, which should scroll some images when pressed . I tried to do this with the primary bountdown property of MouseEvent, but it clears the app:

  ivbutton.onMousePressed = function (e) {while (e.primaryButtonDown) {// Scroll Stuff}  

Do you know a way to create such a button?

Thank you.

Can you link scrolling in timeline animation? After this the button can control the start of time and the stop.

For example, it is similar but it regulates the rotation of a square (you may be able to use translate transsons):

  import Javafx.scene.shape.Rectangle; Import javafx.scene.paint.color; Import javafx.animation.transition.RotateTransition; Import javafx.animation.Timeline; Import javafx.scene.control.button; Import javafx.scene.Scene; Import javafx.stage.Stage; Import javafx.animation.Interpolator; Def r = rectangle = x: 80 y: 80 height: 100 width: 100 archite: 50 arc wide: 50 filling: color .VIOLET} def rotatransition = rotateTransition {duration: 1s node: r by angle: 180 repeat count: timeline.indfinat interpolator : Interpolator. LINEAR} DEF B = Button {Text: "Click and Keep" On-Mainsed Function (E) {rotTransition.play (); }; OnMouseReleased: function (e) {rotTransition.stop (); }; }; Stage {title: "rotation" view: visible {width: 250 height: 250 material: [r, b]}}  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -