Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31029 > unrolled thread
| Started by | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| First post | 2015-02-03 09:52 -0500 |
| Last post | 2015-02-04 19:49 -0500 |
| Articles | 8 — 3 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.
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
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2015-02-03 09:52 -0500 |
| Subject | Re: Is the API of JavaFX pixel-based? |
| Message-ID | <maqnh5$8v4$1@dont-email.me> |
On 02/03/2015 06:01 AM, 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? > Not quite sure what you are asking. Point2D.getX() returns a double, as does most of the api related to dimensions that I can see. The Node class overview mentions Coordinate Systems, Transformations, and Bounding Rectangles. Yes, digital graphical devices are based upon pixels. Can you point to the specific tutorial you mention?
[toc] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2015-02-03 10:59 -0500 |
| Message-ID | <maqrfe$qei$1@dont-email.me> |
| In reply to | #31029 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2015-02-03 14:43 -0500 |
| Message-ID | <mar8io$knu$1@dont-email.me> |
| In reply to | #31031 |
On 02/03/2015 11:41 AM, Stefan Ram wrote:
> Jeff Higgins <jeff@invalid.invalid> writes:
>> 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?
>
> As you wrote: HTML+JavaScript should have it as a default.
>
> Otherwise, I'm not a GUI specialist, I only know rudiments
> of some toolkits.
>
> Maybe someone knows a JavaFX tutorial in the spirit of
> »No magic pixel value« programming.
>
> In my own tutorial, I already avoid magic pixel values.
> Here is a program from my own tutorial:
>
> public final class Main extends javafx.application.Application
> { public void start( final javafx.stage.Stage primaryStage )
> { final javafx.scene.layout.VBox vbox = new javafx.scene.layout.VBox();
> final javafx.scene.control.TextField text = new javafx.scene.control.TextField( "text" );
> vbox.getChildren().add( text );
> final javafx.scene.control.TextField text1 = new javafx.scene.control.TextField( "text1" );
> vbox.getChildren().add( text1 );
> primaryStage.setScene( new javafx.scene.Scene( vbox ));
> primaryStage.show(); }}
>
>
<http://en.wikipedia.org/wiki/Landolt_C>
Looking at the Golovin-Sivtsev Table, (at the left)
I'm able to make out most of the Landolt C
optotypes in the seventh line at my normal
viewing distance. At some point, some "magic"
numbers will be necessary - size of device pixel,
a SWAG at the visual acuity of a perhaps "standard"
viewer, another SWAG at perhaps a "standard"
viewing distance, guestimates of "standard" device
and environment light levels - not sure what else.
Then after all that you can give a gui designer
free rein to use relative placements and sizes.
Looking back over this and other newsgroups
concerning GUIs - it seems to me that some are
real particular about absolute control over
layout, sizing, coloring, etc, etc, and would hate
programming in the style you ask for. And then others
like you wish for.
[toc] | [prev] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2015-02-04 09:05 -0500 |
| Message-ID | <mat94s$bhi$1@dont-email.me> |
| In reply to | #31031 |
On 02/03/2015 11:41 AM, Stefan Ram wrote: > Maybe someone knows a JavaFX tutorial in the spirit of > »No magic pixel value« programming. Not a tutorial, but your post prompted me to look for JavaFX projects of the size that I am considering for JavaFX. <https://github.com/michael-simons/bikingFX> Very few magic numbers, at least in the Java code. Unfortunately the performance of the interesting part, the Tracks tab, is dismal on my machine. This corresponds with my own experience so far - I guess I'll need a machine with an up to date graphics system.
[toc] | [prev] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2015-02-04 09:21 -0500 |
| Message-ID | <mata33$fat$1@dont-email.me> |
| In reply to | #31040 |
On 02/04/2015 09:05 AM, Jeff Higgins wrote: > > Very few magic numbers, at least in the Java code. > Well, a bunch of them in the fxml and css. Shrug.
[toc] | [prev] | [next] | [standalone]
| From | Richard Maher <maher_rjSPAMLESS@hotmail.com> |
|---|---|
| Date | 2015-02-05 06:18 +0800 |
| Message-ID | <mau5qt$o92$1@speranza.aioe.org> |
| In reply to | #31041 |
On 2/4/2015 10:21 PM, Jeff Higgins wrote: > On 02/04/2015 09:05 AM, Jeff Higgins wrote: >> >> Very few magic numbers, at least in the Java code. >> > Well, a bunch of them in the fxml and css. Shrug. > > IMHO, and if your starting the project you should at least consider doing the front-end yourself HTML5, CSSx Javascript and then just have your java serve up JSON respones to AJAX requests.
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2015-02-04 19:46 -0500 |
| Message-ID | <54d2bd62$0$282$14726298@news.sunsite.dk> |
| In reply to | #31046 |
On 2/4/2015 5:18 PM, Richard Maher wrote: > On 2/4/2015 10:21 PM, Jeff Higgins wrote: >> On 02/04/2015 09:05 AM, Jeff Higgins wrote: >>> Very few magic numbers, at least in the Java code. >>> >> Well, a bunch of them in the fxml and css. Shrug. >> > IMHO, and if your starting the project you should at least consider > doing the front-end yourself HTML5, CSSx Javascript and then just have > your java serve up JSON respones to AJAX requests. That is the current fashion. And JAX-RS is pretty cool IMHO. Arne
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2015-02-04 19:49 -0500 |
| Message-ID | <54d2be10$0$282$14726298@news.sunsite.dk> |
| In reply to | #31041 |
On 2/4/2015 9:21 AM, Jeff Higgins wrote: > On 02/04/2015 09:05 AM, Jeff Higgins wrote: >> >> Very few magic numbers, at least in the Java code. >> > Well, a bunch of them in the fxml and css. Shrug. For a mix of real and bogus reasons then having to edit markup language is not considered as bad as having to edit real code. Note that you can move this stuff to Java if you really want to, but it is not how it is intended to be used. Arne
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web