本文整理汇总了Java中javafx.scene.control.Tab.setContent方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.setContent方法的具体用法?Java Tab.setContent怎么用?Java Tab.setContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Tab
的用法示例。
在下文中一共展示了Tab.setContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* Add a new tab and set the content as the parameter node
* @param tabName - Tab Name
* @param node - Content
*/
public void addTab(String tabName, Node node) {
Tab newTab = new Tab(tabName);
newTab.setContent(node);
newTab.setClosable(true);
getTabs().addAll(newTab);
getSelectionModel().select(newTab);
getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>(){
@Override
public void changed(ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
if (oldValue != null && oldValue.getContent() instanceof ChartCanvasPane) {
ChartCanvasPane oldPane = (ChartCanvasPane)oldValue.getContent();
oldPane.isChartCached.setValue(true);
}
if (newValue != null && newValue.getContent() instanceof ChartCanvasPane) {
ChartCanvasPane newPane = (ChartCanvasPane)newValue.getContent();
newPane.isChartCached.setValue(false);
}
}
});
}
示例2: replace
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@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);
}
}
示例3: open
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public Tab open(Viewer viewer, URL url) throws Exception {
Tab tab = new Tab(UrlUtils.getFileName(url));
tab.setStyle(FontUtils.setUIFont(tab.getStyle()));
tab.setText(UrlUtils.getFileName(url));
tab.setGraphic(new ImageView(icon));
FileTreeNode root = load(url);
root.setExpanded(true);
FileTreeView view = new FileTreeView(viewer, root);
view.setOnMouseClicked(event -> {
if (event.getClickCount() == 2) {
FileTreeNode node = view.getSelected();
if (node != null && node.getUrl().toString().endsWith(".class")) {
Log.info("Open Class File: " + node.getUrl());
viewer.openFile(node.getUrl());
}
}
});
tab.setContent(view);
tab.setUserData(url);
return tab;
}
示例4: open
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public Tab open(Viewer viewer, URL url) throws Exception {
Tab tab = new Tab(UrlUtils.getFileName(url));
tab.setGraphic(new ImageView(icon));
byte[] bytes = UrlUtils.readData(url);
ClassFile classFile = new ClassFileParser().parse(bytes);
ParsedViewerPane pane = new ParsedViewerPane(classFile, new HexText(bytes));
RecentFiles.Instance.add(Instance, url);
tab.setContent(pane);
tab.setStyle(FontUtils.setUIFont(tab.getStyle()));
tab.setUserData(url);
return tab;
}
示例5: open
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public Tab open(Viewer viewer, URL url) throws Exception {
Tab tab = new Tab(UrlUtils.getFileName(url));
tab.setStyle(FontUtils.setUIFont(tab.getStyle()));
tab.setText(UrlUtils.getFileName(url));
tab.setGraphic(new ImageView(icon));
FileTreeNode root = load(url);
root.setExpanded(true);
FileTreeView view = new FileTreeView(viewer, root);
view.setOnMouseClicked(event -> {
if (event.getClickCount() == 2) {
FileTreeNode node = view.getSelected();
if (node != null && node.getUrl().toString().endsWith(".class")) {
Log.info("Open Class File: " + node.getUrl());
viewer.openFile(node.getUrl());
}
}
});
tab.setContent(view);
tab.setUserData(url);
return tab;
}
示例6: addTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
private SpecificationController addTab(HybridSpecification hybridSpecification, int index) {
final SpecificationController controller =
new SpecificationController(typeContext, ioVariables, hybridSpecification, this.state,
Bindings.isEmpty(scenario.getCode().syntaxErrorsProperty()).not(), globalConfig);
Tab tab = new Tab();
tab.setOnCloseRequest(e -> onTabCloseRequest(e, tab));
if (hybridSpecification.isEditable()) {
tab.setContextMenu(createTabContextMenu());
}
tab.textProperty().bind(hybridSpecification.nameProperty());
tab.setContent(controller.getView());
if (hybridSpecification.isEditable()) {
tab.setGraphic(GlyphsDude.createIcon(FontAwesomeIcon.EDIT));
} else {
tab.setGraphic(GlyphsDude.createIcon(FontAwesomeIcon.LOCK));
}
view.getTabs().add(index, tab);
controllers.put(tab, controller);
view.getTabPane().getSelectionModel().select(tab);
scenario.setActiveSpec(hybridSpecification);
return controller;
}
示例7: updateTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* update the given tab with the given region
*
* @param view
* @param tabId
* @param region
*/
private void updateTab(String tabId, Region region) {
Tab tab = super.getTab(tabId);
if (tab != null && region != null) {
tab.setContent(region);
} else {
String problem = "";
String delim = "";
if (tab == null) {
problem += "tab is null";
delim = ", ";
}
if (region == null) {
problem += delim + "region is null";
}
LOGGER.log(Level.SEVERE,
String.format("updateTab %s: %s", tabId, problem));
}
}
示例8: generateTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
void generateTab() {
// dasy chane tab to icon and back to edit?
tab = new Tab(homeDir);
tabView = new TabView();
tabView.setDirLoc(homeDir);
tabView.startIconGeneration();
tab.setContent(tabView.getContent());
if (selectedTabView == 1) {
tabPane1.getTabs().add(tab);
tabPane1.getSelectionModel().select(tab);
} else if (selectedTabView == 2) {
tabPane2.getTabs().add(tab);
tabPane2.getSelectionModel().select(tab);
} else if (selectedTabView == 3) {
tabPane3.getTabs().add(tab);
tabPane3.getSelectionModel().select(tab);
} else if (selectedTabView == 4) {
tabPane4.getTabs().add(tab);
tabPane4.getSelectionModel().select(tab);
}
}
示例9: actionServerConnect
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@FXML
private void actionServerConnect(ActionEvent event) {
try {
String name = serverName.getText();
if (name.isEmpty()) {
name = serverUrl.getText();
}
LOGGER.info("Connecting to {} at {}.", serverName.getText(), serverUrl.getText());
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Server.fxml"));
AnchorPane content = (AnchorPane) loader.load();
ControllerServer controller = loader.<ControllerServer>getController();
controller.setServerEntry(
new ServerListEntry()
.setName(serverName.getText())
.setUrl(serverUrl.getText())
.setConfig(activeItem.getConfig())
);
Tab tab = new Tab(name);
tab.setContent(content);
serverTabs.getTabs().add(tab);
buttonServers.setSelected(false);
checkServersButton();
} catch (IOException ex) {
LOGGER.error("Failed to create server tab.", ex);
}
}
示例10: start
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@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("/com/orsoncharts/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();
}
示例11: addComponent
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@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());
}
示例12: promptPassword
import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void promptPassword()
{
this.hideOpenTabs();
Tab pswPane = new Tab("Root Access Required");
pswPane.setContent(passwordPane);
pswPane.setClosable(false);
this.getTabs().add(pswPane);
this.getSelectionModel().select(pswPane);
}
示例13: createTagsTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
private Tab createTagsTab() {
final Tab tagsTab = new Tab("Tags");
tagsTab.setClosable(false);
tagsTab.setContent(new VBox(createPredefinedTagsGrid(), CONTENT_TAGS_TABLE));
//
CONTENT_TAGS_TABLE.getColumns().add(TAGS_COLUMN_NAME);
CONTENT_TAGS_TABLE.getColumns().add(TAGS_COLUMN_VALUE);
TAGS_COLUMN_VALUE.prefWidthProperty().bind(CONTENT_TAGS_TABLE.widthProperty().subtract(TAGS_COLUMN_NAME.widthProperty()));
TAGS_COLUMN_NAME.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
TAGS_COLUMN_VALUE.setCellValueFactory(cellData -> cellData.getValue().valueProperty());
VBox.setVgrow(CONTENT_TAGS_TABLE, Priority.SOMETIMES);
//
return tagsTab;
}
示例14: addGroupTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void addGroupTab(AssessmentView view, boolean fresh) {
Tab tab = new Tab();
tab.setUserData(view.getActiveGroup().getName());
tab.setText(view.getActiveGroup().getName());
view.bindToParentSize(rightContent);
tab.setContent(view);
tabPane.getTabs().addAll(tab);
groupTabMap.put(view.getActiveGroup().getName(), tab);
if (fresh) {
markDirty(view.getActiveGroup());
}
}
示例15: addTabFor
import javafx.scene.control.Tab; //导入方法依赖的package包/类
private <T extends Entity<T>> void addTabFor(String title, Query<T> query, ControllerCollection.EntityFactory<T> factory) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Collection.fxml"));
AnchorPane content = (AnchorPane) loader.load();
ControllerCollection controller = loader.<ControllerCollection>getController();
controller.setQuery(query, factory);
Tab tab = new Tab(title);
tab.setContent(content);
collectionTabs.getTabs().add(tab);
} catch (IOException ex) {
LOGGER.error("Failed to load Tab.", ex);
}
}