B4J Question Java Platforms - Consistency problems?

rspitzer

Active Member
I have attached 2 images below, they are the same program, running on 2 different desktops. One desktop is my Microsoft Surface, and the other is a raspberry Pi 3. I am running on the raspberry pi 3 the bellsoft java lite edition (11.0.1) as recommended. On my desktop I was running the regular Oracle Java edition (whatever was current), I say was, because of the inconsistency I removed the Oracle version and downloaded the 11.0.6 version of Java from Bellsoft to run on the Surface. I can only assume there is something wrong in some configuration of Java. I don't think this is a B4J problem at all. The program running on the Raspberry is producing the right screen display, the Surface is not. I am worried about this consistency issue from platform to other platforms. Does somebody have a suggestion as to what I should be looking or configuring to run things consistently. I don't want to list other things I have tried, but I do know one thing, if I change the Java version that is running on the Raspberry PI to lets say 13, or even the 11.0.6 running on the surface I get the same problems. I assume this must be an issue with JavaFX???? Just don't know and this worries me about how viable my program will be on different desktops? Can 11.0.1 be so different than 11.0.6???? Just don't know, and don't have enough knowledge of Java in general. Any help would be greatly appreciated.

I do have the following code snippet at the beginning of the program:
B4X:
    #VirtualMachineArgs: -Djavafx.platform=monocle

Surface:
Surface.PNG

Raspberry:
Raspberry.jpg
 

rspitzer

Active Member
I have had no answers or replies to this post. I must be the only one in the universe with this issue. Even though my programming is coming along on the pi platform, it still bothers me that i cannot achieve the same results on my surface 6 laptop. Possible configuration problem, I do not know. I have tried some other things to see if it made a difference, primarily downloading the exact same JDK that the pi has, but the windows configuration from GIT hub. The interesting result was I was getting an error about not finding the javafx-swt.jar even though it was in lib directory. I looked at the other install directory (the recommended download directory) and found this has a separate JavaFX directory instead of being included in the lib directory. I then copied that directory to this, and of course the error went away, this leads me to believe the downloaded JDK is a special build??? for B4J. I am not smart enough to say yes to this. So once again I am stuck. I am willing to have someone actually log into my laptop and take a look around and see if they could spot the issue. Oh well. In the meantime for program consistency purposes, I am getting rid of the textarea and implementing my own programmatic textarea. Wish I did not have to do this.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
I had/have seen the same problem like you, it was a difference between Mac and PC. My understanding is, that different sizes in the standard css files are the source of the problem. So i tried to transfer my pc css file to the mac in this style: MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "Table.css")).
Another source of sizing differencs could be solved with this parameter: #VirtualMachineArgs: -Dglass.win.uiScale=100%
With this parameter i see sizing differences between java v8 and java v11.
 
Upvote 0

rspitzer

Active Member
First, let me thank you generously for your reply, it made me feel a bit less of casting in the wind.

B4X:
#VirtualMachineArgs: -Dglass.win.uiScale=100%

This statement effected the entire screen size, in this particular case (I assume due to the high resolution of my screen) the screen size shrank to about 50 percent of a normal screen. Can I ask you where you got the information above? As far as CSS is concerned, I am not using any CSS in my code that I am explicitly aware of unless this is some background operation I am unaware of. The issue is not the entire screen, but the actual sizing of the textarea control. It was suggested in a different post before I put things together here in this post, that I should use an explicit CSS statement that I assume would apply to the textarea control, this also did not work. This could be because I did not use the added file properly or there was misstatement in the added code file on my part. The entire issue is around the textarea control not working (displaying properly) properly at all. This field works properly on the PI (no added CSS code, I assume), yet does not work on my laptop at all. This is why I have been chasing some type of configuration issue. The issue really is if I decide to use a different board other than a pi, running some Linux platform, will I now have a problem on that board instead like my laptop. As I go deeper int this project, what other pitfalls await? Anyway, thank you for taking a bit of your time and trying to help here.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
The information came from here: https://www.b4x.com/android/forum/threads/java-9.84236/#post-534160
If you can make a small demo app, on my son's notebook is a 4k 13 " display - so it's good for testing hi dpi problems. I can also use an old mac and some pc's. My rasperry is currently not working with java...
Its my understanding, that css files are in internal use by javafx, we can only try to modify some of these parameters. I had modified some css values to have a better design in some table views. Are you living in germany or austria, because spitzer is a ususal name in our country.
Greetings
Reinhard
 
Upvote 0

rspitzer

Active Member
Thank you for the kind reply, I have added a stripped down version of the app, basically just 2 keys, when pressed, display in the textarea control. There are also 2 pictures of what the output looks like on the screen, one from the raspberry (correct) and one from my laptop (in correct). The entire problem centers around the textarea control. On the raspberry you will see the small caret cursor (looks like an old fashioned tab or indent spacer from a typewriter with cursor, and on the surface laptop photo, this appears as just dead white space overlapping the key pictures.) Again thank you for taking this time, I really appreciate it, if nothing comes of it, that's okay, I appreciate the help and thoughtfulness of the endeavor.

Ironically, I was originally born in Vienna, actually adopted by post war parents. My adopted father was an Austrian born in Vienna, who was the last of his line due to the War, he decided to adopt a child (me) who was originally Viennese. Anyway, I live in California, Northern, about 40 miles north of San Francisco.

