本文整理汇总了Java中javafx.scene.control.ToolBar类的典型用法代码示例。如果您正苦于以下问题:Java ToolBar类的具体用法?Java ToolBar怎么用?Java ToolBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ToolBar类属于javafx.scene.control包,在下文中一共展示了ToolBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChildren
import javafx.scene.control.ToolBar; //导入依赖的package包/类
private ObservableList<Node> getChildren(Node node) {
if (node instanceof ButtonBar) {
return ((ButtonBar) node).getButtons();
}
if (node instanceof ToolBar) {
return ((ToolBar) node).getItems();
}
if (node instanceof Pane) {
return ((Pane) node).getChildren();
}
if (node instanceof TabPane) {
ObservableList<Node> contents = FXCollections.observableArrayList();
ObservableList<Tab> tabs = ((TabPane) node).getTabs();
for (Tab tab : tabs) {
contents.add(tab.getContent());
}
return contents;
}
return FXCollections.observableArrayList();
}
示例2: start
import javafx.scene.control.ToolBar; //导入依赖的package包/类
@Override public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Simple Web Server");
BorderPane root = new BorderPane();
TextArea area = new TextArea();
root.setCenter(area);
ToolBar bar = new ToolBar();
Button openInBrowser = FXUIUtils.createButton("open-in-browser", "Open in External Browser", true);
openInBrowser.setOnAction((event) -> {
try {
Desktop.getDesktop().browse(URI.create(webRoot));
} catch (IOException e) {
e.printStackTrace();
}
});
Button changeRoot = FXUIUtils.createButton("fldr_closed", "Change Web Root", true);
changeRoot.setOnAction((event) -> {
DirectoryChooser chooser = new DirectoryChooser();
File showDialog = chooser.showDialog(primaryStage);
if (showDialog != null)
server.setRoot(showDialog);
});
bar.getItems().add(openInBrowser);
bar.getItems().add(changeRoot);
root.setTop(bar);
System.setOut(new PrintStream(new Console(area)));
System.setErr(new PrintStream(new Console(area)));
area.setEditable(false);
primaryStage.setScene(new Scene(root));
primaryStage.setOnShown((e) -> startServer(getParameters().getRaw()));
primaryStage.show();
}
示例3: initCheckList
import javafx.scene.control.ToolBar; //导入依赖的package包/类
private void initCheckList() {
ToolBar toolBar = new ToolBar();
toolBar.getItems().add(new Text("Check Lists"));
toolBar.setMinWidth(Region.USE_PREF_SIZE);
leftPane.setTop(toolBar);
checkListElements = checkListInfo.getCheckListElements();
checkListView = new ListView<CheckListForm.CheckListElement>(checkListElements);
checkListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
CheckListElement selectedItem = checkListView.getSelectionModel().getSelectedItem();
if (selectedItem == null) {
doneButton.setDisable(true);
return;
}
Node checkListForm = getChecklistFormNode(selectedItem, Mode.DISPLAY);
if (checkListForm == null) {
doneButton.setDisable(true);
return;
}
doneButton.setDisable(false);
ScrollPane sp = new ScrollPane(checkListForm);
sp.setFitToWidth(true);
sp.setPadding(new Insets(0, 0, 0, 10));
rightPane.setCenter(sp);
});
leftPane.setCenter(checkListView);
}
示例4: GanttChart
import javafx.scene.control.ToolBar; //导入依赖的package包/类
public GanttChart() {
timelineView = new TimelineView();
timelineViewToolBar = new ToolBar();
initTimelineViewToolBar();
taskView = new TaskTableView(TASK_DATE_FORMAT);
taskView.addTaskListener(this);
taskViewToolBar = new ToolBar();
initTaskViewToolBar();
metadata = new GanttData();
metadata.ganttNameProperty().bind(projectName.baseTextProperty());
metadata.chartStartDateProperty().bind(dpStart.valueProperty());
metadata.chartEndDateProperty().bind(dpEnd.valueProperty());
metadata.setRoot(getGanttRoot());
saved = false;
}
示例5: initializeContainers
import javafx.scene.control.ToolBar; //导入依赖的package包/类
/**
* Initializes the container which contains all the contents of the design board.
*/
private void initializeContainers () {
this.setText(designboardProperties.getString("DesignBoardName"));
this.setClosable(false);
contentPane = new StackPane();
contentPane.setMinSize(width, height);
scroller = new ScrollPane();
scroller.setContent(contentPane);
zoomBar = new ToolBar();
container = new VBox(zoomBar, scroller);
this.setContent(container);
y_offset = width * RESIZE_FACTOR;
x_offset = height * RESIZE_FACTOR;
}
示例6: dnd
import javafx.scene.control.ToolBar; //导入依赖的package包/类
protected void dnd() throws InterruptedException {
sceneSource.mouse().click(1, new Point(0, 0));
Wrap from = Lookups.byID(sceneSource, ID_DRAG_SOURCE, Node.class);
Wrap to = Lookups.byID(sceneTarget, ID_DRAG_TARGET, Node.class);
Point fromPoint = from.getClickPoint();
Point toPoint = to.getClickPoint();
final Object fromControl = from.getControl();
if (fromControl instanceof MenuBar || fromControl instanceof ToolBar
|| fromControl instanceof ScrollPane || fromControl instanceof Pagination) {
fromPoint = new Point(2, 2);
}
if (fromControl instanceof TitledPane) {
fromPoint = new Point(5, 30);
}
final Object toControl = to.getControl();
if (toControl instanceof MenuBar || toControl instanceof ToolBar
|| toControl instanceof ScrollPane || toControl instanceof Pagination) {
toPoint = new Point(2, 2);
}
if (toControl instanceof TitledPane) {
toPoint = new Point(30, 30);
}
dnd(from, fromPoint, to, toPoint);
}
示例7: setUp
import javafx.scene.control.ToolBar; //导入依赖的package包/类
@Before
@Override
public void setUp() {
super.setUp();
Orientation orientation = new GetAction<Orientation>() {
@Override
public void run(Object... os) throws Exception {
setResult(((ToolBar) os[0]).getOrientation());
}
}.dispatch(Root.ROOT.getEnvironment(), toolBar.getControl());
if (orientation == Orientation.VERTICAL) {
verticalBtn.mouse().click();
toolBar.waitProperty(ToolBarWrap.VERTICAL_PROP_NAME, false);
}
}
示例8: createToolBar
import javafx.scene.control.ToolBar; //导入依赖的package包/类
/** override to create your own toolbar, possibly with custom icons and buttons */
protected Node createToolBar(boolean tabMode)
{
if(tabMode)
{
return null;
}
else
{
Button b = new Button("x");
FX.style(b, FxDockStyles.TOOLBAR_CLOSE_BUTTON);
closeAction.attach(b);
ToolBar t = new ToolBar();
FX.style(t, FxDockStyles.TOOLBAR);
t.getItems().addAll(titleField, b);
return t;
}
}
示例9: initControls
import javafx.scene.control.ToolBar; //导入依赖的package包/类
private void initControls()
{
this.setText(this.subject.getAbsolutePath());
ToolBar actionBar = new ToolBar();
this.saveButton = Icons.buildIconButton("Save", Icons.ICON_SAVE);
this.saveButton.getStyleClass().add("small-button");
this.switchModeButton = new Button("View");
this.switchModeButton.getStyleClass().add("small-button");
this.resetButton = Icons.buildIconButton("Reload", Icons.ICON_RELOAD);
this.resetButton.getStyleClass().add("small-button");
actionBar.getItems().addAll(this.saveButton, this.resetButton, this.switchModeButton);
VBox.setVgrow(actionBar, Priority.NEVER);
this.editorArea = new TextArea();
this.editorArea.getStyleClass().add("editor-area-monospaced");
VBox.setVgrow(this.editorArea, Priority.ALWAYS);
this.formattedView = new WebView();
VBox.setVgrow(this.formattedView, Priority.ALWAYS);
this.layout = new VBox();
this.layout.getChildren().addAll(actionBar);
this.setContent(this.layout);
this.getStyleClass().add("open-file-tab");
}
示例10: start
import javafx.scene.control.ToolBar; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
BorderPane pane = new BorderPane();
ToolBar toolBar = new ToolBar();
Label fileLabel = new Label("File");
flyout = createFlyout();
// Could be TOP, LEFT, RIGHT too!
flyout.setFlyoutSide(Flyout.Side.BOTTOM);
toolBar.getItems().addAll(
fileLabel,
new Separator(),
flyout
);
pane.setTop(toolBar);
Scene scene = new Scene(pane, 600, 200);
primaryStage.setScene(scene);
primaryStage.show();
}
示例11: clickOnPlus
import javafx.scene.control.ToolBar; //导入依赖的package包/类
@Test
public void clickOnPlus() {
// Hack because javafx toolkit need to be initialized
JFXPanel panel = new JFXPanel();
panel.contains(0, 0);
Zoombar toolbar = new Zoombar(5, 10);
ToolBar javafxBar = toolbar.getToolBar();
int initZoom = toolbar.getZoomlevel().intValue();
Button plus = (Button) javafxBar.getItems().get(0);
Event.fireEvent(plus, new MouseEvent(MouseEvent.MOUSE_CLICKED, 0, 0, 0,
0, MouseButton.PRIMARY, 1, true, true, true, true, true, true,
true, true, true, true, null));
assertEquals(initZoom + 1, toolbar.getZoomlevel().intValue(), 1e-10);
}
示例12: clickOnMinus
import javafx.scene.control.ToolBar; //导入依赖的package包/类
@Test
public void clickOnMinus() {
// Hack because javafx toolkit need to be initialized
JFXPanel panel = new JFXPanel();
panel.contains(0, 0);
Zoombar toolbar = new Zoombar(5, 10);
ToolBar javafxBar = toolbar.getToolBar();
int initZoom = toolbar.getZoomlevel().intValue();
Button minus = (Button) javafxBar.getItems().get(2);
Event.fireEvent(minus, new MouseEvent(MouseEvent.MOUSE_CLICKED, 0, 0,
0, 0, MouseButton.PRIMARY, 1, true, true, true, true, true,
true, true, true, true, true, null));
assertEquals(initZoom - 1, toolbar.getZoomlevel().intValue(), 1e-10);
}
示例13: scrolloneUpSlider
import javafx.scene.control.ToolBar; //导入依赖的package包/类
@Test
public void scrolloneUpSlider() {
// Hack because javafx toolkit need to be initialized
JFXPanel panel = new JFXPanel();
panel.contains(0, 0);
Zoombar toolbar = new Zoombar(5, 10);
ToolBar javafxBar = toolbar.getToolBar();
int initZoom = toolbar.getZoomlevel().intValue();
Slider slider = (Slider) javafxBar.getItems().get(1);
slider.valueProperty().set(slider.valueProperty().get() + 1);
assertEquals(initZoom + 1, toolbar.getZoomlevel().intValue(), 1e-10);
}
示例14: 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);
}
}
示例15: GeneratorAppView
import javafx.scene.control.ToolBar; //导入依赖的package包/类
/**
* Instantiates a new Generator app view.
*
* @param action the action
*/
public GeneratorAppView(Action action)
{
// AeroFX.style();
// AquaFx.style();
tabLookup = new HashMap<>();
this.action = action;
ToolBar mainBar = new ToolBar();
Label appLabel = new Label("BURST Address Generator");
mainBar.getItems().add(appLabel);
tabPane = new TabPane();
ToolBar statusBar = new ToolBar();
statusBar.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
statusBar.getItems().add(new Label("Version: 0.2.3-SNAPSHOT"));
setTop(mainBar);
setCenter(tabPane);
setBottom(statusBar);
}