当前位置: 首页>>代码示例>>Java>>正文


Java ToolBar.setOrientation方法代码示例

本文整理汇总了Java中javafx.scene.control.ToolBar.setOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java ToolBar.setOrientation方法的具体用法?Java ToolBar.setOrientation怎么用?Java ToolBar.setOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.ToolBar的用法示例。


在下文中一共展示了ToolBar.setOrientation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
  final HBox root = new HBox();
  final ToolBar toolbar = new ToolBar();
  toolbar.setOrientation(Orientation.VERTICAL);
  toolbar.getItems().add(new Button("button 1"));
  toolbar.getItems().add(new Button("button 2"));
  toolbar.getItems().add(new VerticalSpace());
  toolbar.getItems().add(new Button("button 3"));
  toolbar.getItems().add(new VerticalSpace(100));
  toolbar.getItems().add(new Button("button 4"));
  toolbar.getItems().add(new Button("button 5"));

  root.getChildren().add(toolbar);
  primaryStage.setTitle("VerticalSpace Sample");
  primaryStage.setScene(new Scene(root, 300, 300));
  primaryStage.show();
}
 
开发者ID:Haixing-Hu,项目名称:javafx-widgets,代码行数:19,代码来源:VerticalSpaceTest.java

示例2: Zoombar

import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
/**
 * Create a new Toolbar.
 *
 * @param currentZoom
 *            the current starting zoom level.
 * @param maxZoom
 *            the maximal value of the zoom.
 */
public Zoombar(final int currentZoom, final int maxZoom) {
    maxzoom = maxZoom;
    zoomLevel = new SimpleIntegerProperty();

    zoomLevel.set(currentZoom);
    slider = createSlider();

    slider.getStyleClass().add("slider");
    slider.valueProperty().addListener(
            (obserVal, oldVal, newVal) -> {
                if (oldVal.intValue() != newVal.intValue()
                        && newVal.intValue() <= maxzoom) {
                    zoomLevel.set(newVal.intValue());
                }
            });

    Button plus = new Button("+");
    plus.getStyleClass().add("plusButton");
    plus.setOnMouseClicked((event) -> {
        slider.setValue(slider.getValue() - slider.getMajorTickUnit());
    });

    Button minus = new Button("-");
    minus.getStyleClass().add("minusButton");
    minus.setOnMouseClicked((event) -> {
        slider.setValue(slider.getValue() + slider.getMajorTickUnit());
    });

    toolbar = new ToolBar();
    toolbar.getStyleClass().add("toolbar");

    toolbar.getItems().addAll(minus, slider, plus);
    toolbar.setOrientation(Orientation.VERTICAL);
}
 
开发者ID:ProgrammingLife2015,项目名称:LifeTiles,代码行数:43,代码来源:Zoombar.java

示例3: VerticalChildren

import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
public VerticalChildren(int n) {
  super();
  final SplitPaneEx splitPane = new SplitPaneEx();
  splitPane.setOrientation(Orientation.VERTICAL);
  HBox.setHgrow(splitPane, Priority.ALWAYS);
  for (int i = 0; i < n; ++i) {
    final LabelPane child = new LabelPane("Child " + (i+1));
    child.setMinWidth(CHILD_MIN_WIDTH);
    child.setPrefWidth(CHILD_PREF_WIDTH);
    child.setMaxWidth(CHILD_PREF_WIDTH * 2);
    splitPane.getItems().add(child);
  }
  final double pos = 1.0 / n;
  for (int i = 0; i < (n - 1); ++i) {
    splitPane.setDividerPosition(i, pos * (i + 1));
  }

  final ToolBar toolBar = new ToolBar();
  toolBar.setOrientation(Orientation.VERTICAL);
  HBox.setHgrow(toolBar, Priority.NEVER);
  for (int i = 0; i < n; ++i) {
    final Button hide = new Button("Hide " + (i+1));
    hide.setOnAction(new HideChildAction(splitPane, i));
    final Button show = new Button("Show " + (i+1));
    show.setOnAction(new ShowChildAction(splitPane, i));
    toolBar.getItems().addAll(hide, show);
  }
  getChildren().addAll(splitPane, toolBar);
}
 
开发者ID:Haixing-Hu,项目名称:javafx-widgets,代码行数:30,代码来源:SplitPaneExTest.java

示例4: makeTools

