当前位置: 首页>>代码示例>>Java>>正文


Java Tab.setGraphic方法代码示例

本文整理汇总了Java中javafx.scene.control.Tab.setGraphic方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.setGraphic方法的具体用法?Java Tab.setGraphic怎么用?Java Tab.setGraphic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Tab的用法示例。


在下文中一共展示了Tab.setGraphic方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:26,代码来源:JarFileType.java

示例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.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;
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:17,代码来源:ClassFileType.java

示例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;
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:27,代码来源:FolderType.java

示例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();
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:20,代码来源:TabUpdater.java

示例5: 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;
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:23,代码来源:SpecificationsPaneController.java

示例6: createTabPane

import javafx.scene.control.Tab; //导入方法依赖的package包/类
private TabPane createTabPane() {
    tabPane = new TabPane();
    tabPane.setId("ConfigurationTabPane");
    tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
    layouts = mpfConfigurationInfo.getProperties(this);
    for (IPropertiesLayout layout : layouts) {
        String name = layout.getName();
        Tab tab = new Tab(name, layout.getContent());
        tab.setId(name);
        tab.setGraphic(layout.getIcon());
        tabPane.getTabs().add(tab);
    }
    VBox.setVgrow(tabPane, Priority.ALWAYS);
    return tabPane;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:MPFConfigurationStage.java

示例7: newTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
private Tab newTab(Dockable dockable) {
    DockKey dockKey = dockable.getDockKey();
    Tab tab = new Tab(dockKey.getName(), dockable.getComponent());
    if (dockKey.getPolicy() == TabPolicy.NotClosable) {
        tab.setClosable(false);
    }
    if (dockKey.isCloseOptionsNeeded()) {
        MenuItem closeMenuItem = new MenuItem("Close");
        closeMenuItem.setOnAction((e) -> requestClose(tab));
        ContextMenu contextMenu = new ContextMenu(closeMenuItem);
        contextMenu.showingProperty().addListener((obs, wasShowing, isNowShowing) -> {
            if (isNowShowing) {
                populateMenuItems(contextMenu, tab);
            }
        });
        tab.setContextMenu(contextMenu);
    }
    dockKey.nameProperty().addListener((event, o, n) -> tab.setText(n));
    tab.setOnClosed((event) -> {
        remove(dockable);
    });
    tab.setGraphic(dockKey.getIcon());
    tab.setOnCloseRequest((event) -> {
        desktop.fireDockableStateWillChangeEvent(dockable, State.DOCKED, State.CLOSED, event);
    });
    return tab;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:28,代码来源:TabDockingContainer.java

示例8: updateTabPane

import javafx.scene.control.Tab; //导入方法依赖的package包/类
private void updateTabPane() {
    optionTabpane.getTabs().clear();
    layouts = getLauncherLayouts();
    for (ISubPropertiesLayout p : layouts) {
        Node content = p.getContent();
        if (Boolean.getBoolean("marathon.show.id")) {
            parent.addToolTips(content);
        }
        String name = p.getName();
        Tab tab = new Tab(name, content);
        tab.setId(name);
        tab.setGraphic(p.getIcon());
        optionTabpane.getTabs().add(tab);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:CompositeLayout.java

示例9: createButtonTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
 * Create Add level button tab. This makes the UI design clean and by disabling the tab and only
 * enabling the button, there won't be any awkward UI errors.
 *
 * @return
 */
private Tab createButtonTab () {
    Tab createLevelTab = new Tab();
    Button addNewLevelButton = new Button("+");
    addNewLevelButton.setOnAction(e -> addNewNamedLevel());
    createLevelTab.setGraphic(addNewLevelButton);
    createLevelTab.setDisable(true);
    createLevelTab.setClosable(false);
    return createLevelTab;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:16,代码来源:SceneTabViewer.java

示例10: 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();
	}
 
开发者ID:coalang-soft,项目名称:dragdropfx,代码行数:36,代码来源:TabDrag.java

示例11: 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;
}
 
开发者ID:XDean,项目名称:CSS-Editor-FX,代码行数:14,代码来源:Util.java

示例12: addEditor

import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
 * Add and open the new file editor.
 *
 * @param editor   the editor
 * @param needShow the need show
 */
@FXThread
private void addEditor(@NotNull final FileEditor editor, final boolean needShow) {

    final Path editFile = editor.getEditFile();

    final Tab tab = new Tab(editor.getFileName());
    tab.setGraphic(new ImageView(ICON_MANAGER.getIcon(editFile, DEFAULT_FILE_ICON_SIZE)));
    tab.setContent(editor.getPage());
    tab.setOnCloseRequest(event -> handleRequestToCloseEditor(editor, tab, event));

    final ObservableMap<Object, Object> properties = tab.getProperties();
    properties.put(KEY_EDITOR, editor);

    editor.dirtyProperty().addListener((observable, oldValue, newValue) -> {
        tab.setText(newValue == Boolean.TRUE ? "*" + editor.getFileName() : editor.getFileName());
    });

    final ObservableList<Tab> tabs = getTabs();
    tabs.add(tab);

    if (needShow) {
        final SingleSelectionModel<Tab> selectionModel = getSelectionModel();
        selectionModel.select(tab);
    }

    DictionaryUtils.runInWriteLock(getOpenedEditors(), editFile, tab, ObjectDictionary::put);

    EditorUtil.decrementLoading();

    if (isIgnoreOpenedFiles()) {
        return;
    }

    final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();

    if (workspace != null) {
        workspace.addOpenedFile(editFile, editor);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:46,代码来源:EditorAreaComponent.java

示例13: createTabGraphic

import javafx.scene.control.Tab; //导入方法依赖的package包/类
public Tab createTabGraphic (Node graphic, boolean closable, Node content) {
    Tab tab = createTab(closable, content);
    tab.setGraphic(graphic);
    return tab;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:6,代码来源:BasicUIFactory.java


注:本文中的javafx.scene.control.Tab.setGraphic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。