JavaFX - Timers and cessation of enforcement

Hello

I need to do work in the background with a few seconds of delay after the user press a key (a delayed search to be more specific). To do this, I use a java.util.Timer, but since it that the application does not close properly after that the last window is closed.

To reduce the problem of minimum expression, I created this app that shows the problem (eclipse shows she is still ongoing after pressing the close button):

SerializableAttribute public class ApplicationClosing extends Application {}

Private final timerFiltro Timer = new Timer();

Public Shared Sub main (final String [] args) {}
Application.Launch (args);
}

@Override
public void start (final stage primaryStage) {}
Root of group = new Group();
Scene = new scene (root, 400, 250, Color.WHITE);
BorderPane borderPane = new BorderPane();
borderPane.setCenter (new Label ("Hello"));
root.getChildren () .add (borderPane);
primaryStage.setScene (scene);
primaryStage.show ();
}
}

If a comment of the line of the timer, the application finishes successfully. Any ideas?

Thank you all for your help :)

Only the timer run as a daemon:

private final Timer timerFiltro = new Timer(true);

Tags: Java

Similar Questions

  • Differences between JavaFX CSS and css w3c standard

    This is a discussion topic that comes to mind after reading the comments in this thread Re: FXML, css and - fx-are-family

    Feel free to comment or share your ideas on the subject.

    Note that these comments relate to the meaning of assignment of names and semantics of the css tags and not the syntax and parsing of css (such as the w3c css and css javaFX seem to be equivalent with respect to later).

    You know, sometimes I find refreshing absence of JavaFX features in css. It is nice to have, well, almost everything, the JavaFX CSS documented on one page. I think that if you were to do the same for the w3c css then it would end up with a much bigger, more difficult to understand the document and even what should be the content of this document would probably quite controversial, in the same kind of way that ends up being the HTML5 specification. Microsoft has helped more than 7,000 w3c tests just to cover only a subset of css rules that are available in browsers today. The webkit project lists open CSS nearly a thousand bugs: https://bugs.webkit.org/buglist.cgi?product=WebKit & component = CSS & resolution =-. If the implementation even partial w3c CSS support is a complex project.

    When I started using JavaFX CSS I found differences in w3c CSS quite shocking, and it was difficult to account for their. Now that I'm used to JavaFX CSS, I don't have as much of a problem. The difference in names and semantics will be an obstacle to working on JavaFX developers who are familiar with w3c CSS - but the designers quickly will also discover that FXML is not HTML and Java isn't JavaScript and JavaFX deployment is not HTML deployment. Then, perhaps, in the bigger picture, it is not as big a deal that he would appear. Yet, one cannot think that any obstacle to the people easily pick up and adopting JavaFX makes the technology a disservice.

    There are other benefits that the JavaFX CSS in its own space of names to w3c css, in what she can evolve separately, it shouldn't be exactly the same because it has a different name, it should not implement fully w3c css as browsers do so because it is clearly something different by name etc. There is even precedent for it in the use of mozilla to moz - CSS and css properties http://css-infos.net/properties/webkit - web webkit prefixes as not in standard as many people have suggested. JavaFX CSS supports a JavaFX rendering engine and not an HTML rendering engine. It is quite remarkable that Oracle has been able to build and make available a model CSS for JavaFX which feels as familiar as to the w3c css, w3c css is very strongly targeted towards style a game completely different technology (HTML markup document object model and).

    It would be useful to have a tool which translates as w3c css to the approximations of JavaFX css and vice versa, or the ability for JavaFX to have a mode (perhaps a Boolean value when a style sheet is loaded) to perform an automatic alias or the mapping of the w3c css for javafx (at least for the subset of w3c css that would make sense to automatically translate for JavaFX css). I haven't checked the jira JavaFX in detail, then maybe a request for support already exists - it's perhaps in the private http://javafx-jira.kenai.com/browse/RT-9272 jira.

    The JavaFX css model is really powerful and I found really useful some of the additions that it adds above the css 2.1 Basic found regularly in browsers. With the next CSS Java model object http://javafx-jira.kenai.com/browse/RT-17293, you will also better get access by Java programming.

    Then, good work on the construction and implementation of this complex device...

    Thanks for the comments. The gap between JavaFX CSS and CSS from W3C will be an evolutionary process. It would be nice to use the stylesheet of a standard basis, but there is not always a mapping from 1-1 to JavaFX. But for properties that can be mapped, it is something that should be supported. For example, we should be able to deal with 'police' or '- fx - police '.

    I made public http://javafx-jira.kenai.com/browse/RT-9272.

  • Timers and Singletons

    A little history about what I want my app to do first.  I am writing a program to turn on my wifi on and off at a scheduled time.  For example, to turn on the wifi at 19:30, turn it off at 08:00 the next day.  Here's how the program works.  There are 2 entry points for statup auto code and one for the GUI.  The autostartup reads dates (if any) of the persistent store and planning timers accordingly.  Then if the user opens the graphical user interface, they are presented with 2 selectors field dates to set the on and off time again.  When recording these data, it should write back to the store, cancel the current timmer and plan new timers.  Here's the code.  For brevity, I have excluded which, in my view, are not relevant.

    //imports
    public class WifiScheduler extends UiApplication
    {
        public static void main(String[] args)
        {
            if (args.length > 0 && args[0].equals("autostartup"))
            {
            //read data from store             //do some parsing to get date values for dateOn and dateOff
    
                GlobalTimer myTimer = GlobalTimer.getInstance();
                myTimer.setTimer(dateOn,dateOff);
            }
            else
            {
                WifiScheduler app = new WifiScheduler();
                app.enterEventDispatcher();
            }
        }
        public WifiScheduler()
        {
            pushScreen( new SchedulerScreen() );
        }
    }
    
    //imports
    public class SchedulerScreen extends MainScreen
    {
        public SchedulerScreen()
        {
          // setup date fields and add to vertical field manager
        }
        public static long stringToDate(String temp)
        {
          //convert a string to date format
        }
        protected boolean onSave()
        {
            //add new values to persistent store
            //get values for dateOn and dateOff
    
            GlobalTimer myTimer =GlobalTimer.getInstance();
            myTimer.setTimer(dateOn, dateOff);
            return true;
        }
    }
    
    //imports
    class GlobalTimer
    {
        private static GlobalTimer _instance = null;
        private static final long GUID = 0xab4dd61c5d114c18L;
        private Timer _timer = null;
    
        GlobalTimer()
        {
        }
    
        public static GlobalTimer getInstance()
        {
            if (_instance == null)
            {
                _instance = (GlobalTimer) RuntimeStore.getRuntimeStore().get(GUID);
                if (_instance == null)
                { // If it is still null, i.e. null in the RuntimeStore
                    GlobalTimer singleton = new GlobalTimer();
                    RuntimeStore.getRuntimeStore().put(GUID, singleton);
                    _instance = singleton;
                } // inner if
            } // outer if
            return _instance;
        } // getInst
    
        public void killTimer()
        {
               //currently not using this because _timer is always null
            _timer.cancel();
        }
        public void setTimer(Date dateOn, Date dateOff)
        {
            if (_timer != null)
            {
                try
                {
                    _timer.cancel();
                }
                catch (Exception e)
                {
                    System.out.println("Could not cancel _timer");
                }
                _timer = null;
            }
                    //create new instance of timer
            //WRONG Timer _timer = new Timer();                  _timer = new Timer(); //CORRECTED                //Yes, I am aware that a delay of 5000 is not daily, it just makes debugging easier
            _timer.scheduleAtFixedRate(new TurnWifiOn(), dateOn, 5000);
            _timer.scheduleAtFixedRate(new TurnWifiOn(), dateOff, 5000);
        }
    }
    

    The problem is when I call setTimer line GUI code

    if (_timer != null)
    

    is always false, even though I know that I have and you will see a timer running from my statup code.  My singleton or my body doesn't seem to work properly.  My understanding of how this code should work that is to use the singleton I can obtain and modify a specific instance of my timer.  For any help or suggestion would be greatly appreciated.

    So it is. Now that I re-read your original post, I think that there is a totally different problem. You declare in your SetTimer()) method, a local variable _timer that hides the member variable. That's why the next time, _timer is always set to null. Try changing:

    //create new instance of timer
    Timer _timer = new Timer();
    

    TO:

    //create new instance of timer
    _timer = new Timer();
    
  • JavaFX 8 and updates WebKit

    Hello

    I request to develop an 8 JavaFX with a webview incorporated, in order to display an external Web site.

    I noticed that the Web view is based on Webkit 537.44, released in June 2013. So I wonder if it is planned to make webkit updates in future releases of JavaFX, but I can't find this information anywhere.

    Anyone know if they are updated on demand? I'm afraid that this version of webkit may become outdated over time.

    Thank you

    Julien

    There is this proposed change

    EHD 239: updated JavaFX/WebView to the last Version of WebKit

    I'm confused about version however numbers. I also see good 537.44 when I check the WebView instance.getEngine().getUserAgent() call.

    I don't know how the process of JEP - this update is something sure to 1.8 u60? I hope so.

    I see this comment on the JIRA that looks good...

    Kevin Rushforth added a comment - 2015-01-30 15:52

    Note that almost all of the work is completed and will be integrated in JDK 9 first. There will be a small amount of work to backport of 8u60, but it uses the same code base.

    And the jIRA in jdk9 looks promising...

    https://JavaFX-JIRA.Kenai.com/browse/RT-36726

  • Timers and switch case

    Question very Simple.

    I want to use a business structure that alternates between two different results based on a timer that expires.  For example:

    5 sec-> true case

    5 sec case-> false

    Repeat steps.

    I will write data to the file so any method that would cause the VI to sleep for the duration of 5 seconds wouldn't be ideal.

    Any ideas?

    I guess you can be interested in this kind of logic. It is sufficient to pull in your vi and run it.

    Good luck.

  • Freshly installed and already ongoing enforcement issues

    Screen Shot 2015-03-27 at 23.50.45.pngHello

    Just finished installing vRealize Automation device 6.2.1.0 and get the page of connection present. After login, the view all page opens with an empty list of tenants. I then try to configure the former tenant, but I'm not sure what to enter in the URL box. Is it only the part of the url that comes after the standard URL or is it not the full URL?

    Whatever it is, I always get an error everything I do, see screenshot. All the solutions to this?

    Installation is not an upgrade, but a clean install identity device, vRealize device Automation, vCenter 6 (YES!) device, Windows for IIS and DEM 2012.

    Thank you

    Gabrié

    Been playing with this all morning and then decided to reinstall everything the vCAC device. When walking through the deployment of EGGS I then remembered that I had some problems in the previous deployment with the host name. I just finished my new installation and now everything seems to work fine. After you have reinstalled the vCAC (no no Gabe, it's vRealize Automation!) device, I also removed everything from the Windows Server and reinstall all components (IaaS, DEM, database, IIS).

    Now, I get the first page showing the tenant vSphere.local and an assistant on the left side. Everything seems fine now.

    Thank you for your help. My first steps in the vRA :-)

  • Timers and Propagation of the event

    Hello

    I'm having a bit of trouble finding it, any help would be appreciated. I have a container named circleHolder_mc. inside I have four circles named circ0_mc circ4_mc. My goal is that each circle flashing on mouseover. The closest I've got is the following code that causes all the circles to blink at the same time.

    circleHolder_mc.addEventListener (MouseEvent.MOUSE_OVER, onBlink)
    circleHolder_mc.addEventListener (MouseEvent.MOUSE_OUT, unBlink)


    var: timer = new Timer (1);
    timer.addEventListener (TimerEvent.TIMER, onTimer);


    function onTimer(evt:TimerEvent):void {}
    Alpha += 7;
    }

    function onBlink(evt:MouseEvent):void {}
    Timer.Start ();
    }

    function unBlink(evt:MouseEvent):void {}
    Timer.Stop ();
    Alpha = 100;
    }

    Any thoughts?

    Thank you

    -Sean

    then use:

    var tl:MovieClip =;

    for (var i: uint = 0; i<>

    circleHolder_mc ["circ" + i.toString () + "_mc"] .addEventListener (MouseEvent.MOUSE_OVER, startblinkF)

    circleHolder_mc ["circ" + i.toString () + "_mc"] .alpha is. 4;

    }

    function endblinkF(mc:MovieClip):void {}
    MC.alpha = 4.
    }
       
    function startblinkF(evt:MouseEvent):void {}
    evt.currentTarget.alpha = 1;

    clearTimeout() (evt.currentTarget.endblinkTO);

    evt.currentTarget.endlblinkTO = setTimeout(endblinkF,500,evt.currentTarget);

    }

  • JavaFX 2.0 and CoverFlow

    Is there an example of CoverFlow in Java FX 2.0?

    I found this one, but it works with Java FX1.3 = > http://download.oracle.com/javafx/1.3/howto/Cover-Flow-Tutorial.html

    You can find the source code here
    \javafx-SDK2.0-beta\apps\src\DisplayShelf
    After unpacking the current construction of JavaFX beta and it doesn't
    work.

  • What are the objects javafx can be built in the init() method?

    I have consulted the api javafx2.2, it says:

    Threading

    JavaFX creates a thread of the application for enforcement of the startup application, input events processing method and execution of the animation chronologies. Creation of JavaFX Scene and Stage objects as well as the change in the operations of scene graph to living objects (objects already attached to a scene) must be made on the JavaFX application thread.

    Request of the manufacturer and init method is called on the thread of Launcher, not on the Thread of the JavaFX Application. This means that an application does not build a Scene or a Stage constructor or in the init method. An application can build other objects of JavaFX in the init method.

    But exactly what javafx objects can be built in the init() method? if someone could make a list? Now I know, what objects except the scene, scene, Tooltip, ContextMenu, HTMLEditor and WebView. Is this good? Are there still other objects that cannot be built in the init() method? Thank you.

    Things that need to be created on the JavaFX Application thread (cannot be created in init) are:

    1 WebView.

    2. anything that involves the creation of the window (balloon, the ContextMenu etc are all from the windows popup in their internal implementation).

    Jira related question:

    RT-17716 some controls cannot be created on the FX application thread

    There are workaround solutions in the comments to:

    RT-25127 ToolTip the tab (and other controls) cannot be defined in FXApplicationThread

  • Satellite A300D - overheating issue and it stops itself

    Hello

    Computer: Satellite A300D (PSAHCE)

    Bought my A300D two months ago. It was pre-installed with Vista, which, unfortunately, after a while, became so slow, that it was impossible to get anything done. So I decided to install Windows 7, the other day and it worked like a charm. Except for the fan stops after about 1-2 hours of work. Even if the temperature exceeds 60-70 ° C. The computer stops at about 80 c.

    I do not understand why the fan stops working.

    So far, I have tried the following: I tried to clean the fan with compressed air.

    I read this thread http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=46796&tstart=0 on an update of the BIOS, but the one I found, dated February 09 is the same version I already have. Are there any new?

    I read this thread http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=46117&tstart=105 that connects this http://aps2.toshiba-tro.de/kb0/HTD84026Q0000R01.htm guide where there is something called Toshiba Power Saver Settings. I searched for her to Toshibas support center, but it can not be found for my model.

    I tried using Speedfan freeware without results. I work as a developer, and I only have my netbeans IDE and Spotify ongoing enforcement, even if the computer gets hot after about 1.5 to 2 hours of work because the fan stops.

    Anyone have any idea on how I can solve this or something else I can try?

    I forgot, I also put the cooling system active strategy.

    Hello

    If I understand you correctly, this happens only on Windows 7. Is this good?

    If so, you should go back to Vista or let's say the factory settings. I assume you are using Windows 7 beta or Release Candidate, and this isn't an official version of Windows. In addition Windows 7 isn't on the market and there is therefore no support of official rider for the time.
    Maybe Windows 7 peut t control the fan settings correctly.

    But this problem could be caused due to a third-party display driver. Then you should try the display driver for Vista on the Toshiba site, maybe it helps

    Welcome them

  • With the help of the cDAQ timers to repeat an impulse of finite samples clocked by train clock material

    Hi all

    A complex project I have to implement an interface acquisition of material for a linear motion sensor using the output of the synchronous serial (SSI) commune in the control of the industrial movement. (I have a bit of experience in digital electronics, but I'm new to hardware synchronized timer e/s digital in LabVIEW).

    To do this, I need to create a clock timed by the busted hardware signal pulse train TTL. Each burst consists of 25 down transitions, with a period of complete cycle of 2.67 microseconds (375kHz). The output is then held high until the next outbreak, that produce at 1ms intervals.

    Using of cDAQ timers and a NI 9401 (based on the example http://www.ni.com/example/30256/en/), I was able to create the pulse train burst as described (see attached image VI). Then I need to configure another timer to set off this explosion to repeat at 1ms intervals.

    Someone at - it guidance on how best to accomplish the hardware timing for the repetition of the pulse train?

    Any suggestions of alternative strategies or observations about the way that my noobish code is stupid or ineffective are welcome as well!

    Thank you!

    Hello RyanBiggs,

    You will need to perform the following operations based on the code that you have joined.

    1. Set up a second output continuous counter task which will give an impulse to 1000 Hz.
    2. Set up your first task of meter output to start according to the configuration in the first step using the vi DAQmx trigger.
    3. Configure the first task of the meter output to redeclenchables via the property node so that the output meter pulses when he sees a rising from the second task of meter output.

    The implementation is shown below.

    Kind regards

    Izzy O.

    Product Support Engineer

    NI.com/support

  • Why do I have the error, Act on the request, has encountered a problem and needs to close

    I have a program called law tax preparation on.  When I go to print a return, the window opens and bed the Enforcement Act"DEMAND" has encountered a problem and needs to close.  The choice to send error report to Microsoft to cancel.  I sent it to Microsoft several times and no answer on how to fix.  Also, have sent e-mail to act on the on the problem.

    Hi VickiSpittler,
     

    Try the steps listed in the following article and check if this can help:

    Help topic: error on Page / Script Error / error occurred

    If it does not, contact support act.

  • 802.1R and fast roaming

    Hello world.

    I couldn't find anything in this regard. I want my customers to be able to experience a better roaming. based on my study the client goes through the process of 802. 1 x if they re - associate with different AP (even on the same WLC) and 802.1r or FT 802. 1 x option seems to be the answer, if I don't want to use CCKM server.

    first is that OK? on my debug I get this line which is saying no transfer of data at this stage when its in the process of EAPol.

    so to allow 802.1r, I chose the transition quick and on DS and also checked the FT 802.1 x.

    is that all?

    Thanks for your response

    Hello

    Thanks for debugging.

    By the way I am at the other end of AU (IE MEL) - it was 22:38 when I replied to you yesterday :)

    So here's what I found the debug, looks like not fast roaming (802.11r) happen & each time customer is going through the full process Auth & then 4 - Way handshake. I can see 6 times customer roaming to different AP, shows only first 3 here.

     *apfMsConnTask_3: Oct 03 08:17:46.471: 00:24:2b:6f:4e:98 Sending Assoc Response to station on BSSID 2c:3f:38:59:a1:90 (status 0) ApVapId 1 Slot 0 *apfMsConnTask_3: Oct 03 08:17:46.471: 00:24:2b:6f:4e:98 apfProcessAssocReq (apf_80211.c:8294) Changing state for mobile 00:24:2b:6f:4e:98 on AP 2c:3f:38:59:a1:90 from Associated to Associated *spamApTask0: Oct 03 08:17:46.474: 00:24:2b:6f:4e:98 Sent 1x initiate message to multi thread task for mobile 00:24:2b:6f:4e:98 *Dot1x_NW_MsgTask_0: Oct 03 08:17:46.474: 00:24:2b:6f:4e:98 EAP-PARAM Debug - eap-params for Wlan-Id :1 is disabled - applying Global eap timers and retries *Dot1x_NW_MsgTask_0: Oct 03 08:17:46.474: 00:24:2b:6f:4e:98 Disable re-auth, use PMK lifetime. *Dot1x_NW_MsgTask_0: Oct 03 08:17:46.474: 00:24:2b:6f:4e:98 dot1x - moving mobile 00:24:2b:6f:4e:98 into Connecting state *Dot1x_NW_MsgTask_0: Oct 03 08:17:46.474: 00:24:2b:6f:4e:98 Sending EAP-Request/Identity to mobile 00:24:2b:6f:4e:98 (EAP Id 1)
     *apfMsConnTask_7: Oct 03 08:22:03.689: 00:24:2b:6f:4e:98 Sending Assoc Response to station on BSSID 2c:3f:38:2a:a6:b0 (status 0) ApVapId 1 Slot 0 *apfMsConnTask_7: Oct 03 08:22:03.689: 00:24:2b:6f:4e:98 apfProcessAssocReq (apf_80211.c:8294) Changing state for mobile 00:24:2b:6f:4e:98 on AP 2c:3f:38:2a:a6:b0 from Associated to Associated *pemReceiveTask: Oct 03 08:22:03.690: 00:24:2b:6f:4e:98 10.66.54.50 Removed NPU entry. *spamApTask3: Oct 03 08:22:03.692: 00:24:2b:6f:4e:98 Sent 1x initiate message to multi thread task for mobile 00:24:2b:6f:4e:98 *Dot1x_NW_MsgTask_0: Oct 03 08:22:03.692: 00:24:2b:6f:4e:98 EAP-PARAM Debug - eap-params for Wlan-Id :1 is disabled - applying Global eap timers and retries *Dot1x_NW_MsgTask_0: Oct 03 08:22:03.692: 00:24:2b:6f:4e:98 Disable re-auth, use PMK lifetime. *Dot1x_NW_MsgTask_0: Oct 03 08:22:03.692: 00:24:2b:6f:4e:98 dot1x - moving mobile 00:24:2b:6f:4e:98 into Connecting state *Dot1x_NW_MsgTask_0: Oct 03 08:22:03.693: 00:24:2b:6f:4e:98 Sending EAP-Request/Identity to mobile 00:24:2b:6f:4e:98 (EAP Id 1)
     *apfMsConnTask_4: Oct 03 08:23:06.663: 00:24:2b:6f:4e:98 Sending Assoc Response to station on BSSID 2c:3f:38:30:17:10 (status 0) ApVapId 1 Slot 0 *apfMsConnTask_4: Oct 03 08:23:06.663: 00:24:2b:6f:4e:98 apfProcessAssocReq (apf_80211.c:8294) Changing state for mobile 00:24:2b:6f:4e:98 on AP 2c:3f:38:30:17:10 from Associated to Associated *spamApTask0: Oct 03 08:23:06.665: 00:24:2b:6f:4e:98 Sent 1x initiate message to multi thread task for mobile 00:24:2b:6f:4e:98 *Dot1x_NW_MsgTask_0: Oct 03 08:23:06.666: 00:24:2b:6f:4e:98 EAP-PARAM Debug - eap-params for Wlan-Id :1 is disabled - applying Global eap timers and retries *Dot1x_NW_MsgTask_0: Oct 03 08:23:06.666: 00:24:2b:6f:4e:98 Disable re-auth, use PMK lifetime. *Dot1x_NW_MsgTask_0: Oct 03 08:23:06.666: 00:24:2b:6f:4e:98 dot1x - moving mobile 00:24:2b:6f:4e:98 into Connecting state *Dot1x_NW_MsgTask_0: Oct 03 08:23:06.666: 00:24:2b:6f:4e:98 Sending EAP-Request/Identity to mobile 00:24:2b:6f:4e:98 (EAP Id 1)

    Regarding your version of code & 802.11r client supported, I found this during today to WLC 8.0 Delta Webinar.

    1 802.11r mixed mode support to 7.6 and 8.0 (both codes)
    2. yet few applicants (Mac OSX, Netgear, ect) don't like mixed mode WLAN, so that they can have trouble if you enable FT

    Here is the list for 802.11r joint customer supported in OS & view according to webex of today.

    I suspect that your Dell customer may not support 802.11r & therefore do the full auth everytime.

    If possible get an output of client debugging for an iPhone or an iPad (running iOS6 or higher). We can therefore compare & see the difference.

    Hope this answer help me set up my side. :)

    He sank 4-> 3-> 2 to 3 last replies :)

    HTH

    Rasika

  • Custom layout of JavaFX nodes

    I'm developing an application for which it is necessary to nodes available in addition to the other (or on top of the other etc..). However, this provision is only an IPO and the user is able to move these nodes arbitrarily. How does correctly in JavaFX? I'll explain my problem with a simplified example:

    Guess I have 2 rectangles and want to place rect2 right of rect1.

    // create first rectangle at position x= 5, y=5 
    rect1
    = rectangle(5,5);
    // create second rectangle to the right of rect1
    rect2
    = rectangle(5+rect1.width(), 5);

    In this scenario JavaFX has not yet determined the width of rect1, and there will be zero. Intuitively, I would make a call that allows JavaFX rect1 and thus determine its width and then add rect2. See the following example:

    // create first rectangle at position x= 5, y=5 
    rect1
    = rectangle(5,5);
    // let JavaFX draw rect1 (width will be calculated and set)
    draw
    ();
    // create second rectangle to the right of rect1
    rect2
    = rectangle(5+rect1.width(), 5);

    Unfortunately, I have not found a method that does what I want. My current solution appealed to the Platform.runLater (), but this does not work properly all the time. If my interpretation of the links is correct, the links also are not appropriate for this problem. I want only to provision initially nodes, so I have to remove the link after the initial layout (or do rect2 would move if rect1 is moved).

    Thanks in advance for any help.

    Custom presentations are generally made subclassing region, the substitution of layoutChildren() and calculations of page layout based on the prefWidth and the prefHeight of the child nodes.  Best place to understand this for example is by examining the source code of JavaFX , as I've never seen a tutorial on the subject.

    A round, you can use that may or may not be suitable for you, is to use the layout panels for the default page layout, then use translate the properties to allow the user to the default layout components, the translation in this way you can avoid the creation of a custom layout component.

    Another way to do is to use a base pane as the layout container that is not automatic on her children, add children to the pane in the constructor of the component.  Layout() and applyCss() use children to measure children if necessary in order to determine the appropriate size.

  • Can I use JavaFX in Swing without modifying source more?

    I had created a desktop in Java - Swing application.

    Now, I want to improve the GUI. So I had planned to upgrade to JavaFX.

    Can I use JavaFX in the swing and it is good to set up like this, rather than rewrite the program in JavaFx?

    Updated the Message was edited by: CyberBoy

    > Can I use JavaFX bat

    Yes, you can incorporate scenes of JavaFX in Swing and Swing components in JavaFX.

    See tutorial Oracle Interoperability JavaFX-Swing.

    > is good to be implemented like this, rather than rewrite the program in JavaFx

    Yes and no.  It depends on your application.

    Yes-online mix JavaFX and Swing is a good approach if you are integrating your application into a vast structure of swing established such as the NetBeans platform.

    No-online mix JavaFX and Swing is a bad approach, if you have an application that is relatively small and insignificant.

    Mixture of JavaFX and Swing makes your more complex program because:

    * You have to deal with different threading systems.

    * You have to deal with different toolkits to interface user.

    The JavaFX components looks do not match the appearance of the Swing components, if your application will look a little weird.

    * Swing apps will not support features like touch interfaces.

    Yes, the best to avoid mixing the two with the exception of special cases.  Valid reasons to mix the two (IMO) are:

    * You have a large, existing Swing code base, which completely makes the migration to JavaFX AND unreasonable

    * You want to use some specific features of JavaFX like WebView, multimedia playback in JavaFX, JavaFX graphics or 3D JavaFX which are not available in the swing.

    OR

    * You have a JavaFX application and the need to make use of some complex and Swing only existing component for which there is no counterpart in JavaFX (I think that for most people this will not be the case).

Maybe you are looking for