How to pause service when it's not visible in TabPane

Peter Penzov peter.penzov at gmail.com
Wed Jul 30 13:44:04 UTC 2014


Hi Tomas,
  I'm not 100% sure but I tested the proposed code and it seems that it's
working. One more question. I have too many Java Classes into which I need
to implement this. Is there a quick and easy way to get the Tab Object into
the service class where I need to implement this?

BR,
Peter


On Wed, Jul 30, 2014 at 1:22 PM, Tomas Mikula <tomas.mikula at gmail.com>
wrote:

> What about
>
>     tab.selectedProperty().addListener((obs, old, selected) -> {
>         if(selected) {
>             service.restart();
>         } else {
>             service.cancel();
>         }
>     });
>
> ?
>
> Best,
> Tomas
>
> On Wed, Jul 30, 2014 at 9:07 AM, Peter Penzov <peter.penzov at gmail.com>
> wrote:
> > Hi All,
> >    I have a TabPane with JavaFX service which displays some data. I'm
> > interested is there a way to pause the service when I switch the tabs and
> > the service is not visible? It 'will same me a lot of CPU resources if
> > there is a way to implement this.
> >
> > BR,
> > Peter
>


More information about the openjfx-dev mailing list