Archives for posts tagged ‘javafx’
Thursday, 2 April 2009
I was having a lot of problems getting the simplest test case below to run without throwing an odd exception:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.ext.swing.SwingTextField;
import javafx.ext.swing.SwingButton;
Stage {
title : "MyApp"
scene: Scene {
width: 200
height: [...]
Tags: javafx
Posted in javafx | No Comments »
Tuesday, 24 March 2009
Just sharing some code snippets for deserialization of JavaFX objects.
function getValueType(obj:Object,name:String):String
{
var context:FXLocal.Context=FXLocal.getContext();
var objectValue:FXLocal.ObjectValue = new FXLocal.ObjectValue(obj,context);
var cls:FXClassType = objectValue.getClassType();
var varType:FXType = cls.getVariable(name).getType();
println("{name} {varType}");
if (varType instanceof FXSequenceType)
{
[...]
Tags: javafx
Posted in Java, javafx | No Comments »
Friday, 20 March 2009
I had a Group of circles, i.e.
var circles:Circle[];
var group:Group = Group { content: [circles] };
strangely, I couldn’t get newly inserted circles to render.
It turns out that you have to bind group.content to ensure that changes in circles are reflected in group.content.
Here’s a test routine.
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.stage.*;
var lines = for (i in [1..10])
[...]
Tags: javafx
Posted in javafx | 1 Comment »
Wednesday, 18 February 2009
Having spent a few weeks experimenting with JavaFX, and creating several examples, here is an assessment of whether JavaFX succeeds in it’s objective of being a graphics DSL. Bear in mind that I am evaluating it in terms of it’s ease in being a graphics DSL – if it makes my life easier, it succeeds. [...]
Tags: javafx
Posted in javafx | 1 Comment »
Wednesday, 18 February 2009
Click on image above to launch via WebStart
Drawing rectangles is pretty straightforward in JavaFX. I decided to add a little bit of animation so that the pieces of the puzzle “fall” into place. This is done by applying ParallelTransition which combines ScaleTransition, RotateTransition and TranslateTransition.
Tags: javafx, ria
Posted in General | No Comments »
Monday, 16 February 2009
Steps:
1. Use javafxpackager to create the .jar file (it will be created in the dist directory). Make sure the dist directory is empty, or you’ll find your jar file growing bigger each time.
javafxpackager -appClass fisheye -src .
2. Launch the jar file, and don’t forget to include the path to the JavaFX libraries
java [...]
Tags: javafx
Posted in General | 1 Comment »
Friday, 13 February 2009
Here is a minimal test case illustrating how exasperating the default JavaFX Text node can be, especially when aligning text.
You’d be surprised to note that both pieces of text below are aligned using TextAlignment.CENTER.
import javafx.scene.text.*;
import javafx.scene.layout.*;
VBox
{
translateY:10
content:
[
Text {
[...]
Tags: javafx
Posted in General, Java, javafx | No Comments »
Thursday, 12 February 2009
Given the following piece of JavaFX Script
import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import java.lang.Math.sqrt;
class C extends CustomNode
{
// Test #1: Commented out
//var node: Group = Group {};
protected override function create():Node
{
return node;
[...]
Tags: javafx
Posted in Java, javafx | No Comments »
Wednesday, 4 February 2009
JavaFX gets to start on a clean slate, without burdens of compatibility with browsers. However, how well does it paint itself?
How are – say – Rectangles defined?
Is the startX based on center lines? or is it from the origin?
What about borders? Are borders painted to the bottom right of the origin?
How [...]
Tags: javafx
Posted in General, javafx | 3 Comments »
Tuesday, 3 February 2009
For java developers, JavaFX is a breath of fresh air in terms of conciseness and power. A lot more could be expressed in much less lines.
However, for a web developer, the effort involved in creating some text bounded with a rectangular box on JavaFX is considerably higher compared with HTML.
I recommend starting off with a [...]
Tags: html, javafx, ria
Posted in General | 1 Comment »
Thursday, 29 January 2009
There seems to be some misconceptions about mutability rules with JavaFX sequences (see here for example).
We can see what is going on under the hood by using the java disassembler (javap).
// seq.fx
var mylist = [1..3];
insert 4 into mylist;
compiling using javafxc seq.fx and then disassembling it with javap -c seq shows us what goes on under [...]
Tags: javafx, ria
Posted in General | No Comments »
Wednesday, 28 January 2009
I’ve been playing with JavaFX, trying to figure out how to write applications which fetch a list from a database and represent them graphically.
For example, let’s say I’ve fetched a list of numbers from the database, and I wish to represent each number like so:
where the radius becomes bigger the bigger the number is.
There are [...]
Tags: javafx, ria
Posted in General | 3 Comments »
Wednesday, 10 December 2008
JavaFX 1.0 is finally out of the gate. There are probably many Java engineers and architects who are trying to figure out this technology and see how it could apply to their existing projects. Here is my assessment. Note this applies to JavaFX 1.0.
JavaFX 1.0 is not ready as a Flash replacement in public-facing projects
While [...]
Tags: javafx, ria
Posted in Flex, Java, javafx | 8 Comments »
Thursday, 4 September 2008
Update:Looks like the post has been linked from DZone. Tell me what you think? What kind of projects would you choose Java applets over Flash or AJAX?
After all these years, Java’s applet has not seen much adoption, while Flash continue to gain mindshare. Applets suffer from slow start up times, crashing browsers, heavy resource usage. [...]
Tags: Java, javafx, jvm
Posted in .Net, Java, javafx | 5 Comments »
Wednesday, 3 September 2008
Five years ago, when prototyping some apps for PDAs, I’d never consider HTML + javascript. This is because there are enough form factor issues as well as browser incompatibilities to keep one awake all night.
Things have changed.
WebKit seems to have gained ground in the mobile space, giving compatibility a much needed shot in the [...]
Tags: Flex, javafx, ria, silverlight
Posted in .Net, WPF, javafx | No Comments »
Friday, 29 August 2008
Jan Erik calls me the “high IQ” type. Unfortunately, I think he means “impractical” and “living in an invory tower”.
The idea of a inlining JavaFX script is actually a smaller and incremental goal. It is practical and is achievable. It will allow people who don’t have the JavaFX SDK to experiment with the technology, within [...]
Tags: WPF, javafx, ria, silverlight, xforms
Posted in .Net, Java, WPF, javafx | No Comments »
Friday, 29 August 2008
Jan Erik opined insightfully about JavaFX’s prospect:
Java.net is disconnected with reality. For every guy who knows Swing/Java there are a 1000 guys who know HTML/DOM/CSS/Javascript. Silverlight is only marginally important because Microsoft controls 90 percent of the desktop marked and is the company behind C#.
JavaFX will ride the JRE in the same way AIR is [...]
Tags: javafx, ria
Posted in Java, javafx | 1 Comment »
Tuesday, 26 August 2008
Continuing with our previous example, we now create a CustomNode Coverflows, which contain 11 covers.
A new function called positiveOrZero is introduced so that the tilt angle can be negative.
A fill attribute is introduced to the Cover class and it is bound to the Rectangle.
/**
* Coverflow.fx
**/
package coverflow;
import javafx.application.*;
import javafx.animation.*;
import javafx.input.*;
import javafx.scene.geometry.*;
import javafx.scene.*;
import javafx.scene.paint.*;
import [...]
Tags: javafx, ria
Posted in Java, javafx | 2 Comments »
Monday, 25 August 2008
The JavaFX compiler supports unicode source files, just as Java compiler does. To use them you need to
make sure the source does not include the three-byte byte-order-mark
call javafxc with the -encoding parameter
javafxc -encoding UTF-8 Chinese.fx
javafx Chinese
And now for the example
import javafx.application.*;
import javafx.scene.Font;
import javafx.scene.text.Text;
import javafx.scene.paint.Color;
Frame {
title: "JavaFX Unicode Example"
width: 400 height: 300
stage: [...]
Tags: javafx, ria
Posted in Java, javafx | No Comments »
Saturday, 23 August 2008
Warning: Apple Inc apparently has a patent on this. I’m merely doing this for performance comparison purposes and for self-education only.
It’s been about 2 weeks since my first JavaFX session. My initial distaste for the YAML syntax is largely gone. I have avoided using Netbeans, as vim is sufficient. The absence of closing tags in [...]
Tags: javafx, ria
Posted in Java, Netbeans, javafx | 1 Comment »