M micro Well-Known Member Licensed User Longtime User Jul 18, 2015 #1 Hi to all there is an easy way how to get a background color of a panel? (I change the background color in certain situations) I do not want to use several variables to check the status of the bachground color. Thanks
Hi to all there is an easy way how to get a background color of a panel? (I change the background color in certain situations) I do not want to use several variables to check the status of the bachground color. Thanks
R Roycefer Well-Known Member Licensed User Longtime User Jul 18, 2015 #2 B4J doesn't use Panels, it uses Panes. If you're trying to change the background color of a JavaFX Pane in B4J, that is done through the Pane.Style property: Code: Copy Dim p as Pane p.Initialize("p") p.Style = "-fx-background-color:chartreuse" 'sets the Pane's background color with a CSS String Log("p's background color: " & Regex.Split(":", p.Style)(1)) 'gets the Pane's CSS String, extracts the color and Logs it Be warned, though, that this method is brittle and it's more flexible to store the desired color value in a variable that you can plug into a much larger CSS template String as you desire. The CSS Strings can do much more than just set background colors. You'll have to do a little more work now, but you'll save yourself a lot of work in the future if you decide to style other aspects of the Pane. Upvote 0
B4J doesn't use Panels, it uses Panes. If you're trying to change the background color of a JavaFX Pane in B4J, that is done through the Pane.Style property: Code: Copy Dim p as Pane p.Initialize("p") p.Style = "-fx-background-color:chartreuse" 'sets the Pane's background color with a CSS String Log("p's background color: " & Regex.Split(":", p.Style)(1)) 'gets the Pane's CSS String, extracts the color and Logs it Be warned, though, that this method is brittle and it's more flexible to store the desired color value in a variable that you can plug into a much larger CSS template String as you desire. The CSS Strings can do much more than just set background colors. You'll have to do a little more work now, but you'll save yourself a lot of work in the future if you decide to style other aspects of the Pane.
M micro Well-Known Member Licensed User Longtime User Jul 18, 2015 #3 Ok, Thanks (For panel i meant pane). Upvote 0