Java 类javafx.scene.control.Tab 实例源码
项目:icewolf
文件:IWURLField.java
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>");
}
}
}
});
}
项目:shuffleboard
文件:DashboardTabPaneSaver.java
@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[]{}));
}
项目:JavaFX-Web-Browser
文件:WebBrowserTabController.java
/**
* 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);
}
}
项目:fwm
文件:MainController.java
@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);
}
}
}
}
项目:main_carauto_board
文件:GmapfxController.java
/**
* @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);
}
项目:fwm
文件:GodTabController.java
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;
}
项目:fwm
文件:EventTabController.java
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;
}
项目:fwm
文件:TemplateTabController.java
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;
}
项目:fwm
文件:TabControlled.java
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.
}
}
}
}
});
}
项目:jmonkeybuilder
文件:EditorAreaComponent.java
@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();
}
项目:textmd
文件:EditorExitItem.java
@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();
}
项目:marathonv5
文件:ModalDialog.java
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();
}
项目:UDE
文件:Controller.java
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);
}
}
项目:can4eve
文件:JFXTripletDisplay.java
/**
* 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));
}
}
项目:marathonv5
文件:TabDockingContainer.java
@Override public void getDockables(List<DockableState> dockables) {
ObservableList<Tab> tabs = getTabs();
for (Tab tab : tabs) {
if (tab.getContent() instanceof IDockingContainer) {
((IDockingContainer) tab.getContent()).getDockables(dockables);
} else {
for (Dockable dockable : this.dockables) {
Node component = dockable.getComponent();
Node content = tab.getContent();
if (component == content) {
dockables.add(dockable.getDockableState());
}
}
}
}
}
项目:can4eve
文件:TestHelpPages.java
public void loopTabs(JFXTripletDisplay jfxDisplay) {
XYTabPane xyTabPane = jfxDisplay.getXyTabPane();
ObservableList<Tab> vtabs = xyTabPane.getvTabPane().getTabs();
for (Tab vtab : vtabs) {
xyTabPane.getvTabPane().getSelectionModel().select(vtab);
TabPane hTabPane = xyTabPane.getSelectedTabPane();
ObservableList<Tab> htabs = hTabPane.getTabs();
if (vtab.getTooltip() != null) {
String vTitle = vtab.getTooltip().getText();
for (Tab htab : htabs) {
hTabPane.getSelectionModel().select(htab);
String title = htab.getTooltip().getText();
System.out.println(vTitle + "_" + title);
snapShot(jfxDisplay.getStage(),vTitle+"_"+title);
}
}
}
done=true;
}
项目:marathonv5
文件:JavaFXTabPaneElement.java
@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;
}
项目:marathonv5
文件:TabSample.java
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);
}
项目:ClassViewer
文件:ClassFileType.java
@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;
}
项目:ClassViewer
文件:Viewer.java
@SuppressWarnings("unchecked")
public void openFile(URL url) {
try {
Log.info("Open file: " + url);
if (url != null) {
OpenFileTask task = new OpenFileTask(this, url);
task.setOnSucceeded(event -> {
List<Tab> tabs = (List<Tab>) event.getSource().getValue();
addTabs(tabs);
menuBar.updateRecentFiles();
});
task.runInNewThread();
}
} catch (Exception e) {
Log.error(e);
ViewerAlert.exceptionAlert(e);
}
}
项目:shuffleboard
文件:DashboardTabPaneSaver.java
@Override
public JsonElement serialize(DashboardTabPane src, JsonSerializationContext context) {
JsonArray tabs = new JsonArray();
for (Tab t : src.getTabs()) {
if (t instanceof DashboardTab) {
DashboardTab tab = (DashboardTab) t;
JsonObject object = new JsonObject();
object.addProperty("title", tab.getTitle());
object.addProperty("autoPopulate", tab.isAutoPopulate());
object.addProperty("autoPopulatePrefix", tab.getSourcePrefix());
object.add("widgetPane", context.serialize(tab.getWidgetPane()));
tabs.add(object);
}
}
return tabs;
}
项目:Goliath-Overclocking-Utility-FX
文件:MonitoringPane.java
public MonitoringPane()
{
super();
super.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
super.setPrefWidth(AppTabPane.CONTENT_WIDTH);
super.setSide(Side.BOTTOM);
Tab[] tabs = new Tab[3];
tabs[0] = new Tab("Core Usage");
tabs[0].setContent(new CoreUsageMonitorPane());
tabs[1] = new Tab("Memory Usage");
tabs[1].setContent(new MemoryUsageMonitorPane());
tabs[2] = new Tab("Temperature");
tabs[2].setContent(new TempMonitorPane());
for(int i = 0; i < tabs.length; i++)
tabs[i].setClosable(false);
super.getTabs().addAll(tabs);
}
项目:CSS-Editor-FX
文件:MainFrameController.java
private TabEntity openFile(File file) {
if (file != null) {
int index = getFileIndex(file);
if (index != -1) {
tabPane.getSelectionModel().select(index);
return tabList.get(index);
}
}
TabEntity tabEntity = new TabEntity();
tabEntity.file.set(file);
tabEntity.loadFile();
Tab tab = tabEntity.tab;
tab.setOnCloseRequest(e -> andFinal(() -> close(), () -> e.consume()));
tab.setContent(tabEntity.codeArea);
tab.textProperty().bind(tabEntity.name);
tabList.add(tabEntity);
tabPane.getSelectionModel().select(tab);
return tabEntity;
}
项目:WebPLP
文件:Main.java
private void onTabActivation(ObservableValue<? extends Tab> value, Tab old,
Tab current)
{
ASMFile previousASM = openFileTabs.getKey(current);
if (previousASM != null)
previousASM.contentProperty().removeListener(this::updateOutline);
ASMFile asmFile = openFileTabs.getKey(current);
if (asmFile != null)
{
String content = asmFile.getContent();
List<PLPLabel> labels = PLPLabel.scrape(content);
outlineView.setModel(FXCollections.observableArrayList(labels));
asmFile.contentProperty().addListener(this::updateOutline);
}
}
项目:NetCompile
文件:TestSceneController.java
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);
}
项目:x-facteur
文件:PathView.java
@SuppressWarnings("unchecked")
public void reload() {
tabs.getTabs().clear();
for (Path path: PathController.getItems()) {
// create one tab per path
VBox container = new VBox(8);
container.setPadding(new Insets(20));
Text header = new Text("" + path.getMailman());
TableView<Path.PathStep> pathTable = new TableView<Path.PathStep>();
pathTable.setItems(FXCollections.observableList(path.getSteps()));
TableColumn<Path.PathStep, String> shipmentCol = new TableColumn<Path.PathStep, String>("Envois");
shipmentCol.setCellValueFactory(new PropertyValueFactory<Path.PathStep, String>("shipment"));
TableColumn<Path.PathStep, String> distanceToNextCol = new TableColumn<Path.PathStep, String>("Distances au suivant (km)");
distanceToNextCol.setCellValueFactory(new PropertyValueFactory<Path.PathStep, String>("distanceToNext"));
TableColumn<Path.PathStep, String> sumDistanceCol = new TableColumn<Path.PathStep, String>("Distances cumulées (km)");
sumDistanceCol.setCellValueFactory(new PropertyValueFactory<Path.PathStep, String>("sumDistance"));
pathTable.getColumns().setAll(shipmentCol, distanceToNextCol, sumDistanceCol);
container.getChildren().addAll(header, pathTable);
String tabName = path.getMailman().getName().charAt(0) + ". " + path.getMailman().getLastName() + " (" + path.size() + ")";
tabs.getTabs().add(new Tab(tabName, container));
}
}
项目:fwm
文件:NpcTabController.java
public static NpcTabController startNpcTab(Npc npc) throws Exception {
log.debug("static startNpcTab called.");
Npc ourN = npc;
if(npc != null){
if(npc.getID() == -1){
log.debug("Did not fill from backend, created by template.");
ourN = npc;
}
else
{
log.debug("ourN got filled from backend");
ourN = Backend.getNpcDao().getFullNpc(npc.getID());
}
}else
{
ourN = new Npc();
}
FXMLLoader loader = new FXMLLoader();
loader.setLocation(NpcTabController.class.getResource("npcTab.fxml"));
Tab rootLayout = (Tab)loader.load();
NpcTabController cr = (NpcTabController)loader.getController();
cr.start(rootLayout, ourN);
started = true;
return cr;
}
项目:MineIDE
文件:TabHelper.java
public static Tab createTabWithContextMenu(final String title, final String id, final String iconPath)
{
final Tab tab = new DraggableTab(title, iconPath); // new Tab(title);//
tab.setId(id);
addContextMenu(tab);
return tab;
}
项目:fwm
文件:StatBlockTabController.java
public void start(Tab rootLayout, Statblock s, Saveable beSaved) throws Exception {
log.debug("statBlockTab.start called");
stat = s;
this.beSaved = beSaved ;
log.debug("Stat ID:" + s.getID());
setAllTexts(stat);
thingsThatCanChange = new TextInputControl[] {nameText, statBlockText};
nameText.textProperty().addListener(nameListener);
for(TextInputControl c: thingsThatCanChange){
c.setOnKeyReleased(saveEvent);
}
}
项目:TechnicalAnalysisTool
文件:ChartTabPane.java
/**
* Constructor
*/
public ChartTabPane(TatMain app) {
application = app;
getSelectionModel().selectedItemProperty().addListener(
new ChangeListener<Tab>() {
@Override
public void changed(ObservableValue<? extends Tab> ov, Tab t, Tab t1) {
if (t1 != null){
if (t1.getContent() instanceof ChartCanvasPane){
ChartCanvasPane pane = (ChartCanvasPane)t1.getContent();
categoryProperty.setValue(pane.category);
marketCodeProperty.setValue(pane.marketCode);
codeProperty.setValue(pane.code);
currentCalendar.bind(pane.currentCalendar);
openProperty.bind(pane.openProperty);
highProperty.bind(pane.highProperty);
lowProperty.bind(pane.lowProperty);
closeProperty.bind(pane.closeProperty);
volumeProperty.bind(pane.volumeProperty);
//Everytime when current chart is changed
//We need to reload indicator settings for this chart if it contains any
application.onSelectChartTab(categoryProperty.getValue(), marketCodeProperty.getValue(), codeProperty.getValue());
}
}else {
application.hideCross();
//Remove all of its indicators and also indicator tab is also removed
//Means this chart is closed
application.closeIndicatorSettingPane(categoryProperty.getValue(), marketCodeProperty.getValue(), codeProperty.getValue());
}
}
}
);
}
项目:FlashLib
文件:LogWindow.java
private Scene loadScene(){
BorderPane root = new BorderPane();
textArea = new TextArea();
textArea.setEditable(false);
textArea.setPrefSize(300, 200);
root.setCenter(textArea);
BorderPane.setAlignment(root, Pos.CENTER);
tabs = new TabPane();
for (RemoteLog remoteLog : logs) {
Tab tab = new Tab(remoteLog.getName());
tab.setClosable(false);
tabs.getTabs().add(tab);
}
if(tabs.getTabs().size() > 0){
tabs.getSelectionModel().select(0);
selectLog(0);
}
tabs.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>(){
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
selectLog(newValue.intValue());
}
});
root.setTop(tabs);
return new Scene(root, 450, 300);
}
项目:file-transfer
文件:MainWindow.java
public MainWindow(Stage primaryStage) {
this.primaryStage = primaryStage;
TabPane tabPane = new TabPane();
Tab aboutTab = new Tab("About", new AboutPane(primaryStage));
aboutTab.setClosable(false);
Tab receiveTab = new Tab("Receive", new ReceiveNetPane(primaryStage));
receiveTab.setClosable(false);
Tab sendTab = new Tab("Send", new SendNetPane(primaryStage));
sendTab.setClosable(false);
tabPane.getTabs().addAll(aboutTab, sendTab, receiveTab);
setCenter(tabPane);
}
项目:stvs
文件:SpecificationsPaneController.java
private void onSwitchActiveTab(Tab tab) {
SpecificationController controller = controllers.get(tab);
if (controller == null) {
scenario.setActiveSpec(null);
} else {
scenario.setActiveSpec(controller.getSpec());
}
}
项目:voogasalad-ltub
文件:MasterDeveloperInterface.java
private void instantiateTabs() {
developerTabs = new TabPane();
Tab spriteCreation = new Tab("Sprite creation",new SpriteCreationScreen(myModelData));
Tab GeneralDataTab = new Tab(myResources.getString(GENERAL_DATA), myGeneralDataCreator);
//Tab ScreenSettingView = new Tab(myResources.getString(SCREEN_SETTING), new ScreenModelCreator(myModelData.getScreenSprites(),myGeneralDataCreator, new ScreenModelData()));
ObservableList<Tab> myTabs = developerTabs.getTabs();
//myTabs.addAll(spriteCreation,GeneralDataTab, ScreenSettingView);
}
项目:fwm
文件:PreviouslyEditedTabController.java
public static PreviouslyEditedTabController startPreviouslyEditedTab() throws Exception {
log.debug("static startPreviouslyEditedTab called.");
FXMLLoader loader = new FXMLLoader();
loader.setLocation(PreviouslyEditedTabController.class.getResource("PreviouslyEditedTab.fxml"));
Tab rootLayout = (Tab)loader.load();
PreviouslyEditedTabController cr = (PreviouslyEditedTabController)loader.getController();
cr.start(rootLayout);
started = true;
return cr;
}
项目:fx-media-catalog
文件:FxMediaCatalog.java
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;
}
项目:jmonkeybuilder
文件:EditorAreaComponent.java
/**
* Get the current showed editor.
*
* @return the current editor.
*/
@FXThread
public @Nullable FileEditor getCurrentEditor() {
final Tab selectedTab = getSelectionModel().getSelectedItem();
if (selectedTab == null) return null;
final ObservableMap<Object, Object> properties = selectedTab.getProperties();
return (FileEditor) properties.get(KEY_EDITOR);
}
项目:WebPLP
文件:Main.java
private CodeEditor getActiveCodeEditor()
{
Tab activeTab = openProjectsPanel.getSelectionModel().getSelectedItem();
if (activeTab == null)
return null;
Node tabContents = activeTab.getContent();
if (tabContents != null)
return (CodeEditor) tabContents;
else
return null;
}
项目:GameAuthoringEnvironment
文件:BasicUIFactory.java
@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;
}
项目:GestureFX
文件:SamplerController.java
@Override
public void initialize(URL location, ResourceBundle resources) {
List<SampleEntry> samples = Arrays.asList(
new SampleEntry("Lena(ImageView)", LenaSample::new),
new SampleEntry("FXML(ImageView)", FXMLSample::new),
new SampleEntry("ViewportRect(ImageView)", ViewportRectSample::new),
new SampleEntry("Arbitrary Node(SubScene)", ArbitraryNodeSample::new),
new SampleEntry("WebView(Transformable)", WebViewSample::new),
new SampleEntry("Swing(ImageView)", SwingSample::new)
);
samples.forEach(s -> tabs.getTabs().add(new Tab(s.name, s.sampleFactory.get().mkRoot())));
link.setOnAction(e -> {
// for cases where java was started in something like i3wm
if (hostServices == null) {
TextInputDialog dialog = new TextInputDialog(URI);
dialog.setTitle("HostService missing");
dialog.setHeaderText("Unable to open URL due to missing HostService");
dialog.setContentText("URL");
dialog.showAndWait();
} else hostServices.showDocument(URI);
});
}