B4J Question Wonky Colors

dilettante

Active Member
Licensed User
Longtime User
This isn't a complaint, just a question prompted by early impressions.

Everything new takes getting used to but I was curious whether B4J UI applications can be expected to default to "normal" system colors on various platforms when run.

Just beginning to tinker, the "Form" I am using is the default thingy, an AnchorPane. Side rant: egad it is frustrating that everyone has to make up new doofy names for common things to escape the lawyers. Seriously? "Scenes?" Oh well.

Anyhoo... this thing comes up with a dark gray background. Yes, I have spelunked the JavaFX online docs and figured out the CSS but it seems to require fixed colors. Of course knowing how these things work I am sure there is some more complex dynamic process you can use to script it to generate colors on the fly or something.

Can anyone tell me where Modena – new theme for JavaFX 8 might come in here? I.e. do these JavaFX themes apply in B4J usage and if they do will "system color" matching have to wait for JavaFX 8?

Or is there something else I'm missing?

Or should I just relax and either hard-code styles to my preferences and have things be eye-jarring (even going from version to version of Windows) or what?
 

agraham

Expert
Licensed User
Longtime User
I was curious whether B4J UI applications can be expected to default to "normal" system colors on various platforms when run.
No, the UI look and feel is entirely separate from any native UI.

Anyhoo... this thing comes up with a dark gray background. ... generate colors on the fly or something.
Do you mean like -
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
   ...
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.BackColor = fx.Colors.LightGray
   ...
    MainForm.Show
End Sub

Can anyone tell me where Modena – new theme for JavaFX 8 might come in here? I.e. do these JavaFX themes apply in B4J usage and if they do will "system color" matching have to wait for JavaFX 8?
It doesn't apply to JavaFX 2.2 and when it is available will be a fixed look and feel just like Caspian, the present default UI for JavaFX 2.2,
 
Upvote 0

dilettante

Active Member
Licensed User
Longtime User
I was referring to setting the colors at design-time using JavaFX CSS, i.e. -fx-background-color: #ffff00 entered into the Style property in the Scene Builder. However I see that it also has a Preview|Choose Background Color... menu selection and dialog that seems to set some more global background color default. Oops, that only applies to the node/element/whatever background while working in Scene Builder.

What I was hoping for was a way to have controls ("nodes") take advantage of system UI colors for easier adherence to development design guidelines across platforms.
 
Upvote 0

dilettante

Active Member
Licensed User
Longtime User
It sounds like this is a known limitation of JavaFX:

Native looking skins for JavaFX 2 on Windows 7 & Mac OS X 10.7
JavaFX 2 is a great technology. It’s so easy to develop beautiful apps with FXML and CSS. But unforunatly – in contrast to Swing – there is no support for the native look and feel for Windows, Mac and Linux. So if you write a JavaFX 2 app it looks like a JavaFX 2 app. But many user – especially Mac users – want to have Mac OS X apps which look and feel like Mac OS X apps.
So in my opinion it’s very important to deliver JavaFX 2 skins for Windows 7 and Mac OS X 10.7 which look and feel like their native original. Oracle’s goal was to replace Swing by FX2. So in my opinion it’s absolutely necessary to provide the same quality of Look-and-Feels for Windows, Mac and Linux like Swing do! Otherwise JavaFX2 is no real replacement for Swing.

Not a deal breaker but a little disappointing.
 
Upvote 0

dilettante

Active Member
Licensed User
Longtime User
Well the silence seems to indicate that everyone just slaps in some color for every Form at design-time or runtime. The rest of you must be doing something since Label text against the default background is unreadable.

Bizarre though, I thought the Caspian CSS skin was supposed to use some color like LightGray for backgounds by default.
 
Upvote 0

dilettante

Active Member
Licensed User
Longtime User
B4J 1.00 Beta 5, brand new project, same old colors.

Is your change coming in the next beta? Sorry to be a pain about this.
 
Upvote 0

dilettante

Active Member
Licensed User
Longtime User
Thank you for your patience with this trivial matter, but this still doesn't seem quite right.

White is far better than that DarkGray as a default backdrop color, but doesn't seem to be what one would expect of the Caspian skin. See Skinning JavaFX Applications with CSS and scroll down to the "Default Style Sheet" subtopic, which shows the default color scheme one would expect under Windows.

Clearly the background color is not White but more like LightGray, having some slight contrast with the whiter color of, say, a TextArea.

I can live with the White, don't get me wrong. Just trying to provide some feedback.
 
Upvote 0

dilettante

Active Member
Licensed User
Longtime User
You could be 100% correct about that.

Yes I can tweak the colors myself of course. I was just hoping to head off anything that might cause people to turn up their noses at B4J.

Thank you for your attention to this, I realize how minor it is.
 
Upvote 0
Top