當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。