Views
1 month ago

tornadofx-guide

7. Layouts and Menus You

7. Layouts and Menus You can style the SqueezeBox like you style a TitlePane. The close button has a css class called close-button and the container has a css class called squeeze-box . Drawer The Drawer is a navigation component much like a TabPane, but it organizes each drawer item in a vertically or horizontally placed button bar on either side of the parent container. It resembles the tool drawers found in many popular business applications and IDEs. When an item is selected, the content for the item is displayed next to or above/below the buttons in a content area spanning the height or width of the control and the preferred width or height of the content, depending on whether it is docked in a vertical or horizontal side of the parent. In multiselect mode it will even let you open multiple drawer items simutaneously and have them share the space between them. They will always open in the order of the corresponding buttons. 116

7. Layouts and Menus class DrawerView : View("TornadoFX Info Browser") { override val root = drawer { item("Screencasts", expanded = true) { webview { prefWidth = 470.0 engine.userAgent = iPhoneUserAgent engine.load(TornadoFXScreencastsURI) } } item("Links") { listview(links) { cellFormat { link -> graphic = hyperlink(link.name) { setOnAction { hostServices.showDocument(link.uri) } } } } } item("People") { tableview(people) { column("Name", Person::name) column("Nick", Person::nick) } } } class Link(val name: String, val uri: String) class Person(val name: String, val nick: String) } // Sample data variables left out (iPhoneUserAgent, TornadoFXScreencastsURI, people and links) Figure 7.19 117

GUIDE
Guide
GUIDE
Guide
GUIDE
GUIDE
Guide
GUIDE
Guide
Guide
Guide
GUIDE
GUIDE