javafx

JavaFX - reduce() function to show how to pass functions as parameters

At the moment I'm writing a JavaFX guide for Java developers. In order to show how to pass a function to another funtion i adopted the reduce() function found in Effective Java: function reduce(seq: Integer[], f: function(: Integer, : Integer): Integer, init: Integer) { var result = init; for (i ...

updating a shape in scene with a for loop using javafx

Following is a code fragment. I am updating a rectangle using a for loop when a button is pressed. This is a model for my ultimate intention of showing visualization of data model as it changes large number of times inside a for loop. It works but I see only one change. Now since I am changing the width randomly I should see large numbe...

Converting java.util.List into a JavaFX sequence

What is the most concise way of converting a java.util.List into a normal JavaFX sequence (in JavaFX)? e.g. def myList = java.util.Arrays.asList(1, 2, 3); def mySequence = ... // a sequence containing [1, 2, 3] ...

JavaFX Threading issue - GUI freezing while method call ran.

Hi everyone, I hoped someone might be able to help as I'm a little stumped. I have a javafx class which runs a user interface, which includes a button to read some text out loud. When you press it, it invokes a Java object which uses the FreeTTS java speech synth to read out loud a String, which all works fine. The problem is, when the...

Java class in JavaFX-project in Eclipse

I recently started learning JavaFX. At the moment I can't build any JavaFX project with Java class in Eclipse. For every input I get error "package does not exist" Path to JRE is set in project's properties. Same class compiles if it is Java-project (not JavaFx). What should I check in project settings or Eclipse prefferences? ...

Invalid Memory Acess for JavaFX ScrollBar on Snow-Leopard

I created the following JavaFX script, which when run, generates an Invalid memory access on Snow-Leopard. What is it about javafx.scene.control.ScrollBar that is causing a memory failure? Stage { title: "Scroll View" scene: Scene { content: [ ScrollBar { min: 0 max: 100 ...

Where can I get free JavaFx pdf books?

Hi everyone, I want to learn JavaFx. Help me by providing some useful book links. ...

Is JavaFx suitable for creating online multiplayer board/card games?

In JavaFx i can easy create animations, moving pieces etc., but as far as i see there is better to write program logic and communication in java. Worst i see at the moment is calling javafx part as a result of data incoming from server. Is there any convenient way to do it or its better to change to other technology (flex, qt?) assuming ...

Java Fx Data bind not working with File Read

Hi I am using a very simple JavaFx client to upload files. I read the file in chunks of 1 MB (using Byte Buffer) and upload using multi part POST to a PHP script. I want to update the progress bar of my client to show progress after each chunk is uploaded. The calculations for upload progress look correct but the progress bar is not up...

Has anybody use javafx on CDC J9?

Is that possible?? I mean, I have an already working project that runs in windows mobile using the J9 virtual machine for CDC. My user interface there is using AWT and it works fine and it looks OK, but been honest it doesn't take real advantage of the devices were is running... So I start reading about JavaFX and that looks really cool...

Grayscale image with colored spotlight in JavaFX

I need a way to have a gray scale image in an ImageView and on mouse moved if the cursor position is in the ImageView bounds to show a colored spotlight on the mouse position. I have created a sample to help you understand what I need. This sample negates the colors of a colored image on the onMouseMoved event. package javafxapplicati...

JavaFX loading external resources problem

I've coded small JavaFX Applet in Netbeans 6.8 IDE. Everything works fine if the applet runs on my computer. But when I put the applet (and edited JNLP files containing changed paths to server) into server, it doesn't load any data from an server text file. Paths are correct - i look at it many times - they are ok. It also doesn't load i...

using a While loop to control the value of a keyframe in a timeline in Javafx

i want to create an animation where the ball will move in one of the 4 sectors of a circle randomly.this will happen 5 times.so,i create a while loop(i<5) and call the random function.i then create an if loop and attach some x and y values according to the random fn value.i then create an timeline object inside the while loop and in the ...

JavaFX layouts question.

I am having some problem understanding layouts in JavaFX. Consider following code. Stage { title: "ListView test" scene: Scene { width: 400 height: 400 content: [ VBox { content: [ ListView { height: 200 width...

JavaFX UI freeze hang

My JavaFX app's UI freezes after consecutive times of executing webservice calls. Those process calls are asynchronous. How do I fix this problem? Is there a way to "unfreeze" the UI? Sorry for the newbie question. But I badly need anyone;'s help ...

JavaFX Datagrid

Hi All. Im in the verge of starting a new RIA development. We've been using Flex/Flash for the last 2 years but we were considering using a more OS approach so we though giving JavaFX a try since it seams the only solid option available. However after a couple of days of research we found out that there is not such thing as a datagrid f...

What are block expressions actually good for?

I just solved the first problem from Project Euler in JavaFX for the fun of it and wondered what block expressions are actually good for? Why are they superior to functions? Is it the because of the narrowed scope? Less to write? Performance? Here's the Euler example. I used a block here but I don't know if it actually makes sense // s...

Declaring variables for limited scope at the head of the for loop

In Java, you sometimes do something like this: for (int a = 1, b = 2; b < high;) { if (b % 2 == 0) { result += b; } int tmp = b; b = a + b; a = tmp; } Here, I used a for loop instead of a while loop to limit the scope of a and b. But how can I achieve this in JavaFX? The for loop doesn't seem ...

Change the text in a TextBox on button click in JavaFX

I have this easy little form in my JavaFX application. I want to use a button to change firstNameText and firstNameText. I'm not capable, I'm a newbie. I tried the code below, where is my mistake? def lastNameLabel = Label { text: "Last Name" }; def firstNameLabel = Label { text: "First Name" }; var lastNameText = TextBox { text: "Las...

Bad class file error when using Scala 2.8.0-rc1 in Javafx 1.2

When trying to import scala.Option in a javafx script, I get the following javafxc error: bad class file: scala/Option$$anonfun$orNull$1.class(scala:Option$$anonfun$orNull$1.class) undeclared type variable: A1 Please remove or make sure it appears in the correct subdirectory of the classpath. import scala.Option; ^ I am u...