B4J Question Flat controls

Marc Van Cauwenberghe

Member
Licensed User
Longtime User
Hi,

Trying my hand at making my first java program.
A lot of controls (views ) are kinda 3D. Is there a way to get them flat?

upload_2019-3-23_16-23-41-png.78703


Best regards,
Marc
 

Daestrum

Expert
Licensed User
Longtime User
An example (but looks horrid) not sure how many controls it contains.
B4X:
 ' download jmetro-5.2.jar and save in additional libraries folder
 ' include  #AdditionalJar: jmetro-5.2.jar
...
 Dim theme As JavaObject
 theme.InitializeNewInstance("jfxtras.styles.jmetro8.JMetro",Array("LIGHT"))' or DARK
 theme.RunMethod("applyTheme",Array(MainForm.RootPane)) ' apply to rootpane ie everything
...
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Source: https://stackoverflow.com/questions/21451386/titled-pane-css-settings
This will help you get started:

Create a css file named style.css with:
B4X:
.titled-pane > .title
{
-fx-background-color: -fx-box-border, -fx-inner-border, white;
-fx-background-insets: 0, 1, 2;
-fx-background-radius: 5 5 0 0, 4 4 0 0, 3 3 0 0;
-fx-padding: 0.166667em 0.833333em 0.25em 0.833333em; /* 2 10 3 10 */
}

Set it with:
B4X:
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "style.css"))

SS-2019-03-24_08.54.56.png
 
Upvote 0
Top