com.jfoenix.controls.JFXTabPane Java Examples
The following examples show how to use
com.jfoenix.controls.JFXTabPane.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RequestComponent.java From milkman with MIT License | 5 votes |
public RequestComponentFxml(RequestComponent controller) { setId("requestComponent"); HboxExt reqEdit = add(hbox("generalRequestEdit")); controller.mainEditingArea = reqEdit.add(hbox("mainEditingArea"), true); controller.submitBtn = reqEdit.add(new SplitMenuButton()); JavaFxUtils.publishEscToParent(controller.submitBtn); controller.submitBtn.setId("submitBtn"); controller.submitBtn.setText("submit"); controller.submitBtn.setOnAction(e -> controller.onSubmit()); controller.saveBtn = reqEdit.add(new SplitMenuButton()); controller.saveBtn.setId("saveBtn"); controller.saveBtn.setText("save"); controller.saveBtn.setOnAction(e -> controller.onSave()); controller.saveBtn.getStyleClass().add("secondary"); MenuItem saveAs = new MenuItem("save as..."); saveAs.setOnAction(e -> controller.onSaveAs()); controller.saveBtn.getItems().add(saveAs); MenuItem export = new MenuItem("export..."); export.setOnAction(e -> controller.onExport()); controller.saveBtn.getItems().add(export); JFXTabPane tabPane = add(new JFXTabPane(), true); tabPane.setId("tabs"); tabPane.setDisableAnimation(true); controller.tabs = tabPane; tabPane.setPrefHeight(300); }
Example #2
Source File: WorkingAreaComponent.java From milkman with MIT License | 4 votes |
public WorkingAreaComponentFxml(WorkingAreaComponent controller) { HboxExt reqArea = add(hbox("openRequestArea")); JFXTabPane pane = new JFXTabPane(); pane.setId("tabPane"); controller.tabPane = reqArea.add(pane, true); reqArea.add(button(icon(FontAwesomeIcon.PLUS), controller::onNewRequestClick)) .setPrefWidth(40); SplitPane splitPane = add(new SplitPane(), true); splitPane.setOrientation(Orientation.VERTICAL); controller.requestArea = new RequestComponentFxml(controller.restRequestComponent); splitPane.getItems().add(controller.requestArea); splitPane.getItems().add(new ResponseComponentFxml(controller.responseComponent)); controller.initialize(); }
Example #3
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void setStylesheet(JFXTabPane t, String cssFile) { t.getStylesheets().clear(); t.getStylesheets().add(getClass().getResource(cssFile).toExternalForm()); t.getStyleClass().add("jfx-tab-pane"); }
Example #4
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public JFXTabPane getJFXTabPane() { return tabPane; }
Example #5
Source File: TabsDemo.java From JFoenix with Apache License 2.0 | 4 votes |
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Tabs"); JFXTabPane tabPane = new JFXTabPane(); Tab tab = new Tab(); tab.setText(msg); tab.setContent(new Label(TAB_0)); tabPane.getTabs().add(tab); tabPane.setPrefSize(300, 200); Tab tab1 = new Tab(); tab1.setText(TAB_01); tab1.setContent(new Label(TAB_01)); tabPane.getTabs().add(tab1); SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel(); selectionModel.select(1); JFXButton button = new JFXButton("New Tab"); button.setOnMouseClicked((o) -> { Tab temp = new Tab(); int count = tabPane.getTabs().size(); temp.setText(msg + count); temp.setContent(new Label(TAB_0 + count)); tabPane.getTabs().add(temp); }); tabPane.setMaxWidth(500); HBox hbox = new HBox(); hbox.getChildren().addAll(button, tabPane); hbox.setSpacing(50); hbox.setAlignment(Pos.CENTER); hbox.setStyle("-fx-padding:20"); Group root = new Group(); Scene scene = new Scene(root, 700, 250); root.getChildren().addAll(hbox); scene.getStylesheets().add(TabsDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.setTitle("JFX Tabs Demo"); primaryStage.setScene(scene); primaryStage.show(); }
Example #6
Source File: JFXTabPaneSkin.java From JFoenix with Apache License 2.0 | 4 votes |
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { final double headerHeight = snapSize(header.prefHeight(-1)); final Side side = getSkinnable().getSide(); double tabsX = side == Side.RIGHT ? x + w - headerHeight : x; double tabsY = side == Side.BOTTOM ? y + h - headerHeight : y; final int rotation = getRotation(side); // update header switch (side) { case TOP: header.resize(w, headerHeight); header.relocate(tabsX, tabsY); break; case LEFT: header.resize(h, headerHeight); header.relocate(tabsX + headerHeight, h - headerHeight); break; case RIGHT: header.resize(h, headerHeight); header.relocate(tabsX, y - headerHeight); break; case BOTTOM: header.resize(w, headerHeight); header.relocate(w, tabsY - headerHeight); break; } header.getTransforms().setAll(new Rotate(rotation, 0, headerHeight, 1)); // update header clip // header.clip.setX(0); // header.clip.setY(0); // header.clip.setWidth(isHorizontal() ? w : h); // header.clip.setHeight(headerHeight + 10); // 10 is the height of the shadow effect // position the tab content of the current selected tab double contentStartX = x + (side == Side.LEFT ? headerHeight : 0); double contentStartY = y + (side == Side.TOP ? headerHeight : 0); double contentWidth = w - (isHorizontal() ? 0 : headerHeight); double contentHeight = h - (isHorizontal() ? headerHeight : 0); // update tabs container tabsClip.setWidth(contentWidth); tabsClip.setHeight(contentHeight); tabsContainerHolder.resize(contentWidth, contentHeight); tabsContainerHolder.relocate(contentStartX, contentStartY); tabsContainer.resize(contentWidth * tabContentHolders.size(), contentHeight); for (int i = 0, max = tabContentHolders.size(); i < max; i++) { TabContentHolder tabContentHolder = tabContentHolders.get(i); tabContentHolder.setVisible(true); tabContentHolder.setTranslateX(contentWidth * i); if (tabContentHolder.getClip() != null) { ((Rectangle) tabContentHolder.getClip()).setWidth(contentWidth); ((Rectangle) tabContentHolder.getClip()).setHeight(contentHeight); } if (tabContentHolder.tab == selectedTab) { int index = getSkinnable().getTabs().indexOf(selectedTab); if (index != i) { tabsContainer.setTranslateX(-contentWidth * i); diffTabsIndices = i - index; } else { // fix X translation after changing the tabs if (diffTabsIndices != 0) { tabsContainer.setTranslateX(tabsContainer.getTranslateX() + contentWidth * diffTabsIndices); diffTabsIndices = 0; } // animate upon tab selection only otherwise just translate the selected tab if (isSelectingTab && !((JFXTabPane) getSkinnable()).isDisableAnimation()) { new CachedTransition(tabsContainer, new Timeline(new KeyFrame(Duration.millis(1000), new KeyValue(tabsContainer.translateXProperty(), -contentWidth * index, Interpolator.EASE_BOTH)))) {{ setCycleDuration(Duration.seconds(0.320)); setDelay(Duration.seconds(0)); }}.play(); } else { tabsContainer.setTranslateX(-contentWidth * index); } } } tabContentHolder.resize(contentWidth, contentHeight); // tabContentHolder.relocate(contentStartX, contentStartY); } }
Example #7
Source File: TabbedOverlay.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
protected void createTabPane() { this.tabPane = new JFXTabPane(); tabPane.setMinWidth(width); }
Example #8
Source File: TradesChartsView.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void activate() { // root.getParent() is null at initialize tabPaneSelectionModel = GUIUtil.getParentOfType(root, JFXTabPane.class).getSelectionModel(); selectedTabIndexListener = (observable, oldValue, newValue) -> model.setSelectedTabIndex((int) newValue); model.setSelectedTabIndex(tabPaneSelectionModel.getSelectedIndex()); tabPaneSelectionModel.selectedIndexProperty().addListener(selectedTabIndexListener); currencyComboBox.setConverter(new CurrencyStringConverter(currencyComboBox)); currencyComboBox.getEditor().getStyleClass().add("combo-box-editor-bold"); currencyComboBox.setAutocompleteItems(model.getCurrencyListItems()); currencyComboBox.setVisibleRowCount(10); if (model.showAllTradeCurrenciesProperty.get()) currencyComboBox.getSelectionModel().select(SHOW_ALL); else if (model.getSelectedCurrencyListItem().isPresent()) currencyComboBox.getSelectionModel().select(model.getSelectedCurrencyListItem().get()); currencyComboBox.getEditor().setText(new CurrencyStringConverter(currencyComboBox).toString(currencyComboBox.getSelectionModel().getSelectedItem())); currencyComboBox.setOnChangeConfirmed(e -> { if (currencyComboBox.getEditor().getText().isEmpty()) currencyComboBox.getSelectionModel().select(SHOW_ALL); CurrencyListItem selectedItem = currencyComboBox.getSelectionModel().getSelectedItem(); if (selectedItem != null) model.onSetTradeCurrency(selectedItem.tradeCurrency); }); toggleGroup.getToggles().get(model.tickUnit.ordinal()).setSelected(true); model.priceItems.addListener(itemsChangeListener); toggleGroup.selectedToggleProperty().addListener(timeUnitChangeListener); priceAxisY.widthProperty().addListener(priceAxisYWidthListener); volumeAxisY.widthProperty().addListener(volumeAxisYWidthListener); model.tradeStatisticsByCurrency.addListener(tradeStatisticsByCurrencyListener); priceAxisY.labelProperty().bind(priceColumnLabel); priceColumnLabel.addListener(priceColumnLabelListener); currencySelectionBinding = EasyBind.combine( model.showAllTradeCurrenciesProperty, model.selectedTradeCurrencyProperty, (showAll, selectedTradeCurrency) -> { priceChart.setVisible(!showAll); priceChart.setManaged(!showAll); priceColumn.setSortable(!showAll); if (showAll) { volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amount"))); priceColumnLabel.set(Res.get("shared.price")); if (!tableView.getColumns().contains(marketColumn)) tableView.getColumns().add(1, marketColumn); volumeChart.setPrefHeight(volumeChart.getMaxHeight()); } else { volumeChart.setPrefHeight(volumeChart.getMinHeight()); priceSeries.setName(selectedTradeCurrency.getName()); String code = selectedTradeCurrency.getCode(); volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", code))); priceColumnLabel.set(CurrencyUtil.getPriceWithCurrencyCode(code)); tableView.getColumns().remove(marketColumn); } layout(); return null; }); currencySelectionSubscriber = currencySelectionBinding.subscribe((observable, oldValue, newValue) -> {}); sortedList = new SortedList<>(model.tradeStatisticsByCurrency); sortedList.comparatorProperty().bind(tableView.comparatorProperty()); tableView.setItems(sortedList); priceChart.setAnimated(model.preferences.isUseAnimations()); volumeChart.setAnimated(model.preferences.isUseAnimations()); priceAxisX.setTickLabelFormatter(getTimeAxisStringConverter()); volumeAxisX.setTickLabelFormatter(getTimeAxisStringConverter()); nrOfTradeStatisticsLabel.setText(Res.get("market.trades.nrOfTrades", model.tradeStatisticsByCurrency.size())); UserThread.runAfter(this::updateChartData, 100, TimeUnit.MILLISECONDS); if (root.getParent() instanceof Pane) { rootParent = (Pane) root.getParent(); rootParent.heightProperty().addListener(parentHeightListener); } layout(); }
Example #9
Source File: ResponseComponent.java From milkman with MIT License | 2 votes |
public ResponseComponentFxml(ResponseComponent controller) { getStyleClass().add("responseArea"); var stackPane = add(new StackPane(), true); AnchorPane anchorPane = new AnchorPane(); stackPane.getChildren().add(anchorPane); JFXTabPane tabPane = anchorNode(new JFXTabPane(), 1.0, 1.0, 1.0, 1.0); tabPane.setDisableAnimation(true); controller.tabs = tabPane; tabPane.setId("tabs"); anchorPane.getChildren().add(tabPane); var statusBar = anchorNode(hbox("statusBar"), 3.0, 5.0, null, null); controller.statusDisplay = hbox("statusDisplay"); statusBar.add(controller.statusDisplay); var asyncSpinner = controller.asyncControlSpinner = new TinySpinner(); asyncSpinner.setVisible(false); statusBar.add(asyncSpinner, true); anchorPane.getChildren().add(statusBar); var spinner = new FancySpinner(); controller.spinner = spinner; StackPane.setAlignment(spinner, Pos.CENTER); stackPane.getChildren().add(spinner); var cancel = button("cancellation", icon(FontAwesomeIcon.TIMES)); controller.cancellation = cancel; StackPane.setAlignment(cancel, Pos.CENTER); stackPane.getChildren().add(cancel); controller.initialize(); }
Example #10
Source File: Editor.java From Jupiter with GNU General Public License v3.0 | 2 votes |
/** * Returns editor tab pane. * * @return editor tab pane */ public JFXTabPane getEditorTabPane() { return editorTabPane; }