Java Code Examples for javafx.fxml.FXMLLoader#setLocation()
The following examples show how to use
javafx.fxml.FXMLLoader#setLocation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddTagDialog.java From phoebus with Eclipse Public License 1.0 | 6 votes |
public AddTagDialog(final Node parent, final Collection<String> tags) { getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); setResizable(true); FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("SelectEntity.fxml")); try { getDialogPane().setContent(loader.load()); SelectEntityController controller = loader.getController(); controller.setAvaibleOptions(tags); setResultConverter(button -> { return button == ButtonType.OK ? Tag.Builder.tag(controller.getSelectedOption()).build() : null; }); } catch (IOException e) { // TODO update the dialog logger.log(Level.WARNING, "Failed to add tag", e); } }
Example 2
Source File: OKCloseButtonBar.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
/** * * @param okAction what happens when OK is called * @param cancelAction what happens when cancel is called */ public OKCloseButtonBar(EventHandler<ActionEvent> okAction, EventHandler<ActionEvent> cancelAction) { try { this.okAction = okAction; this.cancelAction = cancelAction; FXMLLoader loader = new FXMLLoader(); loader.setResources(LanguageBundle.getBundle()); loader.setController(this); loader.setRoot(this); loader.setLocation(getClass().getResource("OKCloseButtonBar.fxml")); loader.load(); } catch (IOException e) { throw new IORuntimeException(e); } }
Example 3
Source File: BrowserListCell.java From phoebus with Eclipse Public License 1.0 | 6 votes |
public BrowserListCell(ContextMenu snapshotContextMenu) { FXMLLoader loader = new FXMLLoader(); try { loader.setLocation(BrowserListCell.class.getResource("TreeCellGraphic.fxml")); javafx.scene.Node rootNode = loader.load(); snapshotBox = rootNode.lookup("#snapshot"); } catch (IOException e) { e.printStackTrace(); } setContentDisplay(ContentDisplay.GRAPHIC_ONLY); this.snapshotContextMenu = snapshotContextMenu; }
Example 4
Source File: RemovePropertyDialog.java From phoebus with Eclipse Public License 1.0 | 6 votes |
public RemovePropertyDialog(final Node parent, final Collection<String> tags) { getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); setResizable(true); FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("SelectEntity.fxml")); try { getDialogPane().setContent(loader.load()); SelectEntityController controller = loader.getController(); controller.setAvaibleOptions(tags); setResultConverter(button -> { return button == ButtonType.OK ? Property.Builder.property(controller.getSelectedOption()).build() : null; }); } catch (IOException e) { // TODO update the dialog logger.log(Level.WARNING, "Failed to remove property", e); } }
Example 5
Source File: BrowserTreeCell.java From phoebus with Eclipse Public License 1.0 | 6 votes |
public BrowserTreeCell(ContextMenu folderContextMenu, ContextMenu saveSetContextMenu, ContextMenu snapshotContextMenu, ContextMenu rootFolderContextMenu) { FXMLLoader loader = new FXMLLoader(); try { loader.setLocation(BrowserTreeCell.class.getResource("TreeCellGraphic.fxml")); javafx.scene.Node rootNode = loader.load(); folderBox = rootNode.lookup("#folder"); saveSetBox = rootNode.lookup("#saveset"); snapshotBox = rootNode.lookup("#snapshot"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } setContentDisplay(ContentDisplay.GRAPHIC_ONLY); this.folderContextMenu = folderContextMenu; this.saveSetContextMenu = saveSetContextMenu; this.snapshotContextMenu = snapshotContextMenu; this.rootFolderContextMenu = rootFolderContextMenu; }
Example 6
Source File: EmailApp.java From phoebus with Eclipse Public License 1.0 | 6 votes |
@Override public AppInstance create() { try { final FXMLLoader loader = new FXMLLoader(); loader.setLocation(EmailApp.class.getResource("ui/SimpleCreate.fxml")); Parent root = loader.load(); final SimpleCreateController controller = loader.getController(); Scene scene = new Scene(root, 600, 800); Stage stage = new Stage(); stage.setTitle("Send Email"); stage.setScene(scene); controller.setSnapshotNode(DockPane.getActiveDockPane()); stage.show(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to create email dialog", e); } return null; }
Example 7
Source File: ListMultiOrderedPickerDialog.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** * * @param parent * @param aviableOptions * @param selectedOptions * @param initial */ public ListMultiOrderedPickerDialog(final List<String> aviableOptions, final List<String> selectedOptions) { getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); setResizable(true); FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("ListMultiOrderedPicker.fxml")); try { getDialogPane().setContent(loader.load()); ListMultiOrderedPickerController controller = loader.getController(); controller.setAvaibleOptions(aviableOptions); controller.setOrderedSelectedOptions(selectedOptions); setResultConverter(button -> { return button == ButtonType.OK ? controller.getOrderedSelectedOptions() : null; }); } catch (IOException e) { logger.log(Level.WARNING, "ListMultiOrderedPickerDialog failed ", e); } }
Example 8
Source File: HelloWorld.java From Learn-Java-12-Programming with MIT License | 5 votes |
public void start5(Stage primaryStage) { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(new URL("file:src/main/resources/helloWorld.fxml")); Scene scene = loader.load(); primaryStage.setTitle("Simple form example"); primaryStage.setScene(scene); primaryStage.onCloseRequestProperty() .setValue(e -> System.out.println("\nBye! See you later!")); primaryStage.show(); } catch (Exception ex){ ex.printStackTrace(); } }
Example 9
Source File: ChannelTable.java From phoebus with Eclipse Public License 1.0 | 5 votes |
ChannelTable(final ChannelTableApp app) { this.app = app; try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("ui/ChannelTable.fxml")); tab = new DockItem(this, loader.load()); controller = loader.getController(); controller.setClient(app.getClient()); DockPane.getActiveDockPane().addTab(tab); } catch (IOException e) { Logger.getLogger(getClass().getName()).log(Level.WARNING, "Cannot load UI", e); } }
Example 10
Source File: ChannelInfo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void call(Selection selection) throws Exception { List<ProcessVariable> pvs = new ArrayList<>(); List<Channel> channels = new ArrayList<>(); SelectionService.getInstance().getSelection().getSelections().stream().forEach(s -> { if (s instanceof Channel) { channels.add((Channel)s); } else if (s instanceof ProcessVariable) { pvs.add((ProcessVariable) s); } }); FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("ui/ChannelInfoTree.fxml")); Alert alert = new Alert(INFORMATION); alert.setTitle(NAME); alert.setHeaderText(null); alert.setGraphic(null); alert.getDialogPane().setContent(loader.load()); ChannelInfoTreeController controller = loader.getController(); controller.setChannels(channels); // Query channelfinder for selected pvs on a separate thread. pvs.forEach(pv -> { ChannelSearchJob.submit(this.client, pv.getName(), result -> Platform.runLater(() -> { controller.addChannels(result); }), (url, ex) -> ExceptionDetailsErrorDialog.openError("ChannelFinder Query Error", ex.getMessage(), ex)); }); alert.showAndWait(); }
Example 11
Source File: mainApp.java From SeedSearcherStandaloneTool with GNU General Public License v3.0 | 5 votes |
@Override public void start(Stage mainStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("/sassa/fxml/layout.fxml")); BorderPane vbox = loader.load(); Scene scene = new Scene(vbox); mainStage.setTitle("Sassa-" + VERSION); mainStage.setScene(scene); mainStage.show(); fxmlController fxml = new fxmlController(); fxml.startSeedSearcher(); }
Example 12
Source File: Activity.java From AchillesFx with MIT License | 5 votes |
/** * Sets content view. * * @param layoutName the layout path * @param bundle the bundle * @param stylePaths the style paths */ public void setContentView(String layoutName, ResourceBundle bundle, String... stylePaths) { Parent parent = null; FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.context.getResource(layoutName)); loader.setController(this); try { parent = loader.load(); } catch (IOException e) { logger.error("achilles error", e); return; } this.setContentView(parent, bundle, stylePaths); }
Example 13
Source File: PokemonHomeController.java From dctb-utfpr-2018-1 with Apache License 2.0 | 5 votes |
private void showPokemonAction(Pokemon poke) throws IOException { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getClassLoader().getResource("pokemonregister/View/PokemonDisplay.fxml")); Parent root = loader.load(); PokemonDisplayController displayController = loader.getController(); displayController.setScreenData(stage, DisplayMode.SHOW_POKEMON, poke); Scene scene = new Scene(root); stage.setScene(scene); }
Example 14
Source File: Archivo.java From archivo with GNU General Public License v3.0 | 5 votes |
private void initRootLayout() { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(Archivo.class.getResource("view/RootLayout.fxml")); BorderPane rootLayout = loader.load(); rootController = loader.getController(); rootController.setMainApp(this); rootController.disableMenuItems(); Scene scene = new Scene(rootLayout); URL styleUrl = getClass().getClassLoader().getResource("resources/style.css"); if (styleUrl != null) { scene.getStylesheets().add(styleUrl.toExternalForm()); } primaryStage.setScene(scene); primaryStage.getIcons().addAll( new Image(getClass().getClassLoader().getResourceAsStream("resources/archivo-16.png")), new Image(getClass().getClassLoader().getResourceAsStream("resources/archivo-32.png")), new Image(getClass().getClassLoader().getResourceAsStream("resources/archivo-64.png")), new Image(getClass().getClassLoader().getResourceAsStream("resources/archivo-96.png")), new Image(getClass().getClassLoader().getResourceAsStream("resources/archivo-128.png")), new Image(getClass().getClassLoader().getResourceAsStream("resources/archivo-48.png")) ); primaryStage.show(); } catch (IOException e) { logger.error("Error initializing main window: ", e); } }
Example 15
Source File: ListSelectionDemo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void start(Stage primaryStage) throws IOException { FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("AddProperty.fxml")); loader.load(); AddPropertyController controller = loader.getController(); controller.setAvaibleOptions(Arrays.asList("prop1", "prop2", "prop3")); Parent root = loader.getRoot(); primaryStage.setScene(new Scene(root, 400, 400)); primaryStage.show(); }
Example 16
Source File: SaveSetSelectionWithSplitController.java From phoebus with Eclipse Public License 1.0 | 5 votes |
public SavesetListCell() { FXMLLoader loader = new FXMLLoader(); try { loader.setLocation(getClass().getClassLoader().getResource("org/phoebus/applications/saveandrestore/ui/TreeCellGraphic.fxml")); javafx.scene.Node rootNode = loader.load(); saveSetBox = rootNode.lookup("#saveset"); } catch (IOException e) { e.printStackTrace(); } setContentDisplay(ContentDisplay.GRAPHIC_ONLY); }
Example 17
Source File: DisplayNavigationViewDemo.java From phoebus with Eclipse Public License 1.0 | 4 votes |
@Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("DisplayNavigationView.fxml")); loader.load(); DisplayNavigationViewController controller = loader.getController(); URL url = getClass().getClassLoader().getResource("bob/root.bob"); File rootFile = new File(url.getPath()); controller.setRootFile(rootFile); Parent root = loader.getRoot(); stage.setScene(new Scene(root, 400, 400)); stage.show(); }
Example 18
Source File: MultiStageMain.java From examples-javafx-repos1 with Apache License 2.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { if( logger.isInfoEnabled() ) { logger.info("Starting application"); } Application.Parameters parameters = getParameters(); // // Create initial screen; initialize subapps (found on classpath) // FXMLLoader loader = new FXMLLoader(); loader.setLocation( MultiStageMain.class.getResource("app_core/homeScreen.fxml") ); Parent p = loader.load(); HomeScreenController c = (HomeScreenController)loader.getController(); if( parameters.getRaw().contains("bootstrap=true") ) { if( logger.isDebugEnabled() ) { logger.debug("[START] running in bootstrap mode"); } } else { if( logger.isDebugEnabled() ) { logger.debug("[START] running in full mode"); } // // Build runtime classpath from .examples-javafx-dynamic/subapps // folder contents // buildURLClassLoader(); // // Initializes home object w. args for Guice Module // c.initializeHome(subappJars, startupCommandsFullPath); // // Will additionally scan packages for modules to load with // Reflections library // c.initializeSubApps(urlClassLoader, urls); } // // Show main screen // Scene scene = new Scene( p ); primaryStage.setTitle( "Core" ); primaryStage.setScene( scene ); primaryStage.show(); }
Example 19
Source File: LogPropertiesDemo.java From phoebus with Eclipse Public License 1.0 | 4 votes |
@Override public void start(Stage primaryStage) throws IOException { Map<String, String> tracAttributes = new HashMap<>(); tracAttributes.put("id", "1234"); tracAttributes.put("URL", "https://trac.epics.org/tickets/1234"); Property track = PropertyImpl.of("Track",tracAttributes); Map<String, String> experimentAttributes = new HashMap<>(); experimentAttributes.put("id", "1234"); experimentAttributes.put("type", "XPD xray diffraction"); experimentAttributes.put("scan-id", "6789"); Property experimentProperty = PropertyImpl.of("Experiment", experimentAttributes); FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("LogProperties.fxml")); loader.load(); final LogPropertiesController controller = loader.getController(); Node tree = loader.getRoot(); CheckBox checkBox = new CheckBox(); BooleanProperty editable = new SimpleBooleanProperty(); checkBox.selectedProperty().bindBidirectional(editable); controller.setProperties(Arrays.asList(track, experimentProperty)); editable.addListener((observable, oldValue, newValue) -> { controller.setEditable(newValue); }); VBox vbox = new VBox(); vbox.getChildren().add(checkBox); vbox.getChildren().add(tree); primaryStage.setScene(new Scene(vbox, 400, 400)); primaryStage.show(); primaryStage.setOnCloseRequest(v -> { controller.getProperties().stream().forEach(p -> { System.out.println(p.getName()); p.getAttributes().entrySet().stream().forEach(e -> { System.out.println(" " + e.getKey() + " : " + e.getValue()); }); }); }); }
Example 20
Source File: LogEntrySearchDemo.java From phoebus with Eclipse Public License 1.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("LogEntryTableView.fxml")); loader.load(); LogEntryTableViewController controller = loader.getController(); Parent root = loader.getRoot(); primaryStage.setScene(new Scene(root, 400, 400)); primaryStage.show(); List<LogEntry> logs = new ArrayList<LogEntry>(); Set<Tag> tags = new HashSet<Tag>(); tags.add(TagImpl.of("tag1", "active")); tags.add(TagImpl.of("tag2", "active")); Set<Logbook> logbooks = new HashSet<Logbook>(); logbooks.add(LogbookImpl.of("logbook1", "active")); logbooks.add(LogbookImpl.of("logbook2", "active")); String path = "C:\\Users\\Kunal Shroff\\Pictures\\screenshot-git\\log-att"; File folder = new File(path); List<File> listOfFiles = Arrays.asList(folder.listFiles()); for (int i = 0; i < 10; i++) { LogEntryBuilder lb = LogEntryBuilder.log() .owner("Owner") .title("log "+ i) .description("First line for log " + i) .createdDate(Instant.now()) .inLogbooks(logbooks) .withTags(tags); StringBuilder sb = new StringBuilder(); for (int j = 0; j < i; j++) { sb.append("Some additional log text"); } lb.appendDescription(sb.toString()); listOfFiles.forEach(file -> { try { lb.attach(AttachmentImpl.of(file)); } catch (FileNotFoundException e) { e.printStackTrace(); } }); logs.add(lb.build()); } controller.setLogs(logs); }