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


Java TabPane.setStyle方法代碼示例

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


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

示例1: 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

示例2: start

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) {

	Tab f = makeTab("Files", "File system view here");
	Tab t = makeTab("Type Hierarchy","Type hierarchy view here");
	Tab d = makeTab("Debug","Debug view here");

	Tab p = makeTab("Properties","Ah, the ubiquitous 'properties' panel");
	Tab c = makeTab("Console","Console output here");
	Tab o = makeTab("Outline","Outline of fields/methods view here");

	TabPane left = new TabPane(f,t,d);
	TabUtil.makeDroppable(left); //////////////// see

	TabPane right = new TabPane(p,c,o);
	TabUtil.makeDroppable(right); /////////////// see

	left.setStyle("-fx-border-color: black;");
	right.setStyle("-fx-border-color: black;");

	BorderPane main = new BorderPane();
	main.setPadding(new Insets(0, 20, 0, 20));
	main.setTop(new Label("Menubar and toolbars"));
	main.setLeft(left);
	main.setCenter(new Label("Central work area here"));
	main.setRight(right);
	main.setBottom(new Label("Statusbar"));

	primaryStage.setScene(new Scene(main, 800, 600));
	primaryStage.show();
}
 
開發者ID:gillius,項目名稱:jfxutils,代碼行數:32,代碼來源:DemoDragTabs.java

示例3: 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

示例4: createJFXNode

import javafx.scene.control.TabPane; //導入方法依賴的package包/類
@Override
public TabPane createJFXNode() throws Exception
{
    final TabPane tabs = new TabPane();

    // See 'twiddle' below
    tabs.setStyle("-fx-background-color: lightgray;");
    tabs.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);

    tabs.setMinSize(TabPane.USE_PREF_SIZE, TabPane.USE_PREF_SIZE);
    tabs.setTabMinHeight(model_widget.propTabHeight().getValue());

    return tabs;
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:15,代碼來源:TabsRepresentation.java

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