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