Java Code Examples for javafx.scene.control.Tab#setContent()

The following examples show how to use javafx.scene.control.Tab#setContent() . 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: TabDockingContainer.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public void replace(Node base, INewDockingContainer indc) {
    ObservableList<Tab> tabs = getTabs();
    Tab found = null;
    for (Tab tab : tabs) {
        if (tab.getContent() == base) {
            found = tab;
            break;
        }
    }
    if (found != null) {
        int index = tabs.indexOf(found);
        tabs.remove(index);
        found.setContent(indc.get());
        tabs.add(index, found);
    }
}
 
Example 2
Source File: GlobalUI.java    From SONDY with GNU General Public License v3.0 6 votes vote down vote up
public GlobalUI(){
        globalGridPane = new GridPane();
//        dataCollectionUI = new DataCollectionUI();
        dataManipulationUI = new DataManipulationUI();
        eventDetectionUI = new EventDetectionUI();
        influenceAnalysisUI = new InfluenceAnalysisUI();
        logUI = new LogUI();
        menuBar();
        tabPane = new TabPane();
        tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
//        Tab dataCollectionTab = new Tab("Data Collection");
//        dataCollectionTab.setContent(dataCollectionUI.grid);
        Tab dataManipulationTab = new Tab("Data Manipulation");
        dataManipulationTab.setContent(dataManipulationUI.grid);
        Tab eventTab = new Tab("Event Detection");
        eventTab.setContent(eventDetectionUI.grid);
        Tab influenceTab = new Tab("Influence Analysis");
        influenceTab.setContent(influenceAnalysisUI.grid);
        tabPane.getTabs().addAll(dataManipulationTab,eventTab,influenceTab);
        tabPane.getSelectionModel().select(0);
        globalGridPane.add(globalMenu,0,0);
        globalGridPane.add(tabPane,0,1);
        globalGridPane.add(logUI.logGrid,0,2);
        LogUI.addLogEntry("Application started - available cores: "+Configuration.numberOfCores+", workspace: "+Configuration.workspace);
    }
 
Example 3
Source File: DemoTabPane.java    From bootstrapfx with MIT License 6 votes vote down vote up
private DemoTab(String title, String sourceFile) throws Exception {
    super(title);
    setClosable(false);

    TabPane content = new TabPane();
    setContent(content);
    content.setSide(Side.BOTTOM);

    Tab widgets = new Tab("Widgets");
    widgets.setClosable(false);
    URL location = getClass().getResource(sourceFile);
    FXMLLoader fxmlLoader = new FXMLLoader(location);
    Node node = fxmlLoader.load();
    widgets.setContent(node);

    Tab source = new Tab("Source");
    source.setClosable(false);
    XMLEditor editor = new XMLEditor();
    editor.setEditable(false);

    String text = IOUtils.toString(getClass().getResourceAsStream(sourceFile));
    editor.setText(text);
    source.setContent(editor);

    content.getTabs().addAll(widgets, source);
}
 
Example 4
Source File: TabToolComponent.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Add a new component to this tool container.
 *
 * @param component the component
 * @param name      the name
 */
public void addComponent(@NotNull final Region component, @NotNull final String name) {

    final Tab tab = new Tab(name);
    tab.setContent(component);
    tab.setClosable(false);

    getTabs().add(tab);

    FXUtils.bindFixedHeight(component, heightProperty());
}
 
Example 5
Source File: OrsonChartsFXDemo.java    From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
   
    TabPane tabPane = new TabPane();
    Tab tab1 = new Tab();
    tab1.setText("Demos");
    tab1.setClosable(false);
    
    SplitPane sp = new SplitPane();
    final StackPane sp1 = new StackPane();
    sp1.getChildren().add(createTreeView());
    final BorderPane sp2 = new BorderPane();
    sp2.setCenter(createChartPane());
 
    sp.getItems().addAll(sp1, sp2);
    sp.setDividerPositions(0.3f, 0.6f);
    tab1.setContent(sp);
    tabPane.getTabs().add(tab1);        
 
    Tab tab2 = new Tab();
    tab2.setText("About");
    tab2.setClosable(false);
    
    WebView browser = new WebView();
    WebEngine webEngine = browser.getEngine();
    webEngine.load(getClass().getResource("/org/jfree/chart3d/fx/demo/about.html").toString());
    tab2.setContent(browser);
    tabPane.getTabs().add(tab2);        

    Scene scene = new Scene(tabPane, 1024, 768);
    stage.setScene(scene);
    stage.setTitle("Orson Charts JavaFX Demo");
    stage.show();
}
 
