本文整理汇总了Java中javafx.scene.control.Tab类的典型用法代码示例。如果您正苦于以下问题:Java Tab类的具体用法?Java Tab怎么用?Java Tab使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tab类属于javafx.scene.control包,在下文中一共展示了Tab类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IWURLField
import javafx.scene.control.Tab; //导入依赖的package包/类
public IWURLField(WebView webView, boolean secured, Tab tab) {
this.webView = webView;
this.tab = tab;
this.securedHTTP = secured;
setText(IWPropertyHelper.getProperty("default_homepage"));
webView.getEngine().getLoadWorker().stateProperty().addListener(
new ChangeListener<State>() {
@Override
public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) {
if (newValue == State.SUCCEEDED) {
tab.setText(webView.getEngine().getTitle());
}
if (newValue == State.FAILED) {
if(getText().toString().equals("")) {
webView.getEngine().loadContent("<html><title>Empty Tab</title><body></body></html>");
} else {
webView.getEngine().loadContent("<html><title>Oops!</title><body><b>Page not found!</b></body></html>");
}
}
}
});
}
示例2: marathon_select
import javafx.scene.control.Tab; //导入依赖的package包/类
@Override public boolean marathon_select(String tab) {
Matcher matcher = CLOSE_PATTERN.matcher(tab);
boolean isCloseTab = matcher.matches();
tab = isCloseTab ? matcher.group(1) : tab;
TabPane tp = (TabPane) node;
ObservableList<Tab> tabs = tp.getTabs();
for (int index = 0; index < tabs.size(); index++) {
String current = getTextForTab(tp, tabs.get(index));
if (tab.equals(current)) {
if (isCloseTab) {
((TabPaneSkin) tp.getSkin()).getBehavior().closeTab(tabs.get(index));
return true;
}
tp.getSelectionModel().select(index);
return true;
}
}
return false;
}
示例3: deserialize
import javafx.scene.control.Tab; //导入依赖的package包/类
@Override
public DashboardTabPane deserialize(JsonElement json, JsonDeserializationContext context) throws JsonParseException {
JsonArray jsonTabs = json.getAsJsonArray();
List<Tab> tabs = new ArrayList<>(jsonTabs.size());
for (JsonElement i : jsonTabs) {
JsonObject obj = i.getAsJsonObject();
String title = obj.get("title").getAsString();
DashboardTab tab = new DashboardTab(title);
tab.setWidgetPane(context.deserialize(obj.get("widgetPane"), WidgetPane.class));
tab.setSourcePrefix(obj.get("autoPopulatePrefix").getAsString());
tab.setAutoPopulate(obj.get("autoPopulate").getAsBoolean());
tabs.add(tab);
}
return new DashboardTabPane(tabs.toArray(new Tab[]{}));
}
示例4: WebBrowserTabController
import javafx.scene.control.Tab; //导入依赖的package包/类
/**
* Constructor
*
* @param tab
* @param firstWebSite
*/
public WebBrowserTabController(WebBrowserController webBrowserController, Tab tab, String firstWebSite) {
this.webBrowserController = webBrowserController;
this.tab = tab;
this.firstWebSite = firstWebSite;
this.tab.setContent(this);
// ------------------------------------FXMLLOADER ----------------------------------------
FXMLLoader loader = new FXMLLoader(getClass().getResource(InfoTool.FXMLS + "WebBrowserTabController.fxml"));
loader.setController(this);
loader.setRoot(this);
try {
loader.load();
} catch (IOException ex) {
logger.log(Level.SEVERE, "", ex);
}
}
示例5: showPlayers
import javafx.scene.control.Tab; //导入依赖的package包/类
@FXML
public void showPlayers() throws Exception {
log.debug("attempting to show players.");
spController = App.getShowPlayersController();
if (!spController.isShowing() && WorldConfig.getShowPlayersPopup()){
spController.showController();
}
App.spdc.setUpdated(true);
Tab curSelected = tabPane.getSelectionModel().getSelectedItem();
for(Saveable s: tabControllers){
if(s.getTab().equals(curSelected)){
App.spdc.addOne(s.getThing());
s.getThing().setShown(true);
Backend.SaveSimpleSearchable(s.getThing());
if (WorldConfig.getShowPlayersPopup())
{
spController.changeShown(App.spdc.getDefault(), true);
}
}
}
}
示例6: createSimpleMap
import javafx.scene.control.Tab; //导入依赖的package包/类
/**
* @param tab
* @param btn_clear_directions
* @param btn_show_directions
* @param btn_find_path
* @param btn_clear_path
* @param path_choice_pane
* @param btn_get_coords_find_path
* @param txt_from
* @param txt_to
*/
public void createSimpleMap(final Tab tab, final FlowPane flowPane, final Button btn_clear_directions,
final Button btn_show_directions, final Button btn_find_path,
final Button btn_clear_path, final Pane path_choice_pane,
final Button btn_get_coords_find_path, final TextField txt_from,
final TextField txt_to) {
//generates google map with some defaults and put it into top pane
mapComponent = new GoogleMapView("/html/maps.html");
mapComponent.addMapInializedListener(this);
mapComponent.addMapReadyListener(MOUSE_CLCK_FOR_GET_COORD_LISTENER);
initControls(btn_clear_directions, btn_show_directions, btn_find_path, btn_clear_path, path_choice_pane,
btn_get_coords_find_path, txt_from, txt_to);
mapComponent.getChildren().addAll(flowPane, path_choice_pane);
tab.setContent(mapComponent);
}
示例7: startGodTab
import javafx.scene.control.Tab; //导入依赖的package包/类
public static GodTabController startGodTab(God god) throws Exception {
log.debug("static startGodTab called.");
God ourG = god;
if(god != null){
log.debug("ourG got filled from backend");
ourG = Backend.getGodDao().getFullGod(god.getID());
}else
{
ourG = new God();
}
FXMLLoader loader = new FXMLLoader();
loader.setLocation(GodTabController.class.getResource("godTab.fxml"));
Tab rootLayout = (Tab)loader.load();
GodTabController cr = (GodTabController)loader.getController();
cr.start(rootLayout, ourG);
started = true;
return cr;
}
示例8: startEventTab
import javafx.scene.control.Tab; //导入依赖的package包/类
public static EventTabController startEventTab(Event event) throws Exception {
log.debug("static startRegionTab called.");
Event ourE = event;
if(event != null){
log.debug("ourR got filled from backend");
ourE = Backend.getEventDao().getFullEvent(event.getID());
}else
{
ourE = new Event();
}
FXMLLoader loader = new FXMLLoader();
loader.setLocation(EventTabController.class.getResource("eventTab.fxml"));
Tab rootLayout = (Tab)loader.load();
EventTabController cr = (EventTabController)loader.getController();
cr.start(rootLayout, ourE);
started = true;
return cr;
}
示例9: startTemplateTab
import javafx.scene.control.Tab; //导入依赖的package包/类
public static TemplateTabController startTemplateTab(Template template, Openable open) throws Exception {
log.debug("static startNpcTab called.");
Template ourT = template;
if(template != null){
log.debug("ourN got filled from backend");
template = Backend.getTemplateDao().getFullTemplate(template.getID());
}else
{
ourT = new Template();
}
FXMLLoader loader = new FXMLLoader();
loader.setLocation(TemplateTabController.class.getResource("templateTab.fxml"));
Tab rootLayout = (Tab)loader.load();
TemplateTabController cr = (TemplateTabController)loader.getController();
cr.start(rootLayout, ourT, open);
return cr;
}
示例10: startAutoUpdateTabs
import javafx.scene.control.Tab; //导入依赖的package包/类
public void startAutoUpdateTabs(){
tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
public void changed(ObservableValue<? extends Tab> observable, Tab oldTab, Tab newTab) {
if(AppConfig.getAutoUpdateTabs()){
if(!newTab.equals(oldTab)){
boolean tabAlreadyIndexed = false;
for(Saveable s: tabControllers){
if(s.getTab().equals(newTab)){
tabAlreadyIndexed = true;
break;
}
}
if(tabAlreadyIndexed){
findTab(newTab).autoUpdateTab();
}
else{
//don't update it's a new tab.
}
}
}
}
});
}
示例11: handleRequestToCloseEditor
import javafx.scene.control.Tab; //导入依赖的package包/类
@FXThread
private void handleRequestToCloseEditor(@NotNull final FileEditor editor, @NotNull final Tab tab,
@NotNull final Event event) {
if (!editor.isDirty()) {
return;
}
final String question = Messages.EDITOR_AREA_SAVE_FILE_QUESTION.replace("%file_name%", editor.getFileName());
final ConfirmDialog dialog = new ConfirmDialog(result -> {
if (result == null) return;
if (result) {
editor.save(fileEditor -> getTabs().remove(tab));
} else {
getTabs().remove(tab);
}
}, question);
dialog.show();
event.consume();
}
示例12: getClickAction
import javafx.scene.control.Tab; //导入依赖的package包/类
@Override
public void getClickAction(final Stage stage, final TabFactory tabFactory) {
List<Tab> tabs = FXCollections.observableArrayList(tabFactory.getTabPane().getTabs());
Collections.reverse(tabs);
AtomicBoolean close = new AtomicBoolean(true);
tabs.forEach(t -> {
if(close.get()){
EditorTab eTab = ((EditorTab) t);
if(!eTab.getEditorPane().exit()){
close.set(false);
return;
}else{
logger.debug("Closing tab {}", eTab.getEditorPane().getFile().getPath());
tabFactory.getTabPane().getTabs().remove(eTab);
}
}
});
if(close.get())
stage.close();
}
示例13: getChildren
import javafx.scene.control.Tab; //导入依赖的package包/类
private ObservableList<Node> getChildren(Node node) {
if (node instanceof ButtonBar) {
return ((ButtonBar) node).getButtons();
}
if (node instanceof ToolBar) {
return ((ToolBar) node).getItems();
}
if (node instanceof Pane) {
return ((Pane) node).getChildren();
}
if (node instanceof TabPane) {
ObservableList<Node> contents = FXCollections.observableArrayList();
ObservableList<Tab> tabs = ((TabPane) node).getTabs();
for (Tab tab : tabs) {
contents.add(tab.getContent());
}
return contents;
}
return FXCollections.observableArrayList();
}
示例14: 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);
}
}
示例15: populateMenuItems
import javafx.scene.control.Tab; //导入依赖的package包/类
private void populateMenuItems(ContextMenu contextMenu, Tab tab) {
int tabCount = getTabs().size();
int tabIndex = getTabs().indexOf(tab);
ObservableList<MenuItem> items = contextMenu.getItems();
items.clear();
MenuItem closeMenuItem = new MenuItem("Close");
closeMenuItem.setOnAction((e) -> requestClose(tab));
items.add(closeMenuItem);
if (tabCount > 1) {
MenuItem closeRestMenuItem = new MenuItem("Close Others");
closeRestMenuItem.setOnAction((e) -> closeOtherTabs(tab));
items.add(closeRestMenuItem);
}
if (tabCount > 1 && tabIndex != 0) {
MenuItem closeLeftTabsMenuItem = new MenuItem("Close Tabs to the Left");
closeLeftTabsMenuItem.setOnAction((e) -> closeTabsToLeft(tab));
items.add(closeLeftTabsMenuItem);
}
if (tabCount > 1 && tabIndex != tabCount - 1) {
MenuItem closeRigthTabsMenuItem = new MenuItem("Close Tabs to the Right");
closeRigthTabsMenuItem.setOnAction((e) -> closeTabsToRight(tab));
items.add(closeRigthTabsMenuItem);
}
if (tabCount > 1) {
MenuItem closeAllMenuItem = new MenuItem("Close All");
closeAllMenuItem.setOnAction((e) -> closeAllTabs());
items.addAll(new SeparatorMenuItem(), closeAllMenuItem);
}
}