Views
4 months ago

tornadofx-guide

7. Layouts and Menus

7. Layouts and Menus Css-Class Css- Property Default Description .list-menu -fx-graphicfixed-size 2em The graphic size. .list-menu .list-item -fx-cursor hand .list-menu .list-item -fx-padding 10 The cursor symbol. The padding for each item .list-menu .list-item -fxbackgroundcolor -fx-shadow-highlight-color, -fx-outerborder, -fx-inner-border, -fx-bodycolor The color of the item .list-menu .list-item -fxbackgroundinsets 0 0 -0.5 0, 0, 0.5, 1.5 The insets of each item . .list-menu .list-item .label -fx-text-fill -fx-text-base-color The text color of each item . Pseudo Classes Pseudo- Class Css- Property Default Description .list-menu .listitem:active -fxbackgroundcolor -fx-focus-color, -fx-inner-border, - fx-body-color, -fx-faint-focus-color, -fx-body-color The color will be set if the item is active. .list-menu .listitem:active -fxbackgroundinsets -0.2, 1, 2, -1.4, 2.6 Insets will be set if the item is active. .list-menu .listitem:hover -fx-color -fx-hover-base The hover color. Have a look at the default Stylesheet for the ListMenu Item The item builder allows to create items for the ListMenu in a very convenient way. The following syntax is supported: 112

7. Layouts and Menus item("SomeText", graphic = SomeNode, tag = SomeObject) { // Marks this item as active. activeItem = this } // Do some action when selected whenSelected { /* Action */ } Attribute Builder- Attribute Type Default Description text yes String? null tag yes Any? null graphic yes Node? null The text which should be set for the given item . The Tag can be any object or null and can be useful to identify the ListItem The graphic can be any Node and will be displayed beside the given text . Function Description whenSelected A convince function, which will be called anytime the given ListMenuItem is selected. Filling the parent container The useMaxWidth property can be used to fill the parent container horizontally. The useMaxHeight property will fill the parent container vertically. These properties actually applies to all Nodes, but is especially useful for the ListMenu . SqueezeBox JavaFX has an Accordion control that lets you group a set of TilePanes together to form an accordion of controls. The JavaFX Accordion only lets you open a single accordion fold at a time, and it has some other shortcomings. To solve this, TornadoFX comes with the SqueezeBox component that behaves and looks very similar to the Accordion, while providing some enhancements. 113

GUIDE
GUIDE
Guide
Guide
GUIDE
Guide
GUIDE
GUIDE
GUIDE
GUIDE