Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32469

Re: Self-updating relationship

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.c, comp.lang.java.programmer
Subject Re: Self-updating relationship
Date 2015-09-02 17:46 -0400
Organization A noiseless patient Spider
Message-ID <ms7qk1$s5m$1@dont-email.me> (permalink)
References <relationship-20150902211808@ram.dialup.fu-berlin.de> <55E766BD.3060303@verizon.net> <spaces-20150902222406@ram.dialup.fu-berlin.de>

Cross-posted to 2 groups.

Show all headers | View raw


On 9/2/2015 5:25 PM, Stefan Ram wrote:
> James Kuyper <jameskuyper@verizon.net> writes:
>>> final javafx.beans.property.IntegerProperty height
>>> = new javafx.beans.property.SimpleIntegerProperty( 10 );
>>> final javafx.beans.property.IntegerProperty number
>>> = new javafx.beans.property.SimpleIntegerProperty(  2 );
>>> final javafx.beans.binding.NumberBinding spaces =
>>> height.subtract( number );
>>> java.lang.System.out.println( spaces.getValue() );
>>> height.set( 20 );
>>> java.lang.System.out.println( spaces.getValue() ); }}
>> What's the java feature that makes "spaces" above update automatically?
>> To put it another way - if I didn't want such updates, what should I
>> write differently?
>
>    This depends on the details of the behavior you want instead.
>    For one example, you can simply omit »height.set( 20 )«, and
>    »spaces« will not be updated. Or, you could just write:
>
> public final class Main
> { public static void main( final java.lang.String[] args )
>    { final javafx.beans.property.IntegerProperty spaces
>      = new javafx.beans.property.SimpleIntegerProperty( 8 );
>      java.lang.System.out.println( spaces.getValue() ); }}
>
>    Which just will print »8« and not update spaces, or just
>
> public final class Main
> { public static void main( final java.lang.String[] args )
>    { int const spaces = 8; java.lang.System.out.println( spaces ); }}
>
>    or just,
>
> public final class Main
> { public static void main( final java.lang.String[] args )
>    { java.lang.System.out.println( 8 ); }}
>
>    to get the same behavior.

     It's worth noting that the javafx package is not part of "core
Java" (more formally, "Java SE"), but is an optional add-on called
JavaFX.  (JavaFX is well-known as the technology that has made all
of AWT, Swing, SWT, Flash, and HTML5 obsolete. :)

     In other words, the machinery that makes the updates happen is
not "a Java feature" any more than GMP is "a C feature."

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-02 17:14 -0400
  Re: Self-updating relationship Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-02 17:46 -0400
    Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-03 21:06 -0400
      Re: Self-updating relationship e.d.programmer@gmail.com - 2015-09-04 04:46 -0700
        Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 19:43 -0400
    Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-04 11:49 -0400
      Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 19:45 -0400
        Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-04 22:10 -0400
          Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 22:31 -0400
            Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 22:38 -0400
            Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-04 22:51 -0400
  Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-02 18:49 -0400
    Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-02 19:28 -0400
      Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-02 23:52 -0400
        Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 10:32 -0400
          Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-03 10:53 -0400
            Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 11:31 -0400
              Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 11:35 -0400
              Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 11:49 -0400
              Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-03 12:16 -0400
                Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 13:03 -0400
          Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 10:55 -0400
      Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-03 00:06 -0400
    Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-02 23:38 -0400
      Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 01:22 -0400

csiph-web