當前位置: 首頁>>代碼示例>>Java>>正文


Java TabPane.setPrefSize方法代碼示例

本文整理匯總了Java中javafx.scene.control.TabPane.setPrefSize方法的典型用法代碼示例。如果您正苦於以下問題:Java TabPane.setPrefSize方法的具體用法?Java TabPane.setPrefSize怎麽用?Java TabPane.setPrefSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.TabPane的用法示例。


在下文中一共展示了TabPane.setPrefSize方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TabSample

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
public TabSample() {
    BorderPane borderPane = new BorderPane();
    final TabPane tabPane = new TabPane();
    tabPane.setPrefSize(400, 400);
    tabPane.setSide(Side.TOP);
    tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
    final Tab tab1 = new Tab();
    tab1.setText("Tab 1");
    final Tab tab2 = new Tab();
    tab2.setText("Tab 2");
    final Tab tab3 = new Tab();
    tab3.setText("Tab 3");
    final Tab tab4 = new Tab();
    tab4.setText("Tab 4");
    tabPane.getTabs().addAll(tab1, tab2, tab3, tab4);
    borderPane.setCenter(tabPane);
    getChildren().add(borderPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:TabSample.java

示例2: LoginScreen

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
/**
 * Inializes the login Screen, assembling the necessary text boxes and buttons necessary to store all the information.
 */
public LoginScreen () {
    myHouse = new TabPane();
    VoogaScene scene = new VoogaScene(myHouse);
    Tab login = new Tab(LOG);
    VBox loginContent = new VBox();
    loginContent.getChildren().addAll(loginInput(), loginConfirm());
    login.setContent(loginContent);
    Tab user = new Tab("New User");
    VBox userContent = new VBox();
    userContent.getChildren().addAll(userInput(), imageSelect(), userConfirm());
    user.setContent(userContent);
    myHouse.getTabs().addAll(login, user);
    myHouse.setPrefSize(WIDTH, HEIGHT);
    this.setScene(scene);
}
 
開發者ID:sjain28,項目名稱:Game-Engine-Vooga,代碼行數:19,代碼來源:LoginScreen.java

示例3: createObject

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
protected Object createObject(double width, double height, Double tab_width, Double tab_height) {
    TabPane tab_pane = new TabPane();
    for (int i = 0; i < TABS_NUM; i++) {
        Tab tab = new Tab("Tab " + i);
        Label label = new Label("Tab's " + i + " content");
        tab.setContent(label);
        VBox box  = new VBox();
        box.getChildren().add(createRect(tab_width, tab_height, new Color(0.0, 1.0, 0.0, 1.0)));
        box.getChildren().add(createRect(tab_width, tab_height, new Color(0.0, 0.0, 1.0, 1.0)));
        tab.setGraphic(box);
        tab_pane.getTabs().add(tab);
    }
    tab_pane.setMaxSize(width, height);
    tab_pane.setPrefSize(width, height);
    tab_pane.setStyle("-fx-border-color: darkgray;");
    return tab_pane;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:18,代碼來源:TabPaneApp.java

示例4: start

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
@Override
public void start(Stage stage, Scene scene, StackPane root, BorderPane border) throws Exception {
    OptionMenu.init();
    tb = new TabPane();
    menuBar = new MenuBar();
    bmread = new Reader(menuBook);
    bmread.refresh();

    mkDirs(home, saveDir, temp, cssDir);

    stage.getIcons().add(new Image(ZunoZap.class.getClassLoader().getResourceAsStream("zunozaplogo.gif")));
    tb.setPrefSize(1365, 768);
    tb.setSide(Side.TOP);

    /// Setup tabs
    Tab newtab = new Tab(" + ");
    newtab.setClosable(false);
    tb.getTabs().add(newtab);
    createTab(true);

    tb.getSelectionModel().selectedItemProperty().addListener((a,b,c) -> { if (c == newtab) createTab(false); });

    border.setCenter(tb);
    border.setTop(menuBar);
    border.autosize();

    WebView dummy = new WebView();
    setUserAgent(dummy.getEngine());
    regMenuItems(bmread, menuFile, menuBook, aboutPageHTML("Java WebView", dummy.getEngine().getUserAgent(), "ZunoZap/zunozap/master/LICENCE", "LGPLv3", "N/A"), tb, Engine.WEBKIT);
    menuBar.getMenus().addAll(menuFile, menuBook);
    sm = new StyleManager(cssDir, scene);
    scene.getStylesheets().add(ZunoAPI.stylesheet.toURI().toURL().toExternalForm());

    p.loadPlugins();
    if (allowPluginEvents()) for (PluginBase pl : p.plugins) pl.onLoad(stage, scene, tb);
}
 
開發者ID:ZunoZap,項目名稱:zunozap,代碼行數:37,代碼來源:ZunoZapWebView.java

示例5: createNode

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
@Override
protected Node createNode(Object obj) {
    TabPane tab_pane = new TabPane();
    tab_pane.getTabs().add((Tab)obj);
    tab_pane.setMinSize(SLOT_WIDTH, SLOT_HEIGHT);
    tab_pane.setMaxSize(SLOT_WIDTH, SLOT_HEIGHT);
    tab_pane.setPrefSize(SLOT_WIDTH, SLOT_HEIGHT);
    tab_pane.setStyle("-fx-border-color: darkgray;");
    return tab_pane;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:11,代碼來源:TabApp.java

示例6: start

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
@Override
  public void start(final Stage stage)
  {
      // TabPane with some tabs
      final TabPane tabs = new TabPane();
      tabs.setStyle("-fx-background-color: red;");
      for (int i=0; i<3; ++i)
      {
          final Rectangle rect = new Rectangle(i*100, 100, 10+i*100, 20+i*80);
          rect.setFill(Color.BLUE);
          final Pane content = new Pane(rect);
          final Tab tab = new Tab("Tab " + (i+1), content);
          tab.setClosable(false);
          tabs.getTabs().add(tab);
      }
      tabs.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
      tabs.setPrefSize(400, 300);

      final Group widgets = new Group(tabs);
      widgets.setScaleX(0.5);
      widgets.setScaleY(0.5);
      final Group scroll_content = new Group(widgets);
      final ScrollPane scroll = new ScrollPane(scroll_content);
      final Scene scene = new Scene(scroll);
      stage.setTitle("Tab Demo");
      stage.setScene(scene);
      stage.show();

      // Unfortunately, the setup of ScrollPane -> Group -> Group -> TabPane
      // breaks the rendering of the TabPane.
      // While the red background shows the area occupied by TabPane,
      // the actual Tabs are missing..
      System.out.println("See anything?");
      scene.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent event) ->
{
	if (event.getCode() == KeyCode.SPACE)
       {   // .. until 'side' or 'tabMinWidth' or .. are twiddled to force a refresh
           tabs.setSide(Side.BOTTOM);
           tabs.setSide(Side.TOP);
           System.out.println("See it now?");
       }
});
  }
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:44,代碼來源:TabDemo.java


注:本文中的javafx.scene.control.TabPane.setPrefSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。