Example 6
Source File: CommandPane.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
private Tab getTab (String name, TextArea textArea)
{
  Tab tab = new Tab ();
  tab.setText (name);
  tab.setContent (textArea);
  return tab;
}
 
Example 7
Source File: CommandPane.java    From dm3270 with Apache License 2.0 5 votes vote down vote up
private Tab getTab (String name, TextArea textArea)
{
  Tab tab = new Tab ();
  tab.setText (name);
  tab.setContent (textArea);
  return tab;
}
 
Example 8
Source File: BrokerConfigView.java    From kafka-message-tool with MIT License 5 votes vote down vote up
private Tab getNodeTab(ClusterNodeInfo nodeInfo, ConfigEntriesView clusterPropertiesTableView) {
    Tab nodeTab = new Tab();
    AnchorPane nodeTabContentPane = new AnchorPane();
    nodeTabContentPane.getChildren().add(clusterPropertiesTableView);
    nodeTab.setContent(nodeTabContentPane);
    nodeTab.setText(String.format("Node id: %s", nodeInfo.getNodeId()));
    if (nodeInfo.isController()) {
        nodeTab.setText(String.format("Node id: %s [controller]", nodeInfo.getNodeId()));
    }
    return nodeTab;
}
 
Example 9
Source File: TabPaneController.java    From dev-tools with Apache License 2.0 5 votes vote down vote up
@FXML
protected void handleNewTab(Event event) {
    if (addNewTab.isSelected()) {
        int selected = innerTabPane.getSelectionModel().getSelectedIndex();
        int n = innerTabPane.getTabs().size();
        Tab plus = innerTabPane.getTabs().remove(n - 1);
        Tab newTab = new Tab("New");
        try {
            newTab.setContent(FXMLLoader.load(this.getClass().getResource(getInnerResource())));
        } catch (Exception e) {
        }
        innerTabPane.getTabs().addAll(newTab, plus);
        innerTabPane.getSelectionModel().select(selected);
    }
}
 
Example 10
Source File: ScrollableEditorToolComponent.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
@Override
public void addComponent(@NotNull final Region component, @NotNull final String name) {

    final ScrollPane scrollPane = new ScrollPane(new VBox(component));
    component.prefWidthProperty().bind(scrollPane.widthProperty());

    final Tab tab = new Tab(name);
    tab.setContent(scrollPane);
    tab.setClosable(false);

    getTabs().add(tab);

    FXUtils.bindFixedHeight(scrollPane, heightProperty());
}
 
Example 11
Source File: GraphqlAspectEditor.java    From milkman with MIT License 5 votes vote down vote up
@Override
public Tab getRoot(RequestContainer request) {
	GraphqlAspect gqlAspect = request.getAspect(GraphqlAspect.class).get();
	Tab tab = new Tab("Graphql");
	
	ContentEditor editor = new ContentEditor();
	editor.setHeaderVisibility(false);
	editor.setEditable(true);
	editor.setContentTypePlugins(Arrays.asList(new GraphqlContentType()));
	editor.setContentType("application/graphql");
	editor.setContent(gqlAspect::getQuery, run(gqlAspect::setQuery).andThen(() -> gqlAspect.setDirty(true)));
	
	tab.setContent(editor);
	return tab;
}
 
Example 12
Source File: LibraryPanel.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create a new library panel.
 */
