List of usage examples for javafx.scene.layout AnchorPane setLeftAnchor
public static void setLeftAnchor(Node child, Double value)
From source file:cz.lbenda.dataman.db.sql.SQLEditorController.java
@SuppressWarnings("unchecked") public SQLEditorController(Consumer<Object> menuItemConsumer, Scene scene, ObjectProperty<DbConfig> dbConfigProperty, NodeShower nodeShower) { node.setMaxHeight(Double.MAX_VALUE); node.setMaxHeight(Double.MAX_VALUE); this.nodeShower = nodeShower; textEditor.setScene(scene);//from w ww. j a va 2s . c o m textEditor.changeHighlighter(new HighlighterSQL()); nodeShower.addNode(webView, msgConsoleTitle, false); CodeArea ca = textEditor.createCodeArea(); ca.setMaxHeight(Double.MAX_VALUE); ca.setMaxWidth(Double.MAX_VALUE); AnchorPane.setTopAnchor(ca, 0.0); AnchorPane.setBottomAnchor(ca, 0.0); AnchorPane.setLeftAnchor(ca, 0.0); AnchorPane.setRightAnchor(ca, 0.0); node.getChildren().add(ca); menuItemConsumer .accept(new SQLRunHandler(dbConfigProperty, this, handler -> nodeShower.focusNode(webView))); menuItemConsumer .accept(new SQLRunAllHandler(dbConfigProperty, this, handler -> nodeShower.focusNode(webView))); menuItemConsumer.accept(new OpenFileHandler(this)); menuItemConsumer.accept(new SaveFileHandler(this)); menuItemConsumer.accept(new SaveAsFileHandler(this)); menuItemConsumer.accept(new StopOnFirstErrorOptions(stopOnFirstError)); }
From source file:context.ui.control.workflow.WorkflowController.java
/** * * @param content/*from w w w .ja va 2s . c o m*/ */ protected void boundToPane(Parent content) { AnchorPane.setTopAnchor(content, 0.0); AnchorPane.setLeftAnchor(content, 0.0); AnchorPane.setBottomAnchor(content, 0.0); AnchorPane.setRightAnchor(content, 0.0); }
From source file:com.neuronrobotics.bowlerstudio.MainController.java
/** * Initializes the controller class./*from www . j av a 2 s. co m*/ * * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { ScriptingEngine.setLoginManager(new IGitHubLoginManager() { @Override public String[] prompt(String username) { if (!loginWindowOpen && controller != null) controller.reset(); loginWindowOpen = true; System.err.println("Calling login from BowlerStudio"); // new RuntimeException().printStackTrace(); FXMLLoader fxmlLoader = BowlerStudioResourceFactory.getGithubLogin(); Parent root = fxmlLoader.getRoot(); if (controller == null) { controller = fxmlLoader.getController(); Platform.runLater(() -> { controller.reset(); controller.getUsername().setText(username); Stage stage = new Stage(); stage.setTitle("GitHub Login"); stage.initModality(Modality.APPLICATION_MODAL); controller.setStage(stage, root); stage.centerOnScreen(); stage.show(); }); } // setContent(root); while (!controller.isDone()) { ThreadUtil.wait(100); } String[] creds = controller.getCreds(); loginWindowOpen = false; return creds; } }); jfx3dmanager = new BowlerStudio3dEngine(); setApplication(new BowlerStudioController(jfx3dmanager, this)); Platform.runLater(() -> { editorContainer.getChildren().add(getApplication()); AnchorPane.setTopAnchor(getApplication(), 0.0); AnchorPane.setRightAnchor(getApplication(), 0.0); AnchorPane.setLeftAnchor(getApplication(), 0.0); AnchorPane.setBottomAnchor(getApplication(), 0.0); subScene = jfx3dmanager.getSubScene(); subScene.setFocusTraversable(false); subScene.setOnMouseEntered(mouseEvent -> { // System.err.println("3d window requesting focus"); Scene topScene = BowlerStudio.getScene(); normalKeyPessHandle = topScene.getOnKeyPressed(); jfx3dmanager.handleKeyboard(topScene); }); subScene.setOnMouseExited(mouseEvent -> { // System.err.println("3d window dropping focus"); Scene topScene = BowlerStudio.getScene(); topScene.setOnKeyPressed(normalKeyPessHandle); }); subScene.widthProperty().bind(viewContainer.widthProperty()); subScene.heightProperty().bind(viewContainer.heightProperty()); }); Platform.runLater(() -> { jfx3dControls.getChildren().add(jfx3dmanager.getControlsBox()); viewContainer.getChildren().add(subScene); }); System.out.println("Welcome to BowlerStudio!"); new Thread() { public void run() { setName("Load Haar Thread"); try { HaarFactory.getStream(null); } catch (Exception ex) { } } }.start(); // getAddDefaultRightArm().setOnAction(event -> { // // application.onAddDefaultRightArm(event); // }); // getAddVRCamera().setOnAction(event -> { // if(AddVRCamera.isSelected()) // application.onAddVRCamera(event); // }); FxTimer.runLater(Duration.ofMillis(100), () -> { if (ScriptingEngine.getLoginID() != null) { setToLoggedIn(ScriptingEngine.getLoginID()); } else { setToLoggedOut(); } }); ScriptingEngine.addIGithubLoginListener(new IGithubLoginListener() { @Override public void onLogout(String oldUsername) { setToLoggedOut(); } @Override public void onLogin(String newUsername) { setToLoggedIn(newUsername); } }); cmdLine = new CommandLineWidget(); Platform.runLater(() -> { // logView.resize(250, 300); // after connection manager set up, add scripting widget logViewRef = new TextArea(); logViewRef.prefWidthProperty().bind(logView.widthProperty().divide(2)); logViewRef.prefHeightProperty().bind(logView.heightProperty().subtract(40)); VBox box = new VBox(); box.getChildren().add(logViewRef); box.getChildren().add(cmdLine); VBox.setVgrow(logViewRef, Priority.ALWAYS); box.prefWidthProperty().bind(logView.widthProperty().subtract(10)); logView.getChildren().addAll(box); }); }
From source file:acmi.l2.clientmod.xdat.Controller.java
private static AnchorPane wrap(Node node) { AnchorPane anchorPane = new AnchorPane(node); AnchorPane.setTopAnchor(node, 0.0);//from w w w.j a v a 2s . c om AnchorPane.setLeftAnchor(node, 0.0); AnchorPane.setRightAnchor(node, 0.0); AnchorPane.setBottomAnchor(node, 0.0); return anchorPane; }
From source file:com.vladsch.idea.multimarkdown.editor.MultiMarkdownFxPreviewEditor.java
/** * Build a new instance of {@link MultiMarkdownFxPreviewEditor}. * * @param project the {@link Project} containing the document * @param doc the {@link Document} previewed in this editor. *//* w w w .j a va2s . c o m*/ public MultiMarkdownFxPreviewEditor(@NotNull final Project project, @NotNull Document doc, boolean isRawHtml) { this.isRawHtml = isRawHtml; this.document = doc; this.project = project; this.isWikiDocument = isWikiDocument(document); containingFile = FileDocumentManager.getInstance().getFile(document); resolver = containingFile == null ? null : new GitHubLinkResolver(containingFile, project); // Listen to the document modifications. this.document.addDocumentListener(new DocumentAdapter() { @Override public void documentChanged(DocumentEvent e) { delayedHtmlPreviewUpdate(false); } }); // Listen to settings changes MultiMarkdownGlobalSettings.getInstance() .addListener(globalSettingsListener = new MultiMarkdownGlobalSettingsListener() { public void handleSettingsChanged(@NotNull final MultiMarkdownGlobalSettings newSettings) { if (project.isDisposed()) return; processor = null; updateEditorTabIsVisible(); updateLinkRenderer(); delayedHtmlPreviewUpdate(true); checkNotifyUser(); } }); MultiMarkdownProjectComponent projectComponent = MultiMarkdownPlugin.getProjectComponent(project); if (projectComponent != null) { projectComponent.addListener(projectFileListener = new ReferenceChangeListener() { @Override public void referenceChanged(@Nullable String name) { if (project.isDisposed()) return; delayedHtmlPreviewUpdate(false); } }); } project.getMessageBus().connect(this).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { } @Override public void exitDumbMode() { // need to re-evaluate class link accessibility if (project.isDisposed()) return; delayedHtmlPreviewUpdate(false); } }); updateLinkRenderer(); if (isRawHtml) { jEditorPane = null; jfxPanel = null; webView = null; webEngine = null; Language language = Language.findLanguageByID("HTML"); FileType fileType = language != null ? language.getAssociatedFileType() : null; Document myDocument = EditorFactory.getInstance().createDocument(""); myTextViewer = (EditorImpl) EditorFactory.getInstance().createViewer(myDocument, project); if (fileType != null) myTextViewer.setHighlighter( EditorHighlighterFactory.getInstance().createEditorHighlighter(project, fileType)); } else { // Setup the editor pane for rendering HTML. myTextViewer = null; jEditorPane = new JPanel(new BorderLayout(), false); jfxPanel = new JFXPanel(); // initializing javafx jEditorPane.add(jfxPanel, BorderLayout.CENTER); Platform.setImplicitExit(false); Platform.runLater(new Runnable() { @Override public void run() { if (project.isDisposed()) return; webView = new WebView(); webEngine = webView.getEngine(); anchorPane = new AnchorPane(); AnchorPane.setTopAnchor(webView, 0.0); AnchorPane.setLeftAnchor(webView, 0.0); AnchorPane.setBottomAnchor(webView, 0.0); AnchorPane.setRightAnchor(webView, 0.0); anchorPane.getChildren().add(webView); jfxPanel.setScene(new Scene(anchorPane)); webEngine.setCreatePopupHandler(new Callback<PopupFeatures, WebEngine>() { @Override public WebEngine call(PopupFeatures config) { // return a web engine for the new browser window or null to block popups return null; } }); addStateChangeListener(); } }); } checkNotifyUser(); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void showWinnerWithTwoHumanPlayers(Board.WinnerInfo winnerInfo) { guiAnimationQueue.submitWaitForUnlock(() -> addWinLineOnWin(winnerInfo, Color.YELLOW, () -> { twoHumansWinnerText.setText(winnerInfo.winningPlayer.getName() + " won :)"); double endX = twoHumansWinnerImage.getX(); double endY = twoHumansWinnerImage.getY(); AnchorPane.clearConstraints(twoHumansWinnerImage); twoHumansWinnerImage.setX(endX); twoHumansWinnerImage.setY(twoHumansWinnerImage.getY() + 300); // blurGamePane(); blurGamePane(10.0);//from w w w . j a v a2 s.com twoHumansWinMessage.setOpacity(0); twoHumansWinnerImage.setOpacity(0); twoHumansWinnerPane.setOpacity(1); twoHumansWinnerPane.setVisible(true); twoHumansWinnerImage.setVisible(true); Timeline timeline = new Timeline(); double S4 = 1.45; double x0 = 0.33; KeyValue twoHumansWinnerImageKeyValue1x = new KeyValue(twoHumansWinnerImage.xProperty(), endX, new CustomEaseOutInterpolator(S4, x0)); KeyValue twoHumansWinnerImageKeyValue1y = new KeyValue(twoHumansWinnerImage.yProperty(), endY, new CustomEaseOutInterpolator(S4, x0)); KeyValue twoHumansWinnerImageKeyValue1Opacity = new KeyValue(twoHumansWinnerImage.opacityProperty(), 1); KeyFrame twoHumansWinnerImageKeyFrame1 = new KeyFrame(Duration.millis(600), twoHumansWinnerImageKeyValue1x, twoHumansWinnerImageKeyValue1y, twoHumansWinnerImageKeyValue1Opacity); timeline.getKeyFrames().addAll(twoHumansWinnerImageKeyFrame1); timeline.setOnFinished((event) -> fadeNode(twoHumansWinMessage, 1, () -> { AnchorPane.setLeftAnchor(twoHumansWinnerImage, 0.0); AnchorPane.setBottomAnchor(twoHumansWinnerImage, 0.0); })); timeline.play(); })); }
From source file:nl.mvdr.umvc3replayanalyser.gui.ErrorMessagePopup.java
/** * Handles an exception that caused program startup to fail, by showing an error message to the user. * /*from w w w .j av a 2 s .c o m*/ * @param title * title for the dialog * @param errorMessage * error message * @param stage * stage in which to show the error message * @param exception * exception that caused the error */ public static void show(String title, String errorMessage, final Stage stage, Exception exception) { log.info("Showing error message dialog to indicate that startup failed."); // Create the error dialog programatically without relying on FXML, to minimize the chances of further failure. stage.setTitle(title); // Error message text. Text text = new Text(errorMessage); // Text area containing the stack trace. Not visible by default. String stackTrace; if (exception != null) { stackTrace = ExceptionUtils.getStackTrace(exception); } else { stackTrace = "No more details available."; } final TextArea stackTraceArea = new TextArea(stackTrace); stackTraceArea.setEditable(false); stackTraceArea.setVisible(false); // Details button for displaying the stack trace. Button detailsButton = new Button(); detailsButton.setText("Details"); detailsButton.setOnAction(new EventHandler<ActionEvent>() { /** {@inheritDoc} */ @Override public void handle(ActionEvent event) { log.info("User clicked Details."); stackTraceArea.setVisible(!stackTraceArea.isVisible()); } }); // OK button for closing the dialog. Button okButton = new Button(); okButton.setText("OK"); okButton.setOnAction(new EventHandler<ActionEvent>() { /** {@inheritDoc} */ @Override public void handle(ActionEvent event) { log.info("User clicked OK, closing the dialog."); stage.close(); } }); // Horizontal box containing the buttons, to make sure they are always centered. HBox buttonsBox = new HBox(5); buttonsBox.getChildren().add(detailsButton); buttonsBox.getChildren().add(okButton); buttonsBox.setAlignment(Pos.CENTER); // Layout constraints. AnchorPane.setTopAnchor(text, Double.valueOf(5)); AnchorPane.setLeftAnchor(text, Double.valueOf(5)); AnchorPane.setRightAnchor(text, Double.valueOf(5)); AnchorPane.setTopAnchor(stackTraceArea, Double.valueOf(31)); AnchorPane.setLeftAnchor(stackTraceArea, Double.valueOf(5)); AnchorPane.setRightAnchor(stackTraceArea, Double.valueOf(5)); AnchorPane.setBottomAnchor(stackTraceArea, Double.valueOf(36)); AnchorPane.setLeftAnchor(buttonsBox, Double.valueOf(5)); AnchorPane.setRightAnchor(buttonsBox, Double.valueOf(5)); AnchorPane.setBottomAnchor(buttonsBox, Double.valueOf(5)); AnchorPane root = new AnchorPane(); root.getChildren().addAll(text, stackTraceArea, buttonsBox); stage.setScene(new Scene(root)); // Use a standard program icon if possible. try { stage.getIcons().add(Icons.get().getRandomPortrait()); } catch (IllegalStateException e) { log.warn("Failed to load icon for error dialog; proceeding with default JavaFX icon.", e); } stage.show(); // Default size should also be the minimum size. stage.setMinWidth(stage.getWidth()); stage.setMinHeight(stage.getHeight()); log.info("Error dialog displayed."); }
From source file:org.apache.cayenne.modeler.layout.LayoutSupport.java
default void displayView(final AnchorPane anchorPane, final Node view) { // Remove anything already there. anchorPane.getChildren().removeAll(anchorPane.getChildren()); // Make the view fill the anchor pane. AnchorPane.setTopAnchor(view, 0.0);/*from w w w .j a v a 2 s . co m*/ AnchorPane.setLeftAnchor(view, 0.0); AnchorPane.setRightAnchor(view, 0.0); AnchorPane.setBottomAnchor(view, 0.0); // Add the view into the anchor pane. anchorPane.getChildren().add(view); }
From source file:org.jevis.jeconfig.JEConfig.java
/** * Build an new JEConfig Login and main frame/stage * * @param primaryStage// w ww . j a v a 2 s . co m */ //AITBilal - Login private void initGUI(Stage primaryStage) { Scene scene; LoginGlass login = new LoginGlass(primaryStage); AnchorPane jeconfigRoot = new AnchorPane(); AnchorPane.setTopAnchor(jeconfigRoot, 0.0); AnchorPane.setRightAnchor(jeconfigRoot, 0.0); AnchorPane.setLeftAnchor(jeconfigRoot, 0.0); AnchorPane.setBottomAnchor(jeconfigRoot, 0.0); // jeconfigRoot.setStyle("-fx-background-color: white;"); // jeconfigRoot.getChildren().setAll(new Label("sodfhsdhdsofhdshdsfdshfjf")); Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); // @AITBilal - Main frame elemente wird aufgerufen nachdem man sich eingeloggt hat. login.getLoginStatus().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { System.out.println("after request"); _mainDS = login.getDataSource(); ds = _mainDS; Platform.runLater(new Runnable() { @Override public void run() { FadeTransition ft = new FadeTransition(Duration.millis(1500), login); ft.setFromValue(1.0); ft.setToValue(0); ft.setCycleCount(1); ft.play(); } }); JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo()); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO); preLodedClasses = login.getAllClasses(); preLodedRootObjects = login.getRootObjects(); PluginManager pMan = new PluginManager(ds); //@AITBilal - Toolbar fr save, newB, delete, sep1, form GlobalToolBar toolbar = new GlobalToolBar(pMan); pMan.addPluginsByUserSetting(null); // StackPane root = new StackPane(); // root.setId("mainpane"); BorderPane border = new BorderPane(); VBox vbox = new VBox(); vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory()); border.setTop(vbox); //@AITBilal - Alle Plugins Inhalt fr JEConfig (Resources... | System | Attribute) border.setCenter(pMan.getView()); Statusbar statusBar = new Statusbar(ds); border.setBottom(statusBar); System.out.println("show welcome"); //Disable GUI is StatusBar note an disconnect border.disableProperty().bind(statusBar.connectedProperty.not()); Platform.runLater(new Runnable() { @Override public void run() { AnchorPane.setTopAnchor(border, 0.0); AnchorPane.setRightAnchor(border, 0.0); AnchorPane.setLeftAnchor(border, 0.0); AnchorPane.setBottomAnchor(border, 0.0); jeconfigRoot.getChildren().setAll(border); // try { // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/")); // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3")); // Task<Void> showWelcome = new Task<Void>() { // @Override // protected Void call() throws Exception { try { WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL()); } catch (URISyntaxException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } catch (MalformedURLException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } // return null; // } // }; // new Thread(showWelcome).start(); // WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL()); // } catch (URISyntaxException ex) { // Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); // } catch (MalformedURLException ex) { // Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); // } } }); } } }); AnchorPane.setTopAnchor(login, 0.0); AnchorPane.setRightAnchor(login, 0.0); AnchorPane.setLeftAnchor(login, 0.0); AnchorPane.setBottomAnchor(login, 0.0); //@AITBilal - Login Dialog scene = new Scene(jeconfigRoot, bounds.getWidth(), bounds.getHeight()); scene.getStylesheets().add("/styles/Styles.css"); primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png")); primaryStage.setTitle("JEConfig"); primaryStage.setScene(scene); maximize(primaryStage); primaryStage.show(); // Platform.runLater(new Runnable() { // @Override // public void run() { //@AITBilal - Inhalt bzw. die Elemente von LoginDialog jeconfigRoot.getChildren().setAll(login); // } // }); primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() { @Override public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov, EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) { try { System.out.println("Disconnect"); ds.disconnect(); } catch (JEVisException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } } }); }