Skip to main content

can't create operation() for a object

4 replies [Last post]
xmpl
Offline
Joined: 2008-10-26

hi guys,

I just started with javafx and tried to set up an operation but anyway i do this, i always get an error in the prototype and in the operation itself, but don't know what i am doing wrong???

heres my code:
class WorkPack {
attribute pack: String;
attribute worker: String;
attribute status: String;
operation initialize();
}

operation WorkPack.initialize(){
var this.pack="testpack1";
var this.worker="Harald Testing";
var this.status="in progress";
}

and here is my error_log:

init:
deps-jar:
Compiling 1 source file to /home/done/NetBeansProjects/test/build/classes

/home/done/NetBeansProjects/test/src/test/gridPanel.fx:16: Sorry, I was trying to understand a class declaration but I got confused when I saw 'operation' which is an identifier.
Perhaps you are missing a '}'.
operation initialize();

/home/done/NetBeansProjects/test/src/test/gridPanel.fx:17: Sorry, I was trying to understand the module contents but I got confused when I saw '}'.
}

/home/done/NetBeansProjects/test/src/test/gridPanel.fx:19: Sorry, I was trying to understand the module contents but I got confused when I saw 'WorkPack' which is an identifier.
operation WorkPack.initialize(){

3 errors
BUILD FAILED (total time: 1 second)

I tried this on two different machines but the result is the same, could a configuration error be the reason for that issue??

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
shagus
Offline
Joined: 2007-05-10

Hi, you are using old JavaFX syntax. Please take a look at the docs.
http://openjfx.java.sun.com/current-build/doc/reference/JavaFX-Language....

xmpl
Offline
Joined: 2008-10-26

thx for the hint, does that mean, that in the "new" java syntax the "operation"-keyword isnt used?

alexsch
Offline
Joined: 2007-07-12

> thx for the hint, does that mean, that in the "new"
> java syntax the "operation"-keyword isnt used?

Yes. The only [b]function [/b] keyword is used now:

[code]
class WorkPack {

public attribute pack: String;
public attribute worker: String;
public attribute status: String;

function initialize(){
this.pack="testpack1";
this.worker="Harald Testing";
this.status="in progress";
}
}
[/code]

xmpl
Offline
Joined: 2008-10-26

ok, thanks a lot!