Skip to main content

problem with attribute declaration, operations and functions

9 replies [Last post]
mishela
Offline
Joined: 2007-08-18
Points: 0

Hello,
I was trying to run some examples from the web and also from this Forum, but I am beginning to have some problems with attribute declaration and also with functions and operations in a body of some class, by writing the code in Netbeans IDE - I am using 6.0 version.
When I write this:

public class Haluz {
attribute name: String;
}

it seems to be OK. But when I try to write this:

public class Haluz {
attribute name: String = "hello";
}

I get this output from NB:

Encountered "=" at line 4, column 28. Was expecting one of:
"order" ...
"index" ...
"inverse" ...
"*" ...
";" ...
"[" ...
"+" ...
"?" ...

I don't know what this means.. The attribute is correctly written or...?
What relates functions and operations - when I write this:

public class Haluz {
public function roll():Void {
//blaahblaah
}
}

I get this message:

No such type Void
Encountered "{" at line 4, column 32. Was expecting one of:
"*" ...
";'" ...
"[" ...
"+" ...
"?" ...

The same happens when I write some operation with a return type.
Please someone help, I don't know what to do, I can not write any program in JavaFX without using classes, operations and attributes returning some types.. I need this to make my bachelor's work this semester :(

UPDATE: I have also problem with this:

public class Haluz {
public static attribute name: String = "hello";
}

It has problem with the keyword "static" int the second line. I really don't know what's the problem...

Message was edited by: mishela

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mishela
Offline
Joined: 2007-08-18
Points: 0

Ahoj, velmi pekne dakujem za linky, zajtra sa na ne urcite pozriem. Na bakalarku mam spracovat vyhody a nevyhody pouzitia skriptovacieho jazyka a urcit jeho najlepsie uplatnenie a ako experiment potrebujem spravit dva programy - jeden v Jave a jeden v JavaFX Script a porovnat pocet riadkov kodu.. Tak sa snazim nastudovat co najviac zdrojakov a poucit sa nejako z toho. Ale ked som chcela prelozit Jimovu prvu verziu Tetrisu, neslo to ani cez prikazovy riadok, ani cez nastroj Build v Netbeanse. Stale hlasi nejake chyby, tak uz neviem co s tym.. Netbeans nemusim nutne pouzivat, ja ho vyuzivam vacsinou ako kontrolu toho co pisem rovnako ako pomocnika, ale ulahcuje mi to pracu a ked mi tam vyhadzuje stale nejake chyby tak sa potom velmi tazko hlada kde je chyba a kompilator este nie je az tak dobre vypracovany aby sa dalo hned na prvy pohlad pochopit kde je chyba.. Ak mozes prosim ta ozvi sa mi na e-mail alebo na icq, lepsie sa mi bude rozpravat s niekym kto ovlada moju rec :) icq: 201901848 e-mail: misiksik@yahoo.com
Dakujem..

Sorry y'all for speaking in Slovak language :) And Jiri is right, Jim's very good tutor ;)

alexsch
Offline
Joined: 2007-07-12
Points: 0

You can install compiler version of NetBeans JavaFX Script Plugin from
http://deadlock.netbeans.org/hudson/job/Java_FX_NB_plugin_Trunk_daily

Note that NB daily builds have java assertions enabled by default. And to be able to build JavaFX Application without errors you need to disable java assertions in the etc/netbeans.conf file (replace -J-ea with -J-da) because there is a bug in the compiler.

mishela
Offline
Joined: 2007-08-18
Points: 0

Thank you very much, I tried it
But I have another problem with installing the plugins, when I add it to the downloaded tab in netbeans and click the install button, there appears this screen:
http://farm3.static.flickr.com/2074/2360943015_a587aebef7_o.jpg
Where can I get the missing modules?

Message was edited by: mishela

alexsch
Offline
Joined: 2007-07-12
Points: 0

> Thank you very much, I tried it
> But I have another problem with installing the
> plugins, when I add it to the downloaded tab in
> netbeans and click the install button, there appears
> this screen:
> http://farm3.static.flickr.com/2074/2360943015_a587aeb
> ef7_o.jpg
> Where can I get the missing modules?

I see you use NetBeans 6.0. The JavaFX Script plugin
requires NetBeans 6.1.

mishela
Offline
Joined: 2007-08-18
Points: 0

thank you very much, I'll install it :)

jim_weaver
Offline
Joined: 2007-05-18
Points: 0

The reason that you're having a problem with the newer code is that it is *compiled* JavaFX Script, not the older *interpreted*. To get up to speed on compiled JavaFX Script, please take a look at this tutorial article:
http://java.sun.com/developer/technicalArticles/scripting/javafx/ria_1/

Browsing the posts in the Compiled JavaFX Script category of my "Helping you become a JavaFXpert" weblog http://JavaFXpert.com will help as well.

Thanks,
Jim Weaver

mishela
Offline
Joined: 2007-08-18
Points: 0

Thank you very much, I did run the HelloWorld example using the command line.. But I have still problem using NetBeans.

goddard
Offline
Joined: 2007-05-14
Points: 0

Hi,

Jim is a great tutor, so try to follow his links:) But now, let's "speak" different language (sorry to Jim & others).
V NetBeans zatim vali jen interpretovany JFX, to co se snazis psat ty a s cim mas problemy je prekladany JFX, jak napsal Jim. Ten v NetBeans zatim nerozjedes. Nevim jakou verzi potrebujes pro bakalarku, ale ta prekladana momentalne zavisi na prekladaci ktery neni ani betaverze, cili je to takovy nevychytany. Jestli ten projekt musi byt v NetBeans,tak musis pouzivat interpretovanou verzi JFX. Tady jsou nejake uzitecne linky:
http://www.flomedia.de/diploma/ - diplomka o JFX
http://learnjavafx.typepad.com/ - Jimuv blog, hafo prikladu
http://weblogs.java.net/blog/joshy/ - blog Joshe Marinacciho, ma tam pekne dema v interpretovanem JFX
http://ip-89-103-132-47.karneval.cz/~goddard/ - moje skromne zacatky :)

Jiri

jim_weaver
Offline
Joined: 2007-05-18
Points: 0

Thanks Jiri!

Jim Weaver