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


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

Re: Is the API of JavaFX pixel-based?

Started byMartin Gregorie <martin@address-in-sig.invalid>
First post2015-02-03 17:30 +0000
Last post2015-02-04 12:14 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#31034 — Re: Is the API of JavaFX pixel-based?

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2015-02-03 17:30 +0000
SubjectRe: Is the API of JavaFX pixel-based?
Message-ID<mar0ji$7hp$1@dont-email.me>
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       |

[toc] | [next] | [standalone]


#31036

FromRichard Maher <maher_rjSPAMLESS@hotmail.com>
Date2015-02-04 06:28 +0800
Message-ID<mari2b$mhm$2@speranza.aioe.org>
In reply to#31034
On 2/4/2015 1:30 AM, Martin Gregorie wrote:
> On Tue, 03 Feb 2015 11:01:39 +0000, Stefan Ram wrote:
>>
> 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.
>
Isn't he just asking "Why not EMs (or other) rather than PXs?"

[toc] | [prev] | [next] | [standalone]


#31038

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2015-02-04 12:14 +0000
Message-ID<mat2fp$f4a$1@dont-email.me>
In reply to#31036
On Wed, 04 Feb 2015 06:28:28 +0800, Richard Maher wrote:

> Isn't he just asking "Why not EMs (or other) rather than PXs?"

Dunno. In any case, this is a more or less useful workround.

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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web