public LibraryPanel() {
    LOGGER.log(Level.INFO, "Creating library panel");
    tabPane = new TabPane();

    LOGGER.log(Level.INFO, "Creating library song panel");
    songPanel = new LibrarySongPanel();
    Tab songTab = new Tab();
    songTab.setClosable(false);
    songTab.setText(LabelGrabber.INSTANCE.getLabel("library.songs.heading"));
    songTab.setContent(songPanel);
    tabPane.getTabs().add(songTab);

    LOGGER.log(Level.INFO, "Creating library bible panel");
    biblePanel = new LibraryBiblePanel();
    Tab bibleTab = new Tab();
    bibleTab.setClosable(false);
    bibleTab.setText(LabelGrabber.INSTANCE.getLabel("library.bible.heading"));
    bibleTab.setContent(biblePanel);
    tabPane.getTabs().add(bibleTab);

    LOGGER.log(Level.INFO, "Creating library image panel");
    imagePanel = new LibraryImagePanel();
    Tab imageTab = new Tab();
    imageTab.setClosable(false);
    imageTab.setText(LabelGrabber.INSTANCE.getLabel("library.image.heading"));
    imageTab.setContent(imagePanel);
    tabPane.getTabs().add(imageTab);

    if (QueleaProperties.get().getDisplayVideoTab()) {
        LOGGER.log(Level.INFO, "Creating library video panel");
        videoPanel = new LibraryVideoPanel();
        Tab videoTab = new Tab();
        videoTab.setClosable(false);
        videoTab.setText(LabelGrabber.INSTANCE.getLabel("library.video.heading"));
        videoTab.setContent(videoPanel);
        tabPane.getTabs().add(videoTab);
    }
    else {
        videoPanel = null;
    }

    LOGGER.log(Level.INFO, "Creating library timer panel");
    timerPanel = new LibraryTimerPanel();
    timerTab = new Tab();
    timerTab.setClosable(false);
    timerTab.setText(LabelGrabber.INSTANCE.getLabel("library.timer.heading"));
    timerTab.setContent(timerPanel);
    if (QueleaProperties.get().getTimerDir().listFiles() != null
            && QueleaProperties.get().getTimerDir().listFiles().length > 0) {
        tabPane.getTabs().add(timerTab);
    }

    VBox.setVgrow(tabPane, Priority.ALWAYS);
    getChildren().add(tabPane);
}
 
Example 13
Source File: DockCommons.java    From AnchorFX with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static DockTabberContainer createTabber(Node existNode, Node newNode, DockNode.DockPosition position) {

        if (existNode instanceof DockNode && newNode instanceof DockNode) {
            DockNode existDockNode = (DockNode) existNode;
            DockNode newDockNode = (DockNode) newNode;

            DockTabberContainer tabber = new DockTabberContainer();
            Tab existTabPanel = new Tab(existDockNode.getContent().titleProperty().get());
            Tab newTabPanel = new Tab(newDockNode.getContent().titleProperty().get());

            existTabPanel.setOnCloseRequest(event -> {

                if (existDockNode.getCloseRequestHandler() == null || existDockNode.getCloseRequestHandler().canClose()) {
                    existDockNode.undock();
                    event.consume();
                }

            });

            newTabPanel.setOnCloseRequest(event -> {

                if (newDockNode.getCloseRequestHandler() == null || newDockNode.getCloseRequestHandler().canClose()) {
                    newDockNode.undock();
                    event.consume();
                }

            });

            existTabPanel.closableProperty().bind(existDockNode.closeableProperty());
            newTabPanel.closableProperty().bind(newDockNode.closeableProperty());

            existTabPanel.setContent(existDockNode);
            newTabPanel.setContent(newDockNode);

            DockContainableComponent existContainableComponent = (DockContainableComponent) existNode;
            DockContainableComponent newContainableComponent = (DockContainableComponent) newNode;

            existContainableComponent.setParentContainer(tabber);
            newContainableComponent.setParentContainer(tabber);

            tabber.getTabs().addAll(existTabPanel, newTabPanel);

            tabber.getStyleClass().add("docknode-tab-pane");

            newDockNode.ensureVisibility();

            return tabber;
        }
        return null;
    }
 
Example 14
Source File: DemoDragTabs.java    From jfxutils with Apache License 2.0 4 votes vote down vote up
private static Tab makeTab( String tabName, String tabContentDummy ) {
	Tab t = TabUtil.newDraggableTab( tabName );
	t.setContent(new Label(tabContentDummy));
	return t;
}
 
