本文整理汇总了Java中javafx.scene.control.ToolBar.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java ToolBar.getItems方法的具体用法?Java ToolBar.getItems怎么用?Java ToolBar.getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ToolBar
的用法示例。
在下文中一共展示了ToolBar.getItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showCompactToolbar
import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
private void showCompactToolbar(final BorderPane mainPane, final BorderPane centerPane,
final ToolBar toolbar, final boolean showCompact) {
final boolean isToolbarHidden = !showToolbarMenuItem.isSelected();
mainPane.setTop(showCompact || isToolbarHidden? null : toolbar);
centerPane.setTop(!showCompact || isToolbarHidden? null : toolbar);
toolbar.setId(showCompact? centerPane.getId() : mainPane.getId());
final Button pauseButton = toolbarButtonsMap.get(ImageUtils.PAUSE_ICON_LOCATION);
final Button rssButton = toolbarButtonsMap.get(ImageUtils.RSS_ICON_LOCATION);
final ObservableList<Node> toolbarButtons = toolbar.getItems();
if(showCompact) {
toolbarButtons.removeAll(pauseButton, rssButton);
}
else if(!isExpandedToolbar(toolbar)) {
//Add Pause button after Start Torrent and RSS button after Add from URL button respectively
final int rssButtonIndex = toolbarButtons.indexOf(toolbarButtonsMap.get(ImageUtils.LINK_ICON_LOCATION));
toolbarButtons.add(rssButtonIndex + 1, rssButton);
final int downloadButtonIndex = toolbarButtons.indexOf(toolbarButtonsMap.get(ImageUtils.DOWNLOAD_ICON_LOCATION));
toolbarButtons.add(downloadButtonIndex + 1, pauseButton);
}
}
示例2: addKeyListeners
import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
/**
* Add the key combination listeners for firing the "Italic" and "Underline" button.
* (Work around for the issue)
*/
private void addKeyListeners() {
final KeyCombination icombination=new KeyCodeCombination(KeyCode.I,KeyCombination.CONTROL_DOWN);
final KeyCombination ucombination=new KeyCodeCombination(KeyCode.U,KeyCombination.CONTROL_DOWN);
final SimpleObjectProperty<ToggleButton> italicBtn = new SimpleObjectProperty<ToggleButton>();
final SimpleObjectProperty<ToggleButton> underlineBtn = new SimpleObjectProperty<ToggleButton>();
ToolBar bar = (ToolBar)this.lookup(".bottom-toolbar");
for (Node node : bar.getItems()) {
if(node instanceof ToggleButton && node.getUserData().equals("italic")){
italicBtn.set ( (ToggleButton)node);
}else if(node instanceof ToggleButton && node.getUserData().equals("underline")){
underlineBtn.set ( (ToggleButton)node);
}
}
this.addEventHandler(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if(icombination.match(event)){
italicBtn.get().fire();
}else if(ucombination.match(event)){
underlineBtn.get().fire();
}
}
});
}
示例3: isExpandedToolbar
import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
private boolean isExpandedToolbar(final ToolBar toolbar) {
final ObservableList<Node> toolbarButtons = toolbar.getItems();
return toolbarButtons.contains(toolbarButtonsMap.get(ImageUtils.PAUSE_ICON_LOCATION)) &&
toolbarButtons.contains(toolbarButtonsMap.get(ImageUtils.RSS_ICON_LOCATION));
}