本文整理匯總了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));
}