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


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

Re: Is the API of JavaFX pixel-based?

From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Is the API of JavaFX pixel-based?
Date 2015-02-03 10:59 -0500
Organization A noiseless patient Spider
Message-ID <maqrfe$qei$1@dont-email.me> (permalink)
References <pixels-20150203115719@ram.dialup.fu-berlin.de> <maqnh5$8v4$1@dont-email.me> <tutorial-20150203161247@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 02/03/2015 10:16 AM, Stefan Ram wrote:
> Jeff Higgins <jeff@invalid.invalid> writes:
>> Can you point to the specific tutorial you mention?
>
>    I refer to code like:
>
> Scene s = new Scene( r, 360, 120, Color.rgb( 0, 0, 0, 0 ));
>
>    . It is not obvious how the author arrived at those
>    values »360« and »120«.
>
>    The Scene contains some text fields stacked one above
>    the other. What I would prefer instead would be a call
>    like:
>
> Scene s = new Scene( r, Color.rgb( 0, 0, 0, 0 ));
>
>    The textfields would have a default font that is
>    readable (but not excessively high as in a heading).
>    Symbolic constants are Ok, like »PARAGRAPH_FONT«,
>    »HEADING_FONT«.
>
>    The pixel height of that default font depends on the
>    run-time environment and does not have to be known
>    to the programmer. Then, the height of the textfield
>    would be adjusted to the height of this font, while
>    the width is given by the programmer in »m«s (»10«
>    means, wide as 10 »m« letters in that font).
>
>    The width and height of all the containers and,
>    ultimatively of the scene, is calculated bottom-up
>    from those values. They are not known to the
>    programmer, because they are calculated as late
>    as run time.
>
>    In programming, we were taught early to avoid
>    »magic constants« in source code (such as »360«
>    above). More so, in my opinion, we should especially
>    avoid »magic pixel values« in source code. A good program
>    will not set a fixed pixel height for a font, but
>    adjust to the font height that is natural (readable)
>    on a device and will only be known as late as at run time.
>
This is all achievable with JavaFX as with any GUI APIs that
I'm familiar with. It may not be "out of the box" behavior.
Can you point to a GUI API with such default behavior?

My Kindle displays HTML pretty nicely, as does my browser,
but I don't know what the source code looks like.

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


Thread

Re: Is the API of JavaFX pixel-based? Jeff Higgins <jeff@invalid.invalid> - 2015-02-03 09:52 -0500
  Re: Is the API of JavaFX pixel-based? Jeff Higgins <jeff@invalid.invalid> - 2015-02-03 10:59 -0500
    Re: Is the API of JavaFX pixel-based? Jeff Higgins <jeff@invalid.invalid> - 2015-02-03 14:43 -0500
    Re: Is the API of JavaFX pixel-based? Jeff Higgins <jeff@invalid.invalid> - 2015-02-04 09:05 -0500
      Re: Is the API of JavaFX pixel-based? Jeff Higgins <jeff@invalid.invalid> - 2015-02-04 09:21 -0500
        Re: Is the API of JavaFX pixel-based? Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2015-02-05 06:18 +0800
          Re: Is the API of JavaFX pixel-based? Arne Vajhøj <arne@vajhoej.dk> - 2015-02-04 19:46 -0500
        Re: Is the API of JavaFX pixel-based? Arne Vajhøj <arne@vajhoej.dk> - 2015-02-04 19:49 -0500

csiph-web