Example 15
Source File: MainLayout.java    From redtorch with MIT License 4 votes vote down vote up
private void createLayout() {

		vBox.getChildren().add(crearteMainMenuBar());
		// 左右切分布局------------------------
		SplitPane horizontalSplitPane = new SplitPane();
		horizontalSplitPane.setDividerPositions(0.5);
		vBox.getChildren().add(horizontalSplitPane);
		VBox.setVgrow(horizontalSplitPane, Priority.ALWAYS);

		// 左右切分布局----左侧上下切分布局---------
		SplitPane leftVerticalSplitPane = new SplitPane();
		leftVerticalSplitPane.setDividerPositions(0.4);
		horizontalSplitPane.getItems().add(leftVerticalSplitPane);
		leftVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		// 左右切分布局----左侧上下切分布局----上布局-----
		SplitPane leftTopHorizontalSplitPane = new SplitPane();
		leftVerticalSplitPane.getItems().add(leftTopHorizontalSplitPane);

		HBox leftTopRithtPane = new HBox();
		Node orderPanelLayoutNode = orderPanelLayout.getNode();
		HBox.setHgrow(orderPanelLayoutNode, Priority.ALWAYS);

		ScrollPane marketDetailsScrollPane = new ScrollPane();
		Node marketDetailsNode = marketDetailsLayout.getNode();
		marketDetailsScrollPane.setContent(marketDetailsNode);
		marketDetailsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
		marketDetailsScrollPane.setPrefWidth(253);
		marketDetailsScrollPane.setMinWidth(253);
		marketDetailsScrollPane.setMaxWidth(253);
		leftTopRithtPane.getChildren().addAll(marketDetailsScrollPane, orderPanelLayoutNode);
		leftTopRithtPane.setMaxWidth(680);
		leftTopRithtPane.setPrefWidth(680);

		leftTopHorizontalSplitPane.getItems().addAll(tickLayout.getNode(), leftTopRithtPane);
		SplitPane.setResizableWithParent(leftTopRithtPane, false);

		// 左右切分布局----左侧上下切分布局----下布局-----
		TabPane leftBootomTabPane = new TabPane();
		leftVerticalSplitPane.getItems().add(leftBootomTabPane);

		Tab orderTab = new Tab("定单");
		leftBootomTabPane.getTabs().add(orderTab);
		orderTab.setClosable(false);

		orderTab.setContent(orderLayout.getNode());

		Tab tradeTab = new Tab("成交");
		leftBootomTabPane.getTabs().add(tradeTab);
		tradeTab.setClosable(false);

		tradeTab.setContent(tradeLayout.getNode());

		// 左右切分布局----右侧TAB布局-------------
		TabPane rightTabPane = new TabPane();
		horizontalSplitPane.getItems().add(rightTabPane);

		Tab portfolioInvestmentTab = new Tab("投资组合");
		rightTabPane.getTabs().add(portfolioInvestmentTab);
		portfolioInvestmentTab.setClosable(false);

		SplitPane portfolioVerticalSplitPane = new SplitPane();
		portfolioInvestmentTab.setContent(portfolioVerticalSplitPane);
		portfolioVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		VBox.setVgrow(portfolioVerticalSplitPane, Priority.ALWAYS);

		VBox portfolioVBox = new VBox();
		portfolioVBox.getChildren().add(combinationLayout.getNode());

		portfolioVBox.getChildren().add(accountLayout.getNode());

		VBox.setVgrow(accountLayout.getNode(), Priority.ALWAYS);

		portfolioVerticalSplitPane.getItems().add(portfolioVBox);

		portfolioVerticalSplitPane.getItems().add(positionLayout.getNode());

		Tab allContractTab = new Tab("全部合约");
		allContractTab.setContent(contractLayout.getNode());
		rightTabPane.getTabs().add(allContractTab);
		allContractTab.setClosable(false);

		// 状态栏------------------------------
		vBox.getChildren().add(createStatusBar());
	}
 
