Java Code Examples for javafx.scene.layout.BorderPane#setTop()
The following examples show how to use
javafx.scene.layout.BorderPane#setTop() .
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: ConsoleLogStage.java From xframium-java with GNU General Public License v3.0 | 6 votes |
public ConsoleLogStage (Screen screen) { setTitle ("Console Logs"); setOnCloseRequest (e -> closeWindow ()); btnHide.setOnAction (e -> closeWindow ()); BorderPane borderPane = new BorderPane (); borderPane.setTop (menuBar); borderPane.setCenter (tabPane); consoleTab.setClosable (false); menuBar.setUseSystemMenuBar (SYSTEM_MENUBAR); tabPane.getTabs ().addAll (consoleTab, consoleMessageTab); tabPane.setTabMinWidth (80); Scene scene = new Scene (borderPane, 800, 500); // width/height setScene (scene); windowSaver = new WindowSaver (prefs, this, "DatasetStage"); windowSaver.restoreWindow (); tabPane.getSelectionModel ().select (consoleTab); }
Example 2
Source File: SpectralMatchPanelFX.java From mzmine3 with GNU General Public License v2.0 | 6 votes |
private BorderPane extractMetaData(String title, SpectralDBEntry entry, DBEntryField[] other) { VBox panelOther = new VBox(); panelOther.getStyleClass().add("region"); panelOther.setAlignment(Pos.TOP_LEFT); for (DBEntryField db : other) { Object o = entry.getField(db).orElse("N/A"); if (!o.equals("N/A")) { Label text = new Label(); text.getStyleClass().add("text-label"); text.setText(db.toString() + ": " + o.toString()); panelOther.getChildren().add(text); } } Label otherInfo = new Label(title); otherInfo.getStyleClass().add("bold-title-label"); BorderPane pn = new BorderPane(); pn.getStyleClass().add("region"); pn.setTop(otherInfo); pn.setCenter(panelOther); return pn; }
Example 3
Source File: Exercise_17_13.java From Intro-to-Java-Programming with MIT License | 5 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a label Label lblText = new Label( "If the base file is named temp.txt wth three pieces,\n" + "temp.txt.1, temp.txt.2, and temp.txt.3 are combined into temp.txt."); // Create a grid pane, place labels and text fields // into it and set its padding an horizontal gaps GridPane paneForFields = new GridPane(); paneForFields.setHgap(5); paneForFields.add(new Label("Enter a file"), 0, 0); paneForFields.add(tfFileName, 1, 0); paneForFields.add(new Label("Specify the number of smaller files"), 0, 1); paneForFields.add(tfNumberOfFiles, 1, 1); paneForFields.setPadding(new Insets(5, 20, 5, 0)); // Create a button Button btStart = new Button("Start"); // Create a border pane and place node into it BorderPane pane = new BorderPane(); pane.setTop(lblText); pane.setCenter(paneForFields); pane.setBottom(btStart); pane.setAlignment(btStart, Pos.CENTER); // Create and register handler btStart.setOnAction(e -> start()); // Create a scene and place it in the stage Scene scene = new Scene(pane); primaryStage.setTitle("Exercise_17_13"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example 4
Source File: Main.java From ShootOFF with GNU General Public License v3.0 | 5 votes |
public ProgressDialog(String dialogTitle, String dialogMessage, final Task<?> task) { stage.setTitle(dialogTitle); stage.initModality(Modality.APPLICATION_MODAL); pb.setProgress(-1F); pin.setProgress(-1F); messageLabel.setText(dialogMessage); final HBox hb = new HBox(); hb.setSpacing(5); hb.setAlignment(Pos.CENTER); hb.getChildren().addAll(pb, pin); pb.prefWidthProperty().bind(hb.widthProperty().subtract(hb.getSpacing() * 6)); final BorderPane bp = new BorderPane(); bp.setTop(messageLabel); bp.setBottom(hb); final Scene scene = new Scene(bp); stage.setScene(scene); stage.show(); pb.progressProperty().bind(task.progressProperty()); pin.progressProperty().bind(task.progressProperty()); }
Example 5
Source File: MainWindow.java From Recaf with MIT License | 5 votes |
private void setup() { stage.getIcons().add(new Image(resource("icons/logo.png"))); stage.setTitle("Recaf"); menubar = new MainMenu(controller); root = new BorderPane(); root.setTop(menubar); navRoot = new BorderPane(); viewRoot = new BorderPane(); tabs = new ViewportTabs(controller); SplitPane split = new SplitPane(); split.setOrientation(Orientation.HORIZONTAL); split.getItems().addAll(navRoot, viewRoot); split.setDividerPositions(0.333); SplitPane.setResizableWithParent(navRoot, Boolean.FALSE); root.setCenter(split); viewRoot.setCenter(tabs); // Navigation updateWorkspaceNavigator(); Recaf.getWorkspaceSetListeners().add(w -> updateWorkspaceNavigator()); // Create scene & display the window Scene scene = new Scene(root, 800, 600); controller.windows().reapplyStyle(scene); controller.config().keys().registerMainWindowKeys(controller, stage, scene); stage.setScene(scene); // Show update prompt if (SelfUpdater.hasUpdate()) UpdateWindow.create(this).show(root); }
Example 6
Source File: DockingDemo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void start(final Stage stage) { // Add dock items to the original stage final DockItem tab1 = new DockItem("Tab 1"); final BorderPane layout = new BorderPane(); layout.setTop(new Label("Top")); layout.setCenter(new Label("Tab that indicates resize behavior")); layout.setBottom(new Label("Bottom")); tab1.setContent(layout); final DockItem tab2 = new DockItem("Tab 2"); tab2.setContent(new Rectangle(500, 500, Color.RED)); // The DockPane is added to a stage by 'configuring' it. // Initial tabs can be provided right away DockPane tabs = DockStage.configureStage(stage, tab1, tab2); stage.setX(100); // .. or tabs are added later final DockItem tab3 = new DockItem("Tab 3"); tab3.setContent(new Rectangle(500, 500, Color.GRAY)); tabs.addTab(tab3); // Create another stage with more dock items final DockItem tab4 = new DockItem("Tab 4"); tab4.setContent(new Rectangle(500, 500, Color.YELLOW)); final DockItem tab5 = new DockItem("Tab 5"); tab5.setContent(new Rectangle(500, 500, Color.BISQUE)); final Stage other = new Stage(); DockStage.configureStage(other, tab4, tab5); other.setX(600); stage.show(); other.show(); }
Example 7
Source File: MainWindow.java From milkman with MIT License | 5 votes |
public MainWindowFxml(MainWindow controller) { controller.root = this; this.setId("root"); BorderPane borderpane = new BorderPane(); borderpane.setTop(new ToolbarComponentFxml(controller.toolbarComponent)); this.getChildren().add(borderpane); SplitPane splitPane = new SplitPane(); splitPane.setDividerPositions(0.2); splitPane.getItems().add(new RequestCollectionComponentFxml(controller.requestCollectionComponent)); splitPane.getItems().add(new WorkingAreaComponentFxml(controller.workingArea)); borderpane.setCenter(splitPane); }
Example 8
Source File: DemoDragTabs.java From jfxutils with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) { Tab f = makeTab("Files", "File system view here"); Tab t = makeTab("Type Hierarchy","Type hierarchy view here"); Tab d = makeTab("Debug","Debug view here"); Tab p = makeTab("Properties","Ah, the ubiquitous 'properties' panel"); Tab c = makeTab("Console","Console output here"); Tab o = makeTab("Outline","Outline of fields/methods view here"); TabPane left = new TabPane(f,t,d); TabUtil.makeDroppable(left); //////////////// see TabPane right = new TabPane(p,c,o); TabUtil.makeDroppable(right); /////////////// see left.setStyle("-fx-border-color: black;"); right.setStyle("-fx-border-color: black;"); BorderPane main = new BorderPane(); main.setPadding(new Insets(0, 20, 0, 20)); main.setTop(new Label("Menubar and toolbars")); main.setLeft(left); main.setCenter(new Label("Central work area here")); main.setRight(right); main.setBottom(new Label("Statusbar")); primaryStage.setScene(new Scene(main, 800, 600)); primaryStage.show(); }
Example 9
Source File: SimpleWebServer.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("Simple Web Server"); BorderPane root = new BorderPane(); TextArea area = new TextArea(); root.setCenter(area); ToolBar bar = new ToolBar(); Button openInBrowser = FXUIUtils.createButton("open-in-browser", "Open in External Browser", true); openInBrowser.setOnAction((event) -> { try { Desktop.getDesktop().browse(URI.create(webRoot)); } catch (IOException e) { e.printStackTrace(); } }); Button changeRoot = FXUIUtils.createButton("fldr_closed", "Change Web Root", true); changeRoot.setOnAction((event) -> { DirectoryChooser chooser = new DirectoryChooser(); File showDialog = chooser.showDialog(primaryStage); if (showDialog != null) server.setRoot(showDialog); }); bar.getItems().add(openInBrowser); bar.getItems().add(changeRoot); root.setTop(bar); System.setOut(new PrintStream(new Console(area))); System.setErr(new PrintStream(new Console(area))); area.setEditable(false); primaryStage.setScene(new Scene(root)); primaryStage.setOnShown((e) -> startServer(getParameters().getRaw())); primaryStage.show(); }
Example 10
Source File: Exercise_16_23.java From Intro-to-Java-Programming with MIT License | 4 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { final int COLUMN_COUNT = 27; tfSpeed.setPrefColumnCount(COLUMN_COUNT); tfPrefix.setPrefColumnCount(COLUMN_COUNT); tfNumberOfImages.setPrefColumnCount(COLUMN_COUNT); tfURL.setPrefColumnCount(COLUMN_COUNT); // Create a button Button btStart = new Button("Start Animation"); // Create a grid pane for labels and text fields GridPane paneForInfo = new GridPane(); paneForInfo.setAlignment(Pos.CENTER); paneForInfo.add(new Label("Enter information for animation"), 0, 0); paneForInfo.add(new Label("Animation speed in milliseconds"), 0, 1); paneForInfo.add(tfSpeed, 1, 1); paneForInfo.add(new Label("Image file prefix"), 0, 2); paneForInfo.add(tfPrefix, 1, 2); paneForInfo.add(new Label("Number of images"), 0, 3); paneForInfo.add(tfNumberOfImages, 1, 3); paneForInfo.add(new Label("Audio file URL"), 0, 4); paneForInfo.add(tfURL, 1, 4); // Create a border pane BorderPane pane = new BorderPane(); pane.setBottom(paneForInfo); pane.setCenter(paneForImage); pane.setTop(btStart); pane.setAlignment(btStart, Pos.TOP_RIGHT); // Create animation animation = new Timeline( new KeyFrame(Duration.millis(1000), e -> nextImage())); animation.setCycleCount(Timeline.INDEFINITE); // Create and register the handler btStart.setOnAction(e -> { if (tfURL.getText().length() > 0) { MediaPlayer mediaPlayer = new MediaPlayer( new Media(tfURL.getText())); mediaPlayer.play(); } if (tfSpeed.getText().length() > 0) animation.setRate(Integer.parseInt(tfSpeed.getText())); animation.play(); }); // Create a scene and place it in the stage Scene scene = new Scene(pane, 550, 680); primaryStage.setTitle("Exercise_16_23"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example 11
Source File: Exercise_16_14.java From Intro-to-Java-Programming with MIT License | 4 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create and add a list of font families to cboFontName List<String> families = Font.getFamilies(); ObservableList<String> fonts = FXCollections.observableArrayList(families); cboFontName.getItems().addAll(fonts); // Create and add a list of font sizes to cboFontSize ArrayList<String> list = new ArrayList<>(); for (int i = 1; i <= 100; i++) { list.add(String.valueOf(i)); } ObservableList<String> sizes = FXCollections.observableArrayList(list); cboFontSize.getItems().addAll(sizes); // Create a hbox for two combo boxes and their labels HBox paneForComboBoxes = new HBox(5); paneForComboBoxes.setAlignment(Pos.CENTER); paneForComboBoxes.getChildren().addAll( new Label("Font Name"), cboFontName, new Label("Font Size"), cboFontSize); // Create a text text.setFont(Font.font(50)); StackPane paneForText = new StackPane(text); paneForText.setPadding(new Insets(20, 5, 20, 5)); // Create a hbox for check boxes and their labels HBox paneForCheckBoxes = new HBox(5); paneForCheckBoxes.setAlignment(Pos.CENTER); paneForCheckBoxes.getChildren().addAll(chkBold, chkItalic); // Set default selections cboFontName.setValue("Times New Roman"); cboFontSize.setValue("30"); text.setFont(Font.font(getName(), getWegiht(), getPosture(), getSize())); // Create and register handlers chkBold.setOnAction(e -> setDisplay()); chkItalic.setOnAction(e -> setDisplay()); cboFontName.setOnAction(e -> setDisplay()); cboFontSize.setOnAction(e -> setDisplay()); // Create a border pane BorderPane pane = new BorderPane(); pane.setTop(paneForComboBoxes); pane.setCenter(paneForText); pane.setBottom(paneForCheckBoxes); // Create a scene and place it in the stage Scene scene = new Scene(pane, 1000, 500); primaryStage.setTitle("Exercise_16_14"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example 12
Source File: RollingBufferSample.java From chart-fx with Apache License 2.0 | 4 votes |
public BorderPane initComponents(Scene scene) { final BorderPane root = new BorderPane(); generateBeamIntensityData(); generateDipoleCurrentData(); initErrorDataSetRenderer(beamIntensityRenderer); initErrorDataSetRenderer(dipoleCurrentRenderer); final DefaultNumericAxis xAxis1 = new DefaultNumericAxis("time"); xAxis1.setAutoRangeRounding(false); xAxis1.setTickLabelRotation(45); xAxis1.setMinorTickCount(30); xAxis1.invertAxis(false); xAxis1.setTimeAxis(true); yAxis2.setSide(Side.RIGHT); yAxis2.setAnimated(false); // N.B. it's important to set secondary axis on the 2nd renderer before // adding the renderer to the chart dipoleCurrentRenderer.getAxes().add(yAxis2); final XYChart chart = new XYChart(xAxis1, yAxis1); chart.legendVisibleProperty().set(true); chart.setAnimated(false); chart.getRenderers().set(0, beamIntensityRenderer); chart.getRenderers().add(dipoleCurrentRenderer); chart.getPlugins().add(new EditAxis()); beamIntensityRenderer.getDatasets().add(rollingBufferBeamIntensity); dipoleCurrentRenderer.getDatasets().add(rollingBufferDipoleCurrent); // set localised time offset if (xAxis1.isTimeAxis() && xAxis1.getAxisLabelFormatter() instanceof DefaultTimeFormatter) { final DefaultTimeFormatter axisFormatter = (DefaultTimeFormatter) xAxis1.getAxisLabelFormatter(); axisFormatter.setTimeZoneOffset(ZoneOffset.UTC); axisFormatter.setTimeZoneOffset(ZoneOffset.ofHoursMinutes(5, 0)); } yAxis1.setForceZeroInRange(true); yAxis2.setForceZeroInRange(true); yAxis1.setAutoRangeRounding(true); yAxis2.setAutoRangeRounding(true); // init menu bar root.setTop(getHeaderBar(scene)); long startTime = ProcessingProfiler.getTimeStamp(); ProcessingProfiler.getTimeDiff(startTime, "adding data to chart"); startTime = ProcessingProfiler.getTimeStamp(); root.setCenter(chart); ProcessingProfiler.getTimeDiff(startTime, "adding chart into StackPane"); return root; }
Example 13
Source File: MultipleAxesSample.java From chart-fx with Apache License 2.0 | 4 votes |
@Override public void start(final Stage primaryStage) { if (Platform.isSupported(ConditionalFeature.TRANSPARENT_WINDOW)) { Application.setUserAgentStylesheet(Chart.class.getResource("solid-pick.css").toExternalForm()); } ProcessingProfiler.setVerboseOutputState(true); ProcessingProfiler.setLoggerOutputState(true); ProcessingProfiler.setDebugState(false); final BorderPane root = new BorderPane(); final Scene scene = new Scene(root, 800, 600); final DefaultNumericAxis xAxis1 = new DefaultNumericAxis("x axis"); xAxis1.setAnimated(false); final DefaultNumericAxis yAxis1 = new DefaultNumericAxis("y axis", "random"); yAxis1.setAnimated(false); final DefaultNumericAxis yAxis2 = new DefaultNumericAxis("y axis", "sine/cosine"); // yAxis2.setSide(Side.LEFT); // unusual but possible case yAxis2.setSide(Side.RIGHT); yAxis2.setAnimated(false); final DefaultNumericAxis yAxis3 = new DefaultNumericAxis("y axis", "gauss"); yAxis3.setSide(Side.RIGHT); yAxis3.invertAxis(true); yAxis3.setAnimated(false); final XYChart chart = new XYChart(xAxis1, yAxis1); // N.B. it's important to set secondary axis on the 2nd renderer before // adding the renderer to the chart final ErrorDataSetRenderer errorRenderer1 = new ErrorDataSetRenderer(); errorRenderer1.getAxes().add(yAxis1); final ErrorDataSetRenderer errorRenderer2 = new ErrorDataSetRenderer(); errorRenderer2.getAxes().add(yAxis2); final ErrorDataSetRenderer errorRenderer3 = new ErrorDataSetRenderer(); errorRenderer3.getAxes().add(yAxis3); chart.getRenderers().addAll(errorRenderer2, errorRenderer3); chart.getPlugins().add(new ParameterMeasurements()); final Zoomer zoom = new Zoomer(); // add axes that shall be excluded from the zoom action zoom.omitAxisZoomList().add(yAxis3); // alternatively (uncomment): // Zoomer.setOmitZoom(yAxis3, true); chart.getPlugins().add(zoom); chart.getToolBar().getChildren().add(new MyZoomCheckBox(zoom, yAxis3)); chart.getPlugins().add(new EditAxis()); final Button newDataSet = new Button("new DataSet"); newDataSet.setOnAction( evt -> Platform.runLater(getTask(errorRenderer1, errorRenderer2, errorRenderer3))); final Button startTimer = new Button("timer"); startTimer.setOnAction(evt -> { if (scheduledFuture == null || scheduledFuture.isCancelled()) { scheduledFuture = timer.scheduleAtFixedRate( getTask(chart.getRenderers().get(0), errorRenderer2, errorRenderer3), MultipleAxesSample.UPDATE_DELAY, MultipleAxesSample.UPDATE_PERIOD, TimeUnit.MILLISECONDS); } else { scheduledFuture.cancel(false); } }); root.setTop(new HBox(newDataSet, startTimer)); // generate the first set of data getTask(chart.getRenderers().get(0), errorRenderer2, errorRenderer3).run(); long startTime = ProcessingProfiler.getTimeStamp(); ProcessingProfiler.getTimeDiff(startTime, "adding data to chart"); startTime = ProcessingProfiler.getTimeStamp(); root.setCenter(chart); ProcessingProfiler.getTimeDiff(startTime, "adding chart into StackPane"); startTime = ProcessingProfiler.getTimeStamp(); primaryStage.setTitle(this.getClass().getSimpleName()); primaryStage.setScene(scene); primaryStage.setOnCloseRequest(evt -> Platform.exit()); primaryStage.show(); ProcessingProfiler.getTimeDiff(startTime, "for showing"); }
Example 14
Source File: ErrorDataSetRendererSample.java From chart-fx with Apache License 2.0 | 4 votes |
@Override public void start(final Stage primaryStage) { // for extra timing diagnostics ProcessingProfiler.setVerboseOutputState(true); ProcessingProfiler.setLoggerOutputState(true); ProcessingProfiler.setDebugState(false); final BorderPane root = new BorderPane(); final Scene scene = new Scene(root, 800, 600); final XYChart chart = new XYChart(new DefaultNumericAxis(), new DefaultNumericAxis()); chart.legendVisibleProperty().set(true); chart.getXAxis().setName("time"); chart.getXAxis().setUnit("s"); chart.getXAxis().setAutoUnitScaling(true); chart.getYAxis().setName("y-axis"); chart.getYAxis().setAutoUnitScaling(true); chart.legendVisibleProperty().set(true); chart.getPlugins().add(new ParameterMeasurements()); chart.getPlugins().add(new Screenshot()); chart.getPlugins().add(new EditAxis()); final Zoomer zoomer = new Zoomer(); zoomer.setUpdateTickUnit(true); // zoomer.setSliderVisible(false); // zoomer.setAddButtonsToToolBar(false); chart.getPlugins().add(zoomer); // chart.getPlugins().add(new DataPointTooltip()); chart.getPlugins().add(new TableViewer()); // set them false to make the plot faster chart.setAnimated(false); final ErrorDataSetRenderer errorRenderer = new ErrorDataSetRenderer(); chart.getRenderers().setAll(errorRenderer); errorRenderer.setErrorType(ErrorStyle.ERRORBARS); errorRenderer.setErrorType(ErrorStyle.ERRORCOMBO); // errorRenderer.setErrorType(ErrorStyle.ESTYLE_NONE); errorRenderer.setDrawMarker(true); errorRenderer.setMarkerSize(1.0); // errorRenderer.setPointReduction(false); // errorRenderer.setAllowNaNs(true); // example how to set the specifc color of the dataset // dataSetNoError.setStyle("strokeColor=cyan; fillColor=darkgreen"); // init menu bar root.setTop(getHeaderBar()); generateData(dataSet, dataSetNoError); long startTime = ProcessingProfiler.getTimeStamp(); chart.getRenderers().get(0).getDatasets().add(dataSet); chart.getRenderers().get(0).getDatasets().add(dataSetNoError); ProcessingProfiler.getTimeDiff(startTime, "adding data to chart"); startTime = ProcessingProfiler.getTimeStamp(); root.setCenter(chart); ProcessingProfiler.getTimeDiff(startTime, "adding chart into StackPane"); startTime = ProcessingProfiler.getTimeStamp(); primaryStage.setTitle(this.getClass().getSimpleName()); primaryStage.setScene(scene); primaryStage.setOnCloseRequest(evt -> Platform.exit()); primaryStage.show(); ProcessingProfiler.getTimeDiff(startTime, "for showing"); }
Example 15
Source File: BlastProgram.java From megan-ce with GNU General Public License v3.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { final TextField queryField = new TextField(); queryField.setFont(Font.font("Courier New")); queryField.setPromptText("Query"); queryField.setPrefColumnCount(80); final ChoiceBox<String> programChoice = new ChoiceBox<>(); programChoice.setMinWidth(100); final ChoiceBox<String> databaseChoice = new ChoiceBox<>(); databaseChoice.setMinWidth(100); programChoice.setOnAction(e -> { databaseChoice.getItems().setAll(RemoteBlastClient.getDatabaseNames( RemoteBlastClient.BlastProgram.valueOf(programChoice.getValue()))); databaseChoice.getSelectionModel().select(databaseChoice.getItems().get(0)); }); for (RemoteBlastClient.BlastProgram program : RemoteBlastClient.BlastProgram.values()) { programChoice.getItems().add(program.toString()); } programChoice.getSelectionModel().select(RemoteBlastClient.BlastProgram.blastx.toString()); final HBox topPane = new HBox(); topPane.setSpacing(5); topPane.getChildren().addAll(new VBox(new Label("Query:"), queryField), new VBox(new Label("Program:"), programChoice), new VBox(new Label("Database:"), databaseChoice)); final TextArea alignmentArea = new TextArea(); alignmentArea.setFont(Font.font("Courier New")); alignmentArea.setPromptText("Enter a query and then press Apply to compute alignments"); alignmentArea.setEditable(false); final ProgressBar progressBar = new ProgressBar(); progressBar.setVisible(false); final Button loadExampleButton = new Button("Load Example"); loadExampleButton.setOnAction(e -> queryField.setText("TAATTAGCCATAAAGAAAAACTGGCGCTGGAGAAAGATATTCTCTGGAGCGTCGGGCGAGCGATAATTCAGCTGATTATTGTCGGCTATGTGCTGAAGTAT")); loadExampleButton.disableProperty().bind(queryField.textProperty().isNotEmpty()); final Button cancelButton = new Button("Cancel"); final Button applyButton = new Button("Apply"); final ButtonBar bottomBar = new ButtonBar(); bottomBar.getButtons().addAll(progressBar, loadExampleButton, new Label(" "), cancelButton, applyButton); final BorderPane root = new BorderPane(); root.setTop(topPane); root.setCenter(alignmentArea); root.setBottom(bottomBar); root.setPadding(new Insets(5, 5, 5, 5)); final BlastService blastService = new BlastService(); blastService.messageProperty().addListener((observable, oldValue, newValue) -> alignmentArea.setText(alignmentArea.getText() + newValue + "\n")); blastService.setOnScheduled(e -> { progressBar.setVisible(true); progressBar.progressProperty().bind(blastService.progressProperty()); alignmentArea.clear(); }); blastService.setOnSucceeded(e -> { if (blastService.getValue().length() > 0) alignmentArea.setText(blastService.getValue()); else alignmentArea.setText(alignmentArea.getText() + "*** No hits found ***\n"); progressBar.progressProperty().unbind(); progressBar.setVisible(false); }); blastService.setOnCancelled(e -> { progressBar.progressProperty().unbind(); alignmentArea.setText(alignmentArea.getText() + "*** Canceled ***\n"); progressBar.setVisible(false); }); blastService.setOnFailed(e -> { progressBar.progressProperty().unbind(); alignmentArea.setText(alignmentArea.getText() + "*** Failed ***\n"); progressBar.setVisible(false); }); queryField.disableProperty().bind(blastService.runningProperty()); cancelButton.setOnAction(e -> blastService.cancel()); cancelButton.disableProperty().bind(blastService.runningProperty().not()); applyButton.setOnAction(e -> { blastService.setProgram(RemoteBlastClient.BlastProgram.valueOf(programChoice.getValue())); blastService.setDatabase(databaseChoice.getValue()); blastService.setQuery("read", queryField.getText()); blastService.restart(); }); applyButton.disableProperty().bind(queryField.textProperty().isEmpty().or(blastService.runningProperty())); Scene scene = new Scene(root, 800, 600); primaryStage.setScene(scene); primaryStage.setTitle("NCBI Blast Client"); primaryStage.show(); }
Example 16
Source File: SpectraIdentificationResultsWindowFX.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public SpectraIdentificationResultsWindowFX() { super(); pnMain = new BorderPane(); this.setScene(new Scene(pnMain)); getScene().getStylesheets() .addAll(MZmineCore.getDesktop().getMainWindow().getScene().getStylesheets()); pnMain.setPrefSize(1000, 600); pnMain.setMinSize(700, 500); setMinWidth(700); setMinHeight(500); setTitle("Processing..."); pnGrid = new GridPane(); // any number of rows noMatchesFound = new Label("I'm working on it"); noMatchesFound.setFont(headerFont); // yellow noMatchesFound.setTextFill(Color.web("0xFFCC00")); pnGrid.add(noMatchesFound, 0, 0); pnGrid.setVgap(5); // Add the Windows menu MenuBar menuBar = new MenuBar(); // menuBar.add(new WindowsMenu()); Menu menu = new Menu("Menu"); // set font size of chart MenuItem btnSetup = new MenuItem("Setup dialog"); btnSetup.setOnAction(e -> { Platform.runLater(() -> { if (MZmineCore.getConfiguration() .getModuleParameters(SpectraIdentificationResultsModule.class) .showSetupDialog(true) == ExitCode.OK) { showExportButtonsChanged(); } }); }); menu.getItems().add(btnSetup); CheckMenuItem cbCoupleZoomY = new CheckMenuItem("Couple y-zoom"); cbCoupleZoomY.setSelected(true); cbCoupleZoomY.setOnAction(e -> setCoupleZoomY(cbCoupleZoomY.isSelected())); menu.getItems().add(cbCoupleZoomY); menuBar.getMenus().add(menu); pnMain.setTop(menuBar); scrollPane = new ScrollPane(pnGrid); pnMain.setCenter(scrollPane); scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); totalMatches = new ArrayList<>(); matchPanels = new HashMap<>(); setCoupleZoomY(true); show(); }
Example 17
Source File: MainWindow.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 4 votes |
MainWindow() { fileEditorTabPane = new FileEditorTabPane(this); fileEditorManager = new FileEditorManager(fileEditorTabPane); projectPane = new ProjectPane(fileEditorManager); Preferences state = MarkdownWriterFXApp.getState(); double dividerPosition = state.getDouble("projectPaneDividerPosition", 0.2); SplitPane splitPane = new SplitPane(projectPane.getNode(), fileEditorTabPane.getNode()) { private int layoutCount; @Override protected void layoutChildren() { super.layoutChildren(); if (layoutCount < 2) { layoutCount++; setDividerPosition(0, dividerPosition); super.layoutChildren(); } } }; SplitPane.setResizableWithParent(projectPane.getNode(), false); splitPane.setDividerPosition(0, dividerPosition); splitPane.getDividers().get(0).positionProperty().addListener((ob, o, n) -> { Utils.putPrefsDouble(state, "projectPaneDividerPosition", n.doubleValue(), 0.2); }); BorderPane borderPane = new BorderPane(); borderPane.getStyleClass().add("main"); borderPane.setPrefSize(800, 800); borderPane.setTop(createMenuBarAndToolBar()); borderPane.setCenter(splitPane); scene = new Scene(borderPane); scene.getStylesheets().add("org/markdownwriterfx/MarkdownWriter.css"); scene.windowProperty().addListener((observable, oldWindow, newWindow) -> { newWindow.setOnCloseRequest(e -> { if (!fileEditorTabPane.canCloseAllEditos()) e.consume(); }); // workaround for a bug in JavaFX: unselect menubar if window looses focus newWindow.focusedProperty().addListener((obs, oldFocused, newFocused) -> { if (!newFocused) { // send an ESC key event to the menubar menuBar.fireEvent(new KeyEvent(KeyEvent.KEY_PRESSED, KeyEvent.CHAR_UNDEFINED, "", KeyCode.ESCAPE, false, false, false, false)); } }); }); Utils.fixSpaceAfterDeadKey(scene); // workaround for a bad JavaFX behavior: menu bar always grabs focus when ALT key is pressed, // but should grab it when ALT key is releases (as all other UI toolkits do) to give other // controls the chance to use Alt+Key shortcuts. scene.addEventHandler(KeyEvent.KEY_PRESSED, e -> { if (e.isAltDown()) e.consume(); }); // open markdown files dropped to main window scene.setOnDragOver(e -> { if (e.getDragboard().hasFiles()) e.acceptTransferModes(TransferMode.COPY); e.consume(); }); scene.setOnDragDropped(e -> { boolean success = false; if (e.getDragboard().hasFiles()) { fileEditorTabPane.openEditors(e.getDragboard().getFiles(), 0, -1); success = true; } e.setDropCompleted(success); e.consume(); }); Platform.runLater(() -> stageFocusedProperty.bind(scene.getWindow().focusedProperty())); }
Example 18
Source File: Exercise_20_05.java From Intro-to-Java-Programming with MIT License | 4 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { MultipleBallPane ballPane = new MultipleBallPane(); ballPane.setStyle("-fx-border-color: yellow"); // Create four buttons Button btSuspend = new Button("Suspend"); Button btResume = new Button("Resume"); Button btAdd = new Button("+"); Button btSubtract = new Button("-"); HBox hBox = new HBox(10); hBox.getChildren().addAll( btSuspend, btResume, btAdd, btSubtract); hBox.setAlignment(Pos.CENTER); // Add or remove a ball btAdd.setOnAction(e -> ballPane.add()); btSubtract.setOnAction(e -> ballPane.subtract()); ballPane.setOnMousePressed(e -> { for (Node node: ballPane.getChildren()) { Ball ball = (Ball)node; if (ball.contains(e.getX(), e.getY())) { ballPane.getChildren().remove(ball); } } }); // Pause and resume animation btSuspend.setOnAction(e -> ballPane.pause()); btResume.setOnAction(e -> ballPane.play()); // Use a scroll bar to control animation speed ScrollBar sbSpeed = new ScrollBar(); sbSpeed.setMax(20); sbSpeed.setValue(10); ballPane.rateProperty().bind(sbSpeed.valueProperty()); // Create a border pane BorderPane pane = new BorderPane(); pane.setCenter(ballPane); pane.setTop(sbSpeed); pane.setBottom(hBox); // Create a scene and place the in the stage Scene scene = new Scene(pane, 350, 200); primaryStage.setTitle("Exercise_20_05"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example 19
Source File: UICodePluginItem.java From tcMenu with Apache License 2.0 | 4 votes |
public UICodePluginItem(CodePluginManager mgr, CodePluginItem item, UICodeAction action, Consumer<CodePluginItem> evt) { super(); this.eventHandler = evt; this.mgr = mgr; this.item = item; titleLabel = new Label(item.getDescription()); titleLabel.setStyle("-fx-font-weight: bold; -fx-font-size: 110%;"); descriptionArea = new Label(item.getExtendedDescription()); descriptionArea.setWrapText(true); descriptionArea.setAlignment(Pos.TOP_LEFT); descriptionArea.setPrefWidth(1900); whichPlugin = new Label("Plugin loading"); whichPlugin.setStyle("-fx-font-size: 90%;"); whichPlugin.setPadding(new Insets(10, 5, 5, 5)); licenseLink = new Hyperlink("License unknown"); licenseLink.setDisable(true); licenseLink.setPadding(new Insets(10, 0, 5, 0)); licenseLink.setStyle("-fx-font-size: 90%;"); vendorLink = new Hyperlink("Vendor unknown"); vendorLink.setDisable(true); vendorLink.setPadding(new Insets(10, 0, 5, 0)); vendorLink.setStyle("-fx-font-size: 90%;"); docsLink = new Hyperlink("No Docs"); docsLink.setDisable(true); docsLink.setPadding(new Insets(10, 0, 5, 0)); docsLink.setStyle("-fx-font-size: 90%;"); infoContainer = new HBox(5); infoContainer.setAlignment(Pos.CENTER_LEFT); infoContainer.getChildren().add(whichPlugin); infoContainer.getChildren().add(docsLink); infoContainer.getChildren().add(licenseLink); infoContainer.getChildren().add(vendorLink); innerBorder = new BorderPane(); innerBorder.setPadding(new Insets(4)); innerBorder.setTop(titleLabel); innerBorder.setCenter(descriptionArea); innerBorder.setBottom(infoContainer); actionButton = new Button(action == UICodeAction.CHANGE ? "Change" : "Select"); actionButton.setStyle("-fx-font-size: 110%; -fx-font-weight: bold;"); actionButton.setMaxSize(2000, 2000); actionButton.setOnAction(event-> eventHandler.accept(item)); setRight(actionButton); setCenter(innerBorder); setItem(item); }
Example 20
Source File: UnitDescriptionStage.java From mars-sim with GNU General Public License v3.0 | 3 votes |
public BorderPane init(String unitName, String unitType, String unitDescription) { //this.setSize(350, 400); // undecorated 301, 348 ; decorated : 303, 373 mainPane = new BorderPane(); name = new Label(unitName); name.setPadding(new Insets(5,5,5,5)); name.setTextAlignment(TextAlignment.CENTER); name.setContentDisplay(ContentDisplay.TOP); box0 = new VBox(); box0.setAlignment(Pos.CENTER); box0.setPadding(new Insets(5,5,5,5)); box0.getChildren().addAll(name); mainPane.setTop(box0); String type = "TYPE :"; String description = "DESCRIPTION :"; box1 = new VBox(); ta = new TextArea(); ta.setEditable(false); ta.setWrapText(true); box1.getChildren().add(ta); ta.setText(System.lineSeparator() + type + System.lineSeparator() + unitType + System.lineSeparator() + System.lineSeparator()); ta.appendText(description + System.lineSeparator() + unitDescription + System.lineSeparator() + System.lineSeparator()); ta.setScrollTop(300); applyTheme(); mainPane.setCenter(ta); return mainPane; }