What does or should "public function create(): Node"  return exactly?

Seit gegrüsst
I playing around with javafx for a project, evaluating this technology.
When I'm displaying things on the screen through "CustomNodes" I have to override the "public function create(): Node" method.
In examples found on google, there's often created a new Group or something like that and than be returned.
Why can't I just return "this"?
What does or should "public function create(): Node" return exactly? And why is this so?
thx for response
carpe noctem
livevil
Edited by: livevil on Oct 14, 2008 4:28 PM
Edited by: livevil on Oct 14, 2008 4:29 PM

"public function create(): Node" method should return a graphic
representation of the class.
For example, FunctionGraph class below draws a mathematical functiuon:
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.geometry.*;
import javafx.scene.transform.*;
import javafx.ext.swing.*;
import java.lang.Math;
import java.lang.System;
public class FunctionGraph extends CustomNode{
    attribute scale:Number = 1;
    attribute xMin: Number;
    attribute xMax: Number;
    attribute dx: Number = 1;
    attribute color: Color;
    attribute func: function(a: Number):Number;
    public function create():Node{
      var n = (xMax - xMin) / dx;
      var polyline = Polyline{ stroke: color };
      for(i in [0..n]){
        var x = xMin + i * dx;
        var y =  (this.func)(x);
        insert(   x * scale ) into polyline.points;
        insert( - y * scale ) into polyline.points;  
      return Group{ content: [ polyline] };
var w = 300;
var h = 300;
var xMin = -7;
var xMax = 7;
var dx = 0.05;
var scale = 20;
SwingFrame{
    width:  300
    height: 300
    title: "Function Graph"
    content: Canvas{
      content:  Group{
            transform: Translate.translate(w/2, h/2)
            content: FunctionGraph {
                xMin: xMin
                xMax: xMax
                scale: scale
                dx: dx
                color: Color.BLUE
                func: function(x:Number):Number{ return Math.sin(x); }               
    visible: true
}

Similar Messages

  • How do i get to know what does a standard SAP function do?

    Hi everyone,
    I'm a very new beginner level ABAP developer. Please tell me how do I know what does a standard function module do if I see it in some source code.

    go to its F1 help
    go its attributes
    observe its import and export parameters
    run the functional code through se37 with your own dummy values
    these are RnD's
    if you are not satisfied with the content then search it in sdn forums
    any way you will find about its function
    but the problem is you have to take out time

  • What does the "Home Media" in my N82 do exactly???

    Hi guys,
    i found this "Home Media" thing in my N82 and didn't know what is it all about, what does it do or how can i use it??
    i saw somwhere that you can share things from your PC to your phone or from Phone to PC or sth like that but couldn't understand a thing!!
    any help about this please, and if it does do that things how can i set it up??
    Thank you in advance
    Used a lot of S60 devices, now am with the King N82

    i thought so yeah
    i played around with it a bit and came out with the same thing, it is only for Media!!!
    but really thank you so much my friend
    Used a lot of S60 devices, now am with the King N82

  • What does it take to get a simple Return Address label from HP?

    Yes, I have a defective printer. I got the replacement printer the other day. I was told I had 15 days to return the defective printer back to HP. They gave me an e-choice card to use to buy the replacement printer online. I received the replacement printer on Thursday. Well the last few days have been a joke. I contacted online chat support and the guy told me that I would be getting an email with the return address label within 24 hours. That was Thursday and I never got it. So yesterday I talked to someone on the phone. After 15 minutes I was told I would be getting and email within 24 hours with the return address label. Well guess what that never happened. What a nightmare it has been dealing with this defective printer for the last week. I won't get into what happened before the return address label situation. What the heck do I do without a return address label? I am not paying to ship it back to HP. If I don't send the defective printer back within 15 days my credit card will get charged for the replacement printer I got. It is like pulling your hair out to get anywhere with HP. I am about sick of it.
    This question was solved.
    View Solution.

    Hey JoeSchmoe
    See the note I sent you on  this we'll make sure this gets taken care of.
    Thanks!
    DaniW
    HP Forum Admin
    --Say "Thanks" by clicking the Kudos Star in the post that helped you.
    --Please mark the post that solves your problem as "Accepted Solution"

  • What does it mean: "Calendar was created by Mail"?

    I upgraded to the latest version of iCal.  Now, when I try to input a new event, I get the message: " Calendar was created by Mail.  You can not add an event to a Mail calendar.   Does any one know what this means and what I need to do to change it so I can add events to iCal from my computer?   By the way, I sync with my iPhone and am able to add events from my Phone which then show up on my calendar on my computer.   - James

    Greetings James,
    This suggests you have a "Read Only" calendar in iCal.  Look for a calendar on the left hand side of iCal which you don't recognize and don't use.  Once you locate it you can click on it once to highlight it and then go to Edit > Delete.
    Cheers.

  • What does "saved as v.15 created by v.16.0.0" mean?

    The file info shows that:
    Created: Tuesday, January 14, 2014 at 7:00 PM
    Modified: Tuesday, January 14, 2014 at 8:36 PM
    Version: Saved As v.15 Created by v.16.0.0
    There are some other files have
    version: Saved As v.16 Created by v.16.0.0
    What do "version info" mean?

    seektruth,
    It means that the document was created using CS6, then downsaved as/to CS5.

  • What does it mean to create a disk image?

    I had an option to "create disk image" of an external drive Im using for back up. What does that actually mean, to create disk image? I mean what is the puropose of it and when do I use this disk image?
    Thanks in advance, your all geniuses, or is it genieii!
    Message was edited by: tracyryan354

    A disk image is basically a file containing other files and folders.
    When you double-click it, it mounts, and appears as though it is a CD or external hard drive, allowing you to access the files.
    You can encrypt a disk image, if you want, meaning you would have to type a password to access the files that are on it.
    Good luck!
    Message was edited by: joshz

  • What does "file create new version" do

    What does the menu selection File --> Create new Version do?
    How are the selections activated (not greyed out)?
    Create iPod or iPhone Version
    Create iPad or Apple TV Version
    Create AAC Version
    Any ideas? There no mention in the tutorial.

    The first two options are for converting video into resolutions compatible with the device.
    The third one is to create new versions of audio files, The type of conversion is controlled in Preferences.
    Click on the import settings and choose the encoder and quality. the create version then may change to create mp3 version etc
    The encoders are
    AAC Encoder
    AIFF Encoder
    MP3 Encoder
    WAV Encoder

  • What does "Automatic Retrieval" do under email dow...

    Hi there
    on my nokia 6303, under my downloading settings for my email, i have various settings:
    Retrieve mode
    Retrieval amount
    Mailbox update interval
    Automatic retrieval
    I can set mailbox update interval to say 30 minutes or 1 hour or so and the phohne will check for new emails at that interval and report any new ones.
    But what does the "automatic retrieval" function do? When i set it to on or off it seems to make no difference. Does anyone know specifically how I should set this?
    many thanks
    Aroon

    no one know what this setting does?  it seems like a lot of people have it activated here.
    surely someone must have an idea how it works!

  • I'm having trouble with this line: public function initHandler(event:EVENT):void

    I'm building a simple photo gallery in Flash CS4 & I've posted the entire code below, if anyone can see the problem in this code, please let me know....thanks. This code is actually from a tutorial: http://blip.tv/file/1620128/
    The tutorial had no issues with this code so I'm wondering if its just a matter of correcting a property or setting somewhere.....
    package videocode
        import flash.display.*;
        import flash.events.*;
        import flash.net.*;
        public class videoview extends MovieClip
            public var source:*;
            public var loader:Loader;
            public var loaderIndex:Number = 1;
            public function videoview()
            loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
            addChild(loader);
            loadImage();
            public function initHandler(event:EVENT):void
                source = loader.content
                source.alpha = 0;
                source.x = videoarea_mc.x;
                source.y = videoarea_mc.y;
                addEventListener(Event.ENTER_FRAME, enterFrameHandler);
                protected function changeHandler(event:Event):void
                    loaderIndex = photoStepper.value
                    loadImage();
                protected function enterFrameHandler(event:Event):void
                    if (source.alpha <1){
                        source.alpha+= .1;
                    } else{
                        removeEventListener(Event.ENTER_FRAME,enterFrameHandler);
                public function getPath():String
                    return("images/image"+loader.Index+".jpeg")
                public function loadImage():void
                    loader.load(new URLRequest[getPath()]);

    public function initHandler(event:Event):void
    only the 'E' should be uppercase

  • Where 1 =1, Where 1 = 2, what does it mean?

    Could anyone roughly tell me what does it mean?

    Yes, create table t1 as select * from t where 1=2 will create a copy of t with no data in it. IT would take about as long to do it that was as it would to do it explicitly as:
    CREATE TABLE t1 (col1 NUMBER, col2 VARCHAR2(10));copying the column list from t. The size of the table used in the select is not material because Oracle is smart enough to know that 1=2 will not return any rows from the selected table so will not even try.
    Any equality condition of constants will work the same as 1 = 1 e.g. 'fred' = 'fred' or 1999545678342 = 1999545678342. Similarly, any inequlity predicate will work the same as 1=2 e.g. 'fred = 'barney' or 1999545678342 = 66
    John

  • What does mdadm's sync_action check do?

    Obviously, it checks the RAID array you run it on, but I'd like to know more specifics on what it does and does not do. For instance, through some testing and reading of docs, I've deduced that it does *not* do any kind of comparison between data (this is on a RAID-1 mirrored array). This is by design:
    RAID (be it hardware or software), assumes that if a write to a disk doesn't return an error, then the write was successful. [...] RAID cannot, and is not supposed to, guard against data corruption on the media. Therefore, it doesn't make any sense either, to purposely corrupt data (using dd for example) on a disk to see how the RAID system will handle that.
    (from https://raid.wiki.kernel.org/index.php/ … nd_testing )
    (I kind of wish that it *would* do a binary comparison, just to make me feel better... but anyway.)
    So, what *does* it do? Does it just do the equivalent of
    dd if=/dev/sdXA of=/dev/null
    dd if=/dev/sdYA of=/dev/null
    just to ensure that the drives can read those sectors? And what does it do in case the drive returns a read error? I would expect that to result in a "check failed" message somewhere, but apparently that's not always the case.
    During a check on one of my servers, the dmesg showed a bunch of read errors from the first drive, and the SMART log confirms that... but the check succeeded. And strangely, the drive now reads successfully from start to finish, and using dd and diff, I was able to confirm that the "bad" regions on that drive are now readable and binary identical to the good mirror.
    I'm guessing what happened is that if mdadm encounters a bad sector while reading, it assumes the drive will swap in one of its spare sectors, and tries to copy the data from the good drive back onto the bad sector, then retries the read of that sector -- if the drive returns a successful read, it means the bad sector was fixed, and mdadm doesn't have to treat it as a problem any more. Is that right? I can't find that in the docs anywhere, and I'd like to know for sure. (Still gonna replace the drive in the mean time.)
    ~Felix.

    oohhhhh, that makes sense. I've seen the steps that do the truncate and build indexes and such but I didn't connect that back to the physical data sources. D'uh!
    Thanks!
    -Joe

  • I keep getting an error code while trying to import a cd to my itunes: Error occurred while converting the file. The disc you are attempting to use is full. removing files and emptying the recycle bin will free up additional space.  What does this mean?

    I keep getting this error code while trying to import a cd to my itunes: "Error occurred while converting the file. The disc you are attempting to use is full. removing files and emptying the recycle bin will free up additional space."  What does this mean?

    Well it probably means exactly what it says... How much free space is there on your hard drive where the iTunes Media folder resides? I believe there is also an obscure bug that can occur when software doesn't read the true value of the free space properly, and the workaround is, perversely, to duplicate some content so that with less actual free space the software in question perceives it as more. I've no idea if iTunes is affected by such a bug.
    tt2

  • HT1491 I just purchased something and it tells me to contact iTunes support to complete the purchase? What does that mean? Please help.

    I just purchased something and it tells me to contact iTunes support to complete the purchase? What does that mean? Please help.

    It means exactly what it says.
    You need to contact itunes support to complete your purchase.

  • Problems with asynchronous(?) function call before return statement

    I have a function as following inside a class deriving from CustomNode:
    override protected function create () : Node {
                    parseContent();
                    return group;
            }parseContent() executes a HttpRequest and then a PullParser. At least that's what it should do. But actually, it doesn't. Is this because the HttpRequest is asynchronous and is "cancelled" because of the return statement? Or can't this be the problem?

    You would have to update or create the view in the finally block of the onOutput: or onInput methods within the request.
    You could also try
    var viewContent: Node;
    override protected function create () : Node {
                    parseContent();
                    FX.deferAction(function():Void{
                           viewContent = group;
                    return Group{ content: bind viewContent }
            }I never tried that, but it might work.
    Another option is to bind the parsed content to whatever view you are pushing it to. Then whenever the request is done, the view will populate its content on the change of the variable where the content is stored.
    Example:
    var allTables: TableModel[];      
    //***************start of table list decleration****************************\\
    public var list: SwingJList = SwingJList {
        var shortcutKey: Boolean = false;
        focusTraversable: true
        selectedIndex: 0
        action: function(){
            FX.deferAction(function():Void{
                openButton.fire();
        items: bind for( table in allTables ){
            table.name
    var searchDataXml = xmlGenerator.generateSearchXMLString(searchData);
    var contentLength: Integer = searchDataXml.getBytes().length;
    def postRequest: HttpRequest = HttpRequest {
        location: "{WEB_APPLICATION_REQUEST_URL}searchData/?database={DATABASE_KEY}";
        method: HttpRequest.POST;
        headers: [
                HttpHeader {
                    name: HttpHeader.CONTENT_TYPE;
                    value: "application/xml";
                HttpHeader {
                    name: HttpHeader.CONTENT_LENGTH;
                    value: "{contentLength}";
        onStarted: function() {
            println("onStarted - started performing method: {postRequest.method} on location: {postRequest.location}");
        onConnecting: function() { println("onConnecting") }
        onDoneConnect: function() { println("onDoneConnect") }
        onWriting: function() { println("onWriting") }
        onOutput: function(os: java.io.OutputStream) {
            try {
                os.write(searchDataXml.getBytes());
            } finally {
                println("onOutput - about to close output stream.");
                os.close();
                os.flush();
        onToWrite: function(bytes: Long) { println("onToWrite - entire content to be written: {bytes} bytes") }
        onWritten: function(bytes: Long) { println("onWritten - {bytes} bytes has now been written") }
        onDoneWrite: function() { println("doneWrite") }
        onReadingHeaders: function() { println("onReadingHeaders") }
        onResponseCode: function(code:Integer) { println("onResponseCode - responseCode: {code}") }
        onResponseMessage: function(msg:String) { println("onResponseMessage - responseMessage: {msg}") }
        onResponseHeaders: function(headerNames: String[]) {
            println("onResponseHeaders - there are {headerNames.size()} response headers:");
            for (name in headerNames) {
                println("    {name}: {postRequest.getResponseHeaderValue(name)}");
        onReading: function() { println("onReading") }
        onToRead: function(bytes: Long) {
            if (bytes < 0) {
                println("onToRead - Content length not specified by server; bytes: {bytes}");
            } else {
                println("onToRead - total number of content bytes to read: {bytes}");
        onRead: function(bytes: Long) {
            // The toread variable is non negative only if the server provides the content length
            def progress =
            if (postRequest.toread > 0) "({(bytes * 100 / postRequest.toread)}%)" else "";
            println("onRead - bytes read: {bytes} {progress}");
        var parser = new XmlPullParser();
        onInput: function(is: java.io.InputStream) {
            // use input stream to access content here.
            // can use input.available() to see how many bytes are available.
            try {
                allTables = parser.processResults(is);
            } finally {
                is.close();
        onException: function(ex: java.lang.Exception) {
            println("onException - exception: {ex.getClass()} {ex.getMessage()}");
        onDoneRead: function() { println("onDoneRead") }
        onDone: function() { println("onDone") }
    postRequest.start();
    } In this case an array of tableModel names are bound to the list view.
    When the httprequest ends, it sets the parsed tableModel array to the array declared in this class.
    The list view will populate the table names from the array when the request finishes.

Maybe you are looking for