本文整理汇总了Java中javafx.scene.control.Tab.setText方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.setText方法的具体用法?Java Tab.setText怎么用?Java Tab.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Tab
的用法示例。
在下文中一共展示了Tab.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TabSample
import javafx.scene.control.Tab; //导入方法依赖的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: 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;
}
示例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: addObjectToTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void addObjectToTab(CustomTreeItem item) {
String text = getText(item.getValue());
CustomCodeArea customCodeArea = new CustomCodeArea(text, highlight, syntax, item.getValue().getFileName().toString());
Tab tab = new Tab();
tab.setText(item.getValue().getFileName().toString());
CustomIcons customIcons = new CustomIcons();
tab.setGraphic(new ImageView(customIcons.getFileImage()));
tab.setUserData(item.getValue());
VirtualizedScrollPane scrollPane = new VirtualizedScrollPane<>(customCodeArea);
tab.setContent(scrollPane);
tabPane.getTabs().add(tab);
focusToTab();
scheduleHighlight();
}
示例5: setTabs
import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void setTabs(String []fileNames, String dir) throws IOException{
//get file contents to set web view
//test.setText(jsonArray[jsonArray.length-1].replace("\"", ""));
//set test type by getting last element in array
for (int i =0 ; i <fileNames.length; i++) {
Tab tab = new Tab();
String s = fileNames[i].substring(1,fileNames[i].indexOf(".")) ;
tab.setText(s);
WebView w = new WebView();
String file = dir + "/" + s + ".html";
w.getEngine().load( file );
problem_tabs.getTabs().add(tab);
problem_tabs.getTabs().get(i).setContent(w);
}
problem_tabs.setVisible(true);
//test.setVisible(true);
//date.setVisible(true);
//time.setVisible(true);
}
示例6: 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();
}
示例7: createTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public Tab createTab (String text, boolean closable, Node content) {
Tab newTab = new Tab();
newTab.setText(text);
newTab.setClosable(closable);
newTab.setContent(content);
return newTab;
}
示例8: 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());
}
}
示例9: markDirty
import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void markDirty(Group group) {
Tab tab = groupTabMap.get(group.getName());
if (tab.getText().indexOf("*") < 0) {
tab.setText(tab.getText() + "*");
}
if (!tab.getStyleClass().contains("modified")) {
tab.getStyleClass().add("modified");
}
}
示例10: unmarkDirty
import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void unmarkDirty(Group modified) {
Tab tab = groupTabMap.get(modified.getName());
tab.getStyleClass().remove("modified");
if (tab.getText().indexOf("*") >= 0) {
String text = tab.getText().substring(0, tab.getText().indexOf("*"));
tab.setText(text);
}
}
示例11: start
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
TabPane tp = new TabPane();
Tab t1 = new Tab("First");
t1.setGraphic(new ProgressBar());
t1.setContent(new TextArea("Stuff"));
Tab t2 = new Tab("Second");
t2.setContent(new Button("Hey!"));
tp.getTabs().addAll(t1,t2);
DragDropFX ddfx = new DragDropFX();
ddfx.addFunction(TabPane.class, new Func<Object, Void>() {
@Override
public Void call(Object p) {
DnDPrepare.tabPane((TabPane) p);
return null;
}
});
ddfx.handle(tp);
t1.setText("Change!");
// t1.setGraphic(null);
primaryStage.setScene(new Scene(tp));
primaryStage.show();
Stage second = new Stage();
TabPane tp2 = new TabPane();
tp2.getTabs().add(new Tab("Hey!"));
ddfx.handle(tp2);
second.setScene(new Scene(tp2));
second.show();
}
示例12: addTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
private void addTab(String tabTitle, Node tabContent) {
Tab tab = new Tab();
tab.setText(tabTitle);
tab.setContent(tabContent);
tab.setClosable(false);
center.getTabs().add(tab);
}
示例13: start
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
try {
// Image setting = new Image(getClass().getResourceAsStream("setting.png"j));
Image logoimg = new Image(getClass().getResourceAsStream("logo.png"));
// Button settingbtn = new Button("",new ImageView(setting));
// settingLabel.setStyle("-fx-background-color:#1d1d1d");
JFXButton logobtn = new JFXButton("",new ImageView(logoimg));
Label title = new Label(" Energy Saving System");
title.setFont(new Font(30));
title.setPrefSize(650, 60);
title.setStyle("-fx-background-color:#1d1d1d; \n -fx-text-fill:white ;");
HBox hbox = new HBox();
hbox.setStyle("-fx-background-color:#1d1d1d");
hbox.setSpacing(10);
hbox.setPadding(new Insets(10,10,10,10));
hbox.getChildren().addAll(logobtn,title);
BorderPane root = new BorderPane();
root.setTop(hbox);
JFXTabPane pane = new JFXTabPane();
pane.setSide(Side.RIGHT);
Tab tab1 = new Tab();
Tab tab2 = new Tab();
Tab tab3 = new Tab();
tab3.setText("Settings");
tab2.setText("Tweaks");
tab2.setContent(new Tweaks().getPane());
tab1.setText("Statistics");
tab1.setContent(new ChartControls().getPane());
pane.getTabs().addAll(tab1,tab2,tab3);
root.setCenter(pane);
Scene scene = new Scene(root,910,550);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
示例14: getSimpleTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
public static Tab getSimpleTab(String text, Node graphic, Node content) {
Tab tab = new Tab();
if (text != null) {
tab.setText(text);
}
if (graphic != null) {
tab.setGraphic(graphic);
}
if (content != null) {
tab.setContent(content);
}
return tab;
}
示例15: constructContainer
import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public Parent constructContainer()
{
bp.setId("loginviewbg");
list = new ListView<String>();
items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
list.setItems(items);
AllFields = new VBox(50);
AllFields.setAlignment(Pos.CENTER);
AllFields.setMaxWidth(300);
AllFields.setPadding(new Insets(20));
tabPane = new TabPane();
tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
Tab tabDerive = new Tab();
tabDerive.setText("Derive");
HBox hbox = new HBox();
hbox.setPadding(new Insets(20, 0, 0, 0));
hbox.setStyle("-fx-font: 24 'System Regular'");
hbox.getChildren().add(new Label(tabDerive.getText()));
hbox.setAlignment(Pos.CENTER);
tabDerive.setContent(hbox);
Tab tabTeamwork = new Tab();
tabTeamwork.setText("Teamwork");
HBox hbox2 = new HBox();
hbox2.setPadding(new Insets(20, 0, 0, 0));
hbox2.setStyle("-fx-font: 24 'System Regular'");
hbox2.getChildren().add(new Label(tabTeamwork.getText()));
hbox2.setAlignment(Pos.CENTER);
tabTeamwork.setContent(hbox2);
tabPane.getTabs().addAll(tabDerive, tabTeamwork);
tabPane.getSelectionModel().getSelectedItem().setStyle("-fx-background-color:#a3a4a8");
tabPane.setOnMouseClicked(e -> {
for(Tab actTab:tabPane.getTabs())
{
actTab.setStyle("-fx-background-color:#f0f0f0");
}
tabPane.getSelectionModel().getSelectedItem().setStyle("-fx-background-color:#a3a4a8");
if(tabPane.getSelectionModel().getSelectedIndex()== 0)
{
btnContinue.setOnAction(ev -> getFXController().showView("deriveserverdoorview"));
} else
{
btnContinue.setOnAction(ev -> getFXController().showView("teamworkserverdoorview"));
}
});
SearchDMO = new HBox();
Bottom = new HBox();
txtDMO = new TextField();
txtDMO.setMinHeight(50);
txtDMO.setMinWidth(700);
txtDMO.setPromptText("Email-Adresse des Benutzers");
btnSearch = new AppButton("Suchen");
btnContinue = new AppButton("Weiter zum DMO");
back = new BackButton(getFXController(),"Zur�ck");
SearchDMO.getChildren().addAll(txtDMO,btnSearch);
Bottom.getChildren().addAll(back, btnContinue);
AllFields.getChildren().addAll(SearchDMO,list,Bottom);
bp.setTop(tabPane);
bp.setCenter(AllFields);
bp.setBottom(Bottom);
return bp;
}