Skip to main content

Can't compile HelloWorld

4 replies [Last post]
dgront
Offline
Joined: 2008-12-04
Points: 0

Yes, I have just downloaded JavaFX SDK and started playing with it. With very little success, thou...
Can anybody help me? Here is the problem:

> uname -a
Darwin 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386

> java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

> javafxc -version
javafxc 1.0.0

The HelloWorld.fx is:
import javafx.ext.swing.SwingFrame;
import javafx.ext.swing.Button;
import javafx.ext.swing.SwingDialog;
import javafx.ext.swing.Label;

SwingFrame {
content: Button {
text: "Press me!"
action: function() {
SwingDialog {
title: "You pressed me"
content: Label{ text: "Hey, don't do that!"}
visible: true
}
}
}

visible: true
}

When I try to compile I get:
> javafxc HelloWorld.fx
HelloWorld.fx:1: cannot find symbol
symbol : class SwingFrame
location: package javafx.ext.swing
import javafx.ext.swing.SwingFrame;
^
HelloWorld.fx:2: cannot find symbol
symbol : class Button
location: package javafx.ext.swing
import javafx.ext.swing.Button;
^
HelloWorld.fx:3: cannot find symbol
symbol : class SwingDialog
location: package javafx.ext.swing
import javafx.ext.swing.SwingDialog;
^
HelloWorld.fx:4: cannot find symbol
symbol : class Label
location: package javafx.ext.swing
import javafx.ext.swing.Label;
^
HelloWorld.fx:6: cannot find symbol
symbol : class SwingFrame
location: class HelloWorld
SwingFrame {
^
HelloWorld.fx:7: Invalid assignment
content: Button {
^
HelloWorld.fx:7: cannot find symbol
symbol : class Button
location: class HelloWorld
content: Button {
^
HelloWorld.fx:8: Invalid assignment
text: "Press me!"
^
HelloWorld.fx:9: Invalid assignment
action: function() {
^
HelloWorld.fx:10: cannot find symbol
symbol : class SwingDialog
location: class HelloWorld
SwingDialog {
^
HelloWorld.fx:11: Invalid assignment
title: "You pressed me"
^
HelloWorld.fx:12: Invalid assignment
content: Label{ text: "Hey, don't do that!"}
^
HelloWorld.fx:12: cannot find symbol
symbol : class Label
location: class HelloWorld
content: Label{ text: "Hey, don't do that!"}
^
HelloWorld.fx:12: Invalid assignment
content: Label{ text: "Hey, don't do that!"}
^
HelloWorld.fx:13: Invalid assignment
visible: true
^
HelloWorld.fx:18: Invalid assignment
visible: true
^
16 errors

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mgionfriddo52
Offline
Joined: 2006-05-05
Points: 0

As many have pointed out, the classes you are trying to use don't exist in our 1.0 release. Check out our samples page:

http://javafx.com/samples/

Mike

shaman666
Offline
Joined: 2008-11-18
Points: 0

/*
* NewJavaFXStage.fx
*
* Created on 2008-12-05, 08:26:50
*/

import javafx.scene.Scene;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.ext.swing.*;

/**
* @author kris
*/

Stage {
title: "Application title"
width: 250
height: 250
scene:
Scene {
content: [Text {
font: Font {
size: 24
}
x: 50,
y: 30
content: "Witaj świecie"

},

SwingButton{
translateX: 30
translateY: 50

height: 30
width: 70
text: "przycisk"

}
]
}
}

ebresie
Offline
Joined: 2003-08-06
Points: 0

I think I have a similar problem. When trying the

"Learning Curve Journal: Part 1, Exploring JavaFX Script"
http://java.sun.com/developer/technicalArticles/scripting/javafx/lc/part1/

The SwingDialog does seem to no longer be available (at least within Netbeans). Did something change with the recent release of JavaFX?

I did what you suggested, however I think there is a difference between the original code and this code. The original code has a button that when pressed shows the text. The example code shows both the button and the text with no action handlers of any kind.

michael_heinrichs
Offline
Joined: 2007-11-15
Points: 0

I don't see the classes, which you are using in the docs. Is it possible, that you are using some outdated documentation?

Take a look at javafx.stage.Stage and javafx.scene.Scene instead.