Example 16
Source File: AllFilesViewerController.java    From standalone-app with Apache License 2.0 4 votes vote down vote up
private void constructFileTab(TreeNode node) {
        String uniqueKey = generateKey(node);

        if (fileTabs.containsKey(uniqueKey)) {
            // Already opened, and you double clicked. Let's just bring the focus to it

            Tab pane = fileTabs.get(uniqueKey);
            root.getSelectionModel().select(pane);
            return;
        }

        OpenedFile file = (OpenedFile) node.getMetadata().get(OpenedFile.OPENED_FILE);

        EditorView defaultTransformer = StandardEditors.HEX;

//        String extension = node.getDisplayName();
//        if (extension.lastIndexOf('.') != -1) {
//            extension = extension.substring(extension.lastIndexOf('.') + 1, extension.length());
//        }
//        JsonValue star = Settings.FILETYPE_ASSOCIATIONS.get().asObject().get(".*");
//        for (JsonObject.Member member : Settings.FILETYPE_ASSOCIATIONS.get().asObject()) {
//            if (member.getName().equals(extension)) {
//                if (defaultTransformer == null) {
//                    defaultTransformer = Transformer.getById(member.getValue().asString());
//                }
//            }
//        }
//        if (defaultTransformer == null && star != null) {
//            defaultTransformer = Transformer.getById(star.asString());
//        }
//        if (defaultTransformer == null) {
//            defaultTransformer = Transformer.HEX;
//        }

        try {
            GuiceFXMLLoader.Result tabResult = loader.load(getClass().getResource("/views/fileViewer.fxml"));
            TabPane fileTabPane = tabResult.getRoot();
            Tab allFilesTab = new Tab(node.getDisplayName());
            allFilesTab.setContent(fileTabPane);
            allFilesTab.setUserData(new FileTabProperties(file, (String) node.getMetadata().get(OpenedFile.FULL_PATH_KEY)));
            allFilesTab.setOnClosed(event -> {
                fileTabs.remove(uniqueKey);
            });

            fileTabs.put(uniqueKey, allFilesTab);

            root.getTabs().add(allFilesTab);
            root.getSelectionModel().select(allFilesTab);

            openNewEditor(allFilesTab, defaultTransformer);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 
Example 17
Source File: MainViewPresenter.java    From mokka7 with Eclipse Public License 1.0 4 votes vote down vote up
private Tab buildTab(String name, Node node, boolean closable) {
    Tab tab = new Tab(name);
    tab.setClosable(closable);
    tab.setContent(node);
    return tab;
}
 
Example 18
Source File: OptionsDialog.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void initComponents() {
	// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
	tabPane = new TabPane();
	generalTab = new Tab();
	generalOptionsPane = new GeneralOptionsPane();
	editorTab = new Tab();
	editorOptionsPane = new EditorOptionsPane();
	markdownTab = new Tab();
	markdownOptionsPane = new MarkdownOptionsPane();
	stylesheetsTab = new Tab();
	stylesheetsOptionsPane = new StylesheetsOptionsPane();

	//======== tabPane ========
	{
		tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);

		//======== generalTab ========
		{
			generalTab.setText(Messages.get("OptionsDialog.generalTab.text"));
			generalTab.setContent(generalOptionsPane);
		}

		//======== editorTab ========
		{
			editorTab.setText(Messages.get("OptionsDialog.editorTab.text"));
			editorTab.setContent(editorOptionsPane);
		}

		//======== markdownTab ========
		{
			markdownTab.setText(Messages.get("OptionsDialog.markdownTab.text"));
			markdownTab.setContent(markdownOptionsPane);
		}

		//======== stylesheetsTab ========
		{
			stylesheetsTab.setText(Messages.get("OptionsDialog.stylesheetsTab.text"));
			stylesheetsTab.setContent(stylesheetsOptionsPane);
		}

		tabPane.getTabs().addAll(generalTab, editorTab, markdownTab, stylesheetsTab);
	}
	// JFormDesigner - End of component initialization  //GEN-END:initComponents
}
 
Example 19
Source File: RegexConfigFragment.java    From mdict-java with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public RegexConfigFragment(PlainDictAppOptions _opt){
	super();
	tabPane = new TabPane();
	statusBar = new Text();
	tabPane.setPadding(new Insets(4,0,0,0));
	opt=_opt;

	bundle = ResourceBundle.getBundle("UIText", Locale.getDefault());

	Tab tab1 = new Tab();
	tab1.setText(bundle.getString(onegine));
	tab1.setTooltip(new Tooltip("词条、全文检索时,可选用正则引擎,或快速 .* 通配"));
	tab1.setClosable(false);
	Text lable = new Text("");
	lable.setStyle("-fx-fill: #ff0000;");
	tab1.setGraphic(lable);

	Tab tab2 = new Tab();
	tab2.setText(bundle.getString(findpage));
	tab2.setTooltip(new Tooltip("基于 Mark.js"));
	tab2.setClosable(false);
	Text lable1 = new Text("");
	lable1.setStyle("-fx-fill: #ff0000;");
	tab2.setGraphic(lable1);

	tabPane.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) -> {
		if(newValue.intValue()==1){
			if(tab2.getContent()==null)
				tab2.setContent(getSubpageContent());
		}
	});

	tabPane.setRotateGraphic(false);
	tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB);
	tabPane.setSide(Side.TOP);
	tabPane.getTabs().addAll(tab1,tab2);
	tabPane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);
	final String lvCss = HiddenSplitPaneApp.class.getResource("lvCss.css").toExternalForm();
	tabPane.getStylesheets().add(lvCss);

	tab1.setContent(getMainContent());

	VBox.setVgrow(tabPane, Priority.ALWAYS);

	getChildren().addAll(tabPane, statusBar);
}
 
Example 20
Source File: TabsDemo.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@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();
}