本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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?");
}
});
}