@@ -149,16 +149,19 @@ public void update(boolean clear) {
149
149
int my = i ;
150
150
ContextMenu contextMenu = new ContextMenu ();
151
151
toAdd .addEventHandler (MouseEvent .MOUSE_CLICKED , event -> {
152
- if (event .getButton () == MouseButton .PRIMARY ) {
153
- int index = ap .get ().getCurrentIndex () - 1 ;
154
- Button button = buttons .get (index < 0 ? 0 : index );
155
- contextMenu .hide ();
156
- if (button == toAdd )
157
- return ;
158
- new Thread (() -> {
159
- ap .get ().moveToOpIndex (my );
160
- }).start ();
161
- }
152
+ BowlerStudio .runLater (() -> {
153
+ if (event .getButton () == MouseButton .PRIMARY ) {
154
+ int index = ap .get ().getCurrentIndex () - 1 ;
155
+ Button button = buttons .get (index < 0 ? 0 : index );
156
+ contextMenu .hide ();
157
+ if (button == toAdd )
158
+ return ;
159
+ new Thread (() -> {
160
+ ap .get ().moveToOpIndex (my );
161
+ }).start ();
162
+ }
163
+ });
164
+
162
165
});
163
166
File f = ap .get ().getTimelineImageFile (i - 1 );
164
167
Image image = new Image (f .toURI ().toString ());
@@ -196,19 +199,22 @@ public void update(boolean clear) {
196
199
197
200
// Add event handler for right-click
198
201
toAdd .addEventHandler (MouseEvent .MOUSE_CLICKED , event -> {
199
- if (event .getButton () == MouseButton .SECONDARY ) {
200
- // Show context menu where the mouse was clicked
201
- contextMenu .show (toAdd , event .getScreenX (), event .getScreenY ());
202
- new Thread (()->{
203
- try {
204
- Thread .sleep (3000 );
205
- } catch (InterruptedException e ) {
206
- // TODO Auto-generated catch block
207
- e .printStackTrace ();
208
- }
209
- BowlerStudio .runLater (()->contextMenu .hide ());
210
- }).start ();
211
- }
202
+ BowlerStudio .runLater (() -> {
203
+ if (event .getButton () == MouseButton .SECONDARY ) {
204
+ // Show context menu where the mouse was clicked
205
+ contextMenu .show (toAdd , event .getScreenX (), event .getScreenY ());
206
+ new Thread (() -> {
207
+ try {
208
+ Thread .sleep (3000 );
209
+ } catch (InterruptedException e ) {
210
+ // TODO Auto-generated catch block
211
+ e .printStackTrace ();
212
+ }
213
+ BowlerStudio .runLater (() -> contextMenu .hide ());
214
+ }).start ();
215
+ }
216
+ });
217
+
212
218
});
213
219
// toAdd.addEventHandler(MouseEvent.MOUSE_ENTERED, ex -> {
214
220
// contextMenu.hide();
0 commit comments