import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
private ToolBar makeTools()
{
	ToolBar tools = new ToolBar();
	tools.setOrientation(Orientation.HORIZONTAL);
	
	timing = new Text("00000000");
	timing.setFont(new Font("Consolas", 30d));
	timing.setStroke(Color.BLUE);
	timing.setFill(Color.BLUE);
	tools.getItems().add(timing);

	Button full = new Button("Full");
	full.setOnAction(event -> stage.setFullScreen(true));
	tools.getItems().add(full);

	Button home = new Button("||<--");
	home.setOnAction(event -> player.start());
	tools.getItems().add(home);

	Button oneOff = new Button("OneOff");
	oneOff.setOnAction(event -> oneOff());
	tools.getItems().add(oneOff);

	Button backwards = new Button("<--");
	backwards.setOnAction(event -> player.backward());
	tools.getItems().add(backwards);

	Button play = new Button(">");
	play.setOnAction(event -> player.play());
	
	BooleanBinding trueIfPlaying = Bindings.createBooleanBinding(() -> player.getState()==PlayerState.Playing,player.stateProperty());
	play.disableProperty().bind(trueIfPlaying);
	tools.getItems().add(play);

	Button playOne = new Button(">|");
	playOne.setOnAction(event -> player.playOne());
	playOne.disableProperty().bind(trueIfPlaying);
	tools.getItems().add(playOne);

	Button forwards = new Button("-->");
	forwards.setOnAction(event -> player.forward());
	forwards.disableProperty().bind(trueIfPlaying);
	tools.getItems().add(forwards);

	Button end = new Button("-->||");
	end.setOnAction(event -> player.end());
	tools.getItems().add(end);
	
	Button timinusTwo = new Button("T-2");
	timinusTwo.setOnAction(event -> player.penultimate());
	tools.getItems().add(timinusTwo);

	Button tminusOne = new Button("T-1");
	tminusOne.setOnAction(event -> player.ultimate());
	tools.getItems().add(tminusOne);
	
	Button markHere = new Button("Mark");
	markHere.setOnAction(event -> markHere(tools));
	tools.getItems().add(markHere);

	return tools;
}
 
开发者ID:GeePawHill,项目名称:contentment,代码行数:63,代码来源:MainView.java

示例5: start

import javafx.scene.control.ToolBar; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
    /*
    Import Rubik's Cube model and arrows
    */
    rubik=new Rubik();
    // create toolbars
    ToolBar tbTop=new ToolBar(new Button("U"),new Button("Ui"),new Button("F"),
                              new Button("Fi"),new Separator(),new Button("Y"),
                              new Button("Yi"),new Button("Z"),new Button("Zi"));
    pane.setTop(tbTop);
    ToolBar tbBottom=new ToolBar(new Button("B"),new Button("Bi"),new Button("D"),
                                 new Button("Di"),new Button("E"),new Button("Ei"));
    pane.setBottom(tbBottom);
    ToolBar tbRight=new ToolBar(new Button("R"),new Button("Ri"),new Separator(),
                                new Button("X"),new Button("Xi"));
    tbRight.setOrientation(Orientation.VERTICAL);
    pane.setRight(tbRight);
    ToolBar tbLeft=new ToolBar(new Button("L"),new Button("Li"),new Button("M"),
                               new Button("Mi"),new Button("S"),new Button("Si"));
    tbLeft.setOrientation(Orientation.VERTICAL);
    pane.setLeft(tbLeft);
    
    pane.setCenter(rubik.getSubScene());
    
    pane.getChildren().stream()
        .filter(n -> (n instanceof ToolBar))
        .forEach(tb->{
            ((ToolBar)tb).getItems().stream()
                .filter(n -> (n instanceof Button))
                .forEach(n->((Button)n).setOnAction(e->rubik.rotateFace(((Button)n).getText())));
        });
    rubik.isOnRotation().addListener((ov,b,b1)->{
        pane.getChildren().stream()
        .filter(n -> (n instanceof ToolBar))
        .forEach(tb->tb.setDisable(b1));
    });
    final Scene scene = new Scene(pane, 880, 680, true);
    scene.setFill(Color.ALICEBLUE);
    stage.setTitle("Rubik's Cube - JavaFX3D");
    stage.setScene(scene);
    stage.show();
}
 
开发者ID:jperedadnr,项目名称:LiteRubikFX,代码行数:44,代码来源:LiteRubikFX.java


注:本文中的javafx.scene.control.ToolBar.setOrientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。