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


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

Re: Is the API of JavaFX pixel-based?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Is the API of JavaFX pixel-based?
Date Tue, 3 Feb 2015 17:30:26 +0000 (UTC)
Organization A noiseless patient Spider
Lines 40
Message-ID <mar0ji$7hp$1@dont-email.me> (permalink)
References <pixels-20150203115719@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Tue, 3 Feb 2015 17:30:26 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="7737"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kWSo53mHMdFnK+Ki06W6364nBby0VT0U="
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Cancel-Lock sha1:tGbh1ggGvee4xCs15YKwHkLIwFI=
Xref csiph.com comp.lang.java.programmer:31034

Show key headers only | View raw


On Tue, 03 Feb 2015 11:01:39 +0000, Stefan Ram wrote:

> In a JavaFX tutorial, all dimensions (of text fields and so),
>   were hard-coded in the source code, in pixels!
> 
>   In the age of devices with very small screens (like phones) and very
>   large screens (like desktops) or coarse resolutions (like TVs) or high
>   resolutions (like »retina« displays) is an API based on pixels the
>   height of fashion?
>
If I'm writing Swing code I tend to get the screen size from the JFrame

   screenDets = getToolkit();
   screenSize = screenDets.getScreenSize();

and then express window sizes as a percentage of the screen size. This 
works well. So far I haven't needed to use that to set font and component 
sizes, but I don't see why it shouldn't work for them too for all 
reasonable values of 'screen size'.

Of course, if the application was written for a tablet or PC and the new 
target screen is 'unreasonably' small, e.g. a phone, you may have to 
redesign the screen so that what is intentionally small text on the PC is 
still readable on the phone. My current project which falls into that 
category, was designed for a 1280 x 800 or bigger screen but I just 
checked and it works just fine on a old SVGA (1024 x 768) screen though 
some of the displays (JPanel in a JScrollPane managed by a CardLayout 
manager) do need to be scrolled on the smaller screen but not on the 
bigger one. 

If I'd used the scaling trick on the various JComponents and the font I'd 
expect the scrolling behaviour to remain the same for both screens but it 
would be interesting to see how legible the text is on the smaller screen.
I've just added this to the future enhancements list.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

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


Thread

Re: Is the API of JavaFX pixel-based? Martin Gregorie <martin@address-in-sig.invalid> - 2015-02-03 17:30 +0000
  Re: Is the API of JavaFX pixel-based? Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2015-02-04 06:28 +0800
    Re: Is the API of JavaFX pixel-based? Martin Gregorie <martin@address-in-sig.invalid> - 2015-02-04 12:14 +0000

csiph-web