Surface laptop.
Surface laptop.jpg


Raspberry Pi
Raspberry.jpg
 

Attachments

  • serialtest.zip
    20.1 KB · Views: 120
Last edited:
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Thanks for the example - the sizing problem of textarea is discussed here:

I think it has nothing to do with hidpi etc. This effect i see on all my machines. Why do you use textarea for one line input - i replaced textarea with textedit and everything looked ok.

I live 40 miles north of vienna; in 1995 i was visiting california - from san francisco to LA for two weeks.
Do you still have relatives in austria? The brother of my grandfather, Leopold Sulz was married with Käthe Spitzer, who died in the war on 15. Jan. 1945.

Greetings from austria
Reinhard
 
Upvote 0
D

Deleted member 103

Guest
look here, I had a similar problem.
 
Upvote 0

rspitzer

Active Member
First, thank you for your time and input.
The reason I choose textarea over textfield, was textarea was returning the position information of the cursor via selectionstart and selectionend. For some reason using textfield instead was not returning this information, always a 0. I just thought because the information being returned in the textarea was more robust, I did not have to add code to keep track of the cursor position. This may be a bug with textfield or I maybe using the control improperly. I can keep a separate variable for cursor position.
This a not a Android or IOS app, that has a visible keyboard, this is a touch screen only app on a customized display I designed. I need to draw a keyboard and keep track of cursor position for the editing capabilities behind certain key presses. A mini word processor so to say. The textarea was a bit more robust as a control for this versus the textfield control due to a lack of location tracking.
Unfortunately this does not give me a warm and toasty feeling for the software environment, and a number of the workarounds for other issues in general seem to be heavily slanted towards a rather robust knowledge of Java (which I don't have.)

Unfortunately since I was adopted, in Vienna, I have no actual knowledge of my birth parents. My adopted father Oscar Spitzer (Viennese) died when I was 3 years old. His family and others all died in the concentration camps during the war and he escaped. The only information I have about myself is my actual real name (Stephen Vincent Handl) and really don't have an idea as to how to track any of this original information down back in Vienna. I suspect after all this time my birth parents are no longer among us.

Lastly, if you ever decide to come out here, we have a couple of spare bedrooms and will gladly act as a free Air BNB.
 
Last edited:
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Hi, i made a test program to check your problem of selectionstart and selectionend. I made a form with both controls, and in the logs i printed the values. On my side i could not see any difference between textarea and textedit. I also made timer control to show values of selectionstart and selectionend of Textfield and i always get correct values.
I think the sizing behaviour of textarea is a problem/behaviour of javafx.

I am member of myheritage.com and I also have knowledge, how to find former relatives with internet research in austria. But there is a 100 year privacy zone, so here in austria I can research all peoples, who are born before 1919, married and died before 1939. What would be needed, is the name of the person, name of the roman catholic parish and the date of birth. In case of jewish people I have no experience.

In the current virus situation it looks, that the next travel is far away; my son is dreaming of a carreer in US, starting with stanford, we will see, how the future evolves.
 
Upvote 0

rspitzer

Active Member
Can you send me the test program? I already came to the thought that the sizing problem was a JavaFX issue unfortunately. From what you are telling me about selectionstart and selectionend, must be an issue on how I am using it. The idea of using a timer is a bit new to me.

I don't live far from Stanford, - though a rather expensive school. Like I mentioned earlier (an provide a place to stay to cut down the cost of a visit), Having a career in the US is an interesting thought, but the grass is always greener on the other side so to say. I would prefer a place in Europe right now LOL. My son works for a large company that deals in measuring the data metrics of who is listening to what streaming channels to target proper advertisement placement. His project involves podcasts right now. My daughter worked at the Hague Criminal Courts last year as an intern when she was an overseas student (through her university), her major was journalism, which is a field that is rather hard to get a proper job in. She is also now working temporarily for a large TV network in advertising placement and doing a lot of the new GIG work on the side for several websites.

Unfortunately for me, my father and his relatives are a bit of a mystery to me, I have no information on the names of his relatives etc.. and of course on top of that he is Jewish, like myself. The only thing I know about my actual parents were that at the time of my birth, my father was in Jail, he was a bit of a con man, selling ocean front property in Vienna as the story goes. And my mother was a lady of the evening, having more than one child, in this case there were actually eight of us spaced out of course until the state stepped in. The only thing I know about her was she traveled from Germany originally after the War, and worked in Vienna. But this is all hearsay as they would say in a court.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
This sample i created to compare textfield and textarea; a timer showed the actual values. I tried first to get the values with an button, but because the focus leaves the textobjects i lost also the selection information. The timer has no focus and can constantly show the values. I hope, that this sample can bring maybe some new aspects for solving your problem.
 

Attachments

  • Test1.zip
    2.7 KB · Views: 118
Upvote 0

rspitzer

Active Member
Thanks for the sample, as usual, my stupidity on understanding events in general. The issue was basically with selectionstart and or selectionend was that I was not treating it as an event, I was burying the code within a routine, so of course the value would always be zero since the routine would need to finish its event (displaying a character) before the selectionstart and or selectionend would have a value (a changed event being fired). I am glad to find this out now, I am sure I would have had other problems with other routines that required and event to finish first.
 
Upvote 0
Top