Java Code Examples for javafx.scene.layout.BorderPane#setMargin()
The following examples show how to use
javafx.scene.layout.BorderPane#setMargin() .
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: ClientDisplay.java From Open-Lowcode with Eclipse Public License 2.0 | 6 votes |
/** * @return a display with no page shown */ public Node getEmptyDisplay() { logger.severe("Setting empty display"); BorderPane mainpane = new BorderPane(); mainpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null))); connectionbar = new ConnectionBar(this, urltoconnectto, this.questionmarkicon); this.userinteractionwidgets.add(connectionbar); Pane connectionpanel = connectionbar.getPane(); mainpane.setTop(connectionpanel); BorderPane.setMargin(connectionpanel, new Insets(3, 5, 3, 5)); Pane statusbar = generateStatusBar(); mainpane.setBottom(statusbar); BorderPane.setMargin(statusbar, new Insets(3, 5, 3, 5)); ScrollPane contentholder = new ScrollPane(); contentholder.setStyle("-fx-background: rgb(255,255,255);"); contentholder.setBorder(Border.EMPTY); mainpane.setCenter(contentholder); this.contentholder = contentholder; return mainpane; }
Example 2
Source File: WikiPane.java From pattypan with MIT License | 6 votes |
public WikiPane(Stage stage, double value) { this.stage = stage; this.getStylesheets().add(css); this.getStyleClass().add("background"); topContainer.setAlignment(Pos.CENTER); topContainer.getChildren().add(new WikiProgressBar( value > 1.0 ? value - 1.0 : value, value > 1.0 ? progressBarLabels2 : progressBarLabels) ); centerContainer.setAlignment(Pos.TOP_CENTER); Region region = new Region(); HBox.setHgrow(region, Priority.ALWAYS); bottomContainer.getChildren().addAll(prevButton, region, nextButton); BorderPane.setMargin(bottomContainer, new Insets(10, 0, 0, 0)); this.setTop(topContainer); this.setCenter(centerContainer); this.setBottom(bottomContainer); }
Example 3
Source File: CalibratePatchesBase.java From testing-video with GNU General Public License v3.0 | 6 votes |
protected Parent overlay(Args args) { Color fill = getTextFill(args); TextFlow topLeft = text(fill, getTopLeftText(args), LEFT); TextFlow topCenter = text(fill, getTopCenterText(args), CENTER); TextFlow topRight = text(fill, getTopRightText(args), RIGHT); TextFlow bottomLeft = text(fill, getBottomLeftText(args), LEFT); TextFlow bottomCenter = text(fill, getBottomCenterText(args), CENTER); TextFlow bottomRight = text(fill, getBottomRightText(args), RIGHT); StackPane top = new StackPane(topLeft, topCenter, topRight); StackPane bottom = new StackPane(bottomLeft, bottomCenter, bottomRight); BorderPane.setMargin(top, new Insets(20)); BorderPane.setMargin(bottom, new Insets(20)); BorderPane layout = new BorderPane(); layout.setBackground(EMPTY); layout.setTop(top); layout.setBottom(bottom); return layout; }
Example 4
Source File: SamplesTableView.java From megan-ce with GNU General Public License v3.0 | 6 votes |
/** * initialize JavaFX * * @param jfxPanel */ private void initFxLater(JFXPanel jfxPanel) { if (!initialized) { if (Thread.getDefaultUncaughtExceptionHandler() != fxExceptionHandler) Thread.setDefaultUncaughtExceptionHandler(fxExceptionHandler); synchronized (lock) { if (!initialized) { try { final BorderPane rootNode = new BorderPane(); jfxPanel.setScene(new Scene(rootNode, 600, 600)); final Node main = createMainNode(); rootNode.setCenter(main); BorderPane.setMargin(main, new Insets(3, 3, 3, 3)); // String css = NotificationsInSwing.getControlStylesheetURL(); // if (css != null) // jfxPanel.getScene().getStylesheets().add(css); } finally { initialized = true; } } } } }
Example 5
Source File: TranslationChoiceDialog.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create the translation choice dialog. */ public TranslationChoiceDialog() { initModality(Modality.APPLICATION_MODAL); setTitle(LabelGrabber.INSTANCE.getLabel("translation.choice.title")); Utils.addIconsToStage(this); BorderPane root = new BorderPane(); content = new VBox(5); BorderPane.setMargin(content, new Insets(10)); root.setCenter(content); Label selectTranslationLabel = new Label(LabelGrabber.INSTANCE.getLabel("select.translation.label")); selectTranslationLabel.setWrapText(true); content.getChildren().add(selectTranslationLabel); Button okButton = new Button(LabelGrabber.INSTANCE.getLabel("close.button")); okButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { hide(); } }); okButton.setDefaultButton(true); StackPane.setMargin(okButton, new Insets(5)); StackPane buttonPane = new StackPane(); buttonPane.setAlignment(Pos.CENTER); buttonPane.getChildren().add(okButton); root.setBottom(buttonPane); Scene scene = new Scene(root); if (QueleaProperties.get().getUseDarkTheme()) { scene.getStylesheets().add("org/modena_dark.css"); } setScene(scene); }
Example 6
Source File: ScheduleThemeNode.java From Quelea with GNU General Public License v3.0 | 5 votes |
public ScheduleThemeNode(UpdateThemeCallback songCallback, UpdateThemeCallback bibleCallback, Stage popup, Button themeButton) { this.songCallback = songCallback; this.bibleCallback = bibleCallback; this.popup = popup; themeDialog = new EditThemeDialog(); themeDialog.initModality(Modality.APPLICATION_MODAL); contentPanel = new VBox(); BorderPane.setMargin(contentPanel, new Insets(10)); themeButton.layoutXProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) { MainWindow mainWindow = QueleaApp.get().getMainWindow(); double width = mainWindow.getWidth() - t1.doubleValue() - 100; if (width < 50) { width = 50; } if (width > 900) { width = 900; } contentPanel.setPrefWidth(width); contentPanel.setMaxWidth(width); } }); setMaxHeight(300); contentPanel.setSpacing(5); contentPanel.setPadding(new Insets(3)); refresh(); ScrollPane scroller = new ScrollPane(contentPanel); scroller.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); setCenter(scroller); }
Example 7
Source File: MultimediaPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create a new image panel. */ public MultimediaPanel() { this.controlPanel = new MultimediaControls(); controlPanel.setDisableControls(true); drawer = new MultimediaDrawer(controlPanel); imgView = new ImageView(new Image("file:icons/vid preview.png")); BorderPane.setMargin(controlPanel, new Insets(30)); setCenter(controlPanel); VBox centerBit = new VBox(5); centerBit.setAlignment(Pos.CENTER); previewText = new Text(); previewText.setFont(Font.font("Verdana", 20)); previewText.setFill(Color.WHITE); BorderPane.setMargin(centerBit, new Insets(10)); centerBit.getChildren().add(previewText); imgView.fitHeightProperty().bind(heightProperty().subtract(200)); imgView.fitWidthProperty().bind(widthProperty().subtract(20)); centerBit.getChildren().add(imgView); setBottom(centerBit); setMinWidth(50); setMinHeight(50); setStyle("-fx-background-color:grey;"); addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent t) -> { if (t.getCode().equals(KeyCode.PAGE_DOWN) || t.getCode().equals(KeyCode.DOWN)) { t.consume(); QueleaApp.get().getMainWindow().getMainPanel().getLivePanel().advance(); } else if (t.getCode().equals(KeyCode.PAGE_UP) || t.getCode().equals(KeyCode.UP)) { t.consume(); QueleaApp.get().getMainWindow().getMainPanel().getLivePanel().previous(); } }); DisplayCanvas dummyCanvas = new DisplayCanvas(false, false, false, this::updateCanvas, DisplayCanvas.Priority.LOW); registerDisplayCanvas(dummyCanvas); }
Example 8
Source File: TimerPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create a new image panel. */ public TimerPanel() { this.controlPanel = new TimerControls(); controlPanel.setDisableControls(true); drawer = new TimerDrawer(controlPanel); ImageView img = new ImageView(new Image("file:icons/vid preview.png")); BorderPane.setMargin(controlPanel, new Insets(30)); setCenter(controlPanel); VBox centerBit = new VBox(5); centerBit.setAlignment(Pos.CENTER); previewText = new Text(); previewText.setFont(Font.font("Verdana", 20)); previewText.setFill(Color.WHITE); BorderPane.setMargin(centerBit, new Insets(10)); centerBit.getChildren().add(previewText); img.fitHeightProperty().bind(heightProperty().subtract(200)); img.fitWidthProperty().bind(widthProperty().subtract(20)); centerBit.getChildren().add(img); setBottom(centerBit); setMinWidth(50); setMinHeight(50); setStyle("-fx-background-color:grey;"); addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent t) -> { if (t.getCode().equals(KeyCode.PAGE_DOWN) || t.getCode().equals(KeyCode.DOWN)) { t.consume(); QueleaApp.get().getMainWindow().getMainPanel().getLivePanel().advance(); } else if (t.getCode().equals(KeyCode.PAGE_UP) || t.getCode().equals(KeyCode.UP)) { t.consume(); QueleaApp.get().getMainWindow().getMainPanel().getLivePanel().previous(); } }); DisplayCanvas dummyCanvas = new DisplayCanvas(false, false, false, this::updateCanvas, DisplayCanvas.Priority.LOW); registerDisplayCanvas(dummyCanvas); }
Example 9
Source File: InputDialog.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create our input dialog. */ private InputDialog() { initModality(Modality.APPLICATION_MODAL); setResizable(false); BorderPane mainPane = new BorderPane(); messageLabel = new Label(); BorderPane.setMargin(messageLabel, new Insets(5)); mainPane.setTop(messageLabel); textField = new TextField(); BorderPane.setMargin(textField, new Insets(5)); mainPane.setCenter(textField); okButton = new Button(LabelGrabber.INSTANCE.getLabel("ok.button"), new ImageView(new Image("file:icons/tick.png"))); okButton.setDefaultButton(true); okButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { hide(); } }); BorderPane.setMargin(okButton, new Insets(5)); BorderPane.setAlignment(okButton, Pos.CENTER); mainPane.setBottom(okButton); Scene scene = new Scene(mainPane); if (QueleaProperties.get().getUseDarkTheme()) { scene.getStylesheets().add("org/modena_dark.css"); } setScene(scene); }
Example 10
Source File: App.java From java-ml-projects with Apache License 2.0 | 5 votes |
private Parent buildUI() { BorderPane root = new BorderPane(); Insets margin = new Insets(10); Node leftPane = buildLeftPane(); Node bottomPane = buildBottomPane(); Node centerPane = buildCenterPane(); root.setLeft(leftPane); root.setBottom(bottomPane); root.setCenter(centerPane); BorderPane.setMargin(bottomPane, margin); BorderPane.setMargin(centerPane, margin); return root; }
Example 11
Source File: TitleDetailDelayTable.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** @param initial_items Initial items. Original list will remain unchanged */ public TitleDetailDelayTable(final List<TitleDetailDelay> initial_items) { items.setAll(initial_items); createTable(); createButtons(); final VBox buttons = new VBox(5, add, edit, up, down, delete); setCenter(table); BorderPane.setMargin(buttons, new Insets(0, 5, 0, 5)); setRight(buttons); }
Example 12
Source File: TitleDetailTable.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** @param initial_items Initial items. Original list will remain unchanged */ public TitleDetailTable(final List<TitleDetail> initial_items) { items.setAll(initial_items); createTable(); createButtons(); final VBox buttons = new VBox(5, add, edit, up, down, delete); setCenter(table); BorderPane.setMargin(buttons, new Insets(0, 5, 0, 5)); setRight(buttons); }
Example 13
Source File: AboutDialog.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create a new about dialog. */ public AboutDialog() { initModality(Modality.APPLICATION_MODAL); setResizable(false); setTitle(LabelGrabber.INSTANCE.getLabel("help.about.title")); BorderPane newLayout = new BorderPane(); ImageView logo = new ImageView(new Image("file:icons/full logo.png")); BorderPane.setAlignment(logo, Pos.CENTER); newLayout.setTop(logo); VBox subLayout = new VBox(); Text headingText = new Text(LabelGrabber.INSTANCE.getLabel("help.about.version") + " " + QueleaProperties.VERSION.getVersionString()); headingText.setFont(Font.font("Arial", FontWeight.BOLD, FontPosture.REGULAR, 20)); headingText.getStyleClass().add("text"); subLayout.getChildren().add(headingText); subLayout.getChildren().add(new Text(" ")); Text text1 = new Text(LabelGrabber.INSTANCE.getLabel("help.about.line1")); text1.getStyleClass().add("text"); subLayout.getChildren().add(text1); Text text2 = new Text(LabelGrabber.INSTANCE.getLabel("help.about.line2")); text2.getStyleClass().add("text"); subLayout.getChildren().add(text2); subLayout.getChildren().add(new Text(" ")); subLayout.getChildren().add(new Label("Java: " + System.getProperty("java.version"))); HBox debugBox = new HBox(5); debugBox.getChildren().add(new Label(LabelGrabber.INSTANCE.getLabel("debug.location") + ":")); Text debugLogText = new Text(LoggerUtils.getHandlerFileLocation()); debugLogText.getStyleClass().add("text"); if(Desktop.isDesktopSupported()) { debugLogText.setCursor(Cursor.HAND); debugLogText.setFill(Color.BLUE); debugLogText.setStyle("-fx-underline: true;"); debugLogText.setOnMouseClicked(t -> { DesktopApi.open(new File(LoggerUtils.getHandlerFileLocation())); }); } debugBox.getChildren().add(debugLogText); subLayout.getChildren().add(debugBox); Button closeButton = new Button(LabelGrabber.INSTANCE.getLabel("help.about.close")); closeButton.setOnAction(t -> { hide(); }); newLayout.setCenter(subLayout); BorderPane.setMargin(subLayout, new Insets(10)); BorderPane.setAlignment(closeButton, Pos.CENTER); BorderPane.setMargin(closeButton, new Insets(10)); newLayout.setBottom(closeButton); Scene scene = new Scene(newLayout); if (QueleaProperties.get().getUseDarkTheme()) { scene.getStylesheets().add("org/modena_dark.css"); } setScene(scene); }
Example 14
Source File: JavaFXSplashScreen.java From standalone-app with Apache License 2.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { stage = primaryStage; primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.setTitle("Helios"); primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/res/icon.png"))); Image logo = new Image(getClass().getResourceAsStream("/res/helios.png")); progressLabel = new Label("Starting..."); VBox logoBox = new VBox(); logoBox.getChildren().add(new ImageView(logo)); logoBox.setAlignment(Pos.CENTER); VBox.setVgrow(logoBox, Priority.ALWAYS); VBox textBox = new VBox(); textBox.setAlignment(Pos.BOTTOM_CENTER); textBox.getChildren().add(progressLabel); VBox.setVgrow(textBox, Priority.NEVER); VBox mainVBox = new VBox(2); mainVBox.getChildren().add(logoBox); mainVBox.getChildren().add(textBox); BorderPane root = new BorderPane(mainVBox); BorderPane.setMargin(mainVBox, new Insets(10, 50, 10, 50)); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.show(); // Center stage Rectangle2D rect = Screen.getPrimary().getVisualBounds(); primaryStage.setX(rect.getWidth() / 2 - (primaryStage.getWidth() / 2)); primaryStage.setY(rect.getHeight() / 2 - (primaryStage.getHeight() / 2)); INSTANCE.set(this); FINISHED_STARTUP_FUTURE.complete(null); }
Example 15
Source File: PresentationPanel.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create a new presentation panel. * <p/> * @param containerPanel the panel to create. */ public PresentationPanel(final LivePreviewPanel containerPanel) { usePowerPoint = QueleaProperties.get().getUsePP(); if (usePowerPoint) { this.controlPanel = new PresentationControls(); drawer = new PresentationDrawer(controlPanel); BorderPane.setMargin(controlPanel, new Insets(30)); setBottom(controlPanel); setMinWidth(50); setMinHeight(50); } this.containerPanel = containerPanel; BorderPane mainPanel = new BorderPane(); presentationPreview = new PresentationPreview(); presentationPreview.addSlideChangedListener(new org.quelea.windows.presentation.SlideChangedListener() { @Override public void slideChanged(PresentationSlide newSlide) { if (live) { LivePanel lp = QueleaApp.get().getMainWindow().getMainPanel().getLivePanel(); if (lp.getDisplayable() instanceof PresentationDisplayable) { if (!PowerPointHandler.getCurrentSlide().equals(String.valueOf(presentationPreview.getSelectedIndex()))) { PowerPointHandler.gotoSlide(presentationPreview.getSelectedIndex()); } } if (newSlide != null && displayable != null) { if (displayable.getOOPresentation() == null) { currentSlide = newSlide; updateCanvas(); } else { OOPresentation pres = displayable.getOOPresentation(); pres.setSlideListener((final int newSlideIndex) -> { presentationPreview.select(newSlideIndex + 1); }); currentSlide = newSlide; startOOPres(); QueleaApp.get().getMainWindow().toFront(); pres.gotoSlide(presentationPreview.getSelectedIndex() - 1); } } if (QueleaProperties.get().getUsePP() && lp.getBlacked() && !PowerPointHandler.screenStatus().equals("3")) { lp.setBlacked(false); } } } }); presentationPreview.select(0); presentationPreview.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode().equals(KeyCode.PAGE_DOWN) || t.getCode().equals(KeyCode.DOWN) || t.getCode().equals(KeyCode.RIGHT)) { t.consume(); QueleaApp.get().getMainWindow().getMainPanel().getLivePanel().advance(); } else if (t.getCode().equals(KeyCode.PAGE_UP) || t.getCode().equals(KeyCode.UP) || t.getCode().equals(KeyCode.LEFT)) { t.consume(); QueleaApp.get().getMainWindow().getMainPanel().getLivePanel().previous(); } } }); mainPanel.setCenter(presentationPreview); setCenter(mainPanel); }
Example 16
Source File: SongEntryWindow.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create and initialise the new song window. */ public SongEntryWindow() { initModality(Modality.APPLICATION_MODAL); updateDBOnHide = true; Utils.addIconsToStage(this); confirmButton = new Button(LabelGrabber.INSTANCE.getLabel("add.song.button"), new ImageView(new Image("file:icons/tick.png"))); BorderPane mainPane = new BorderPane(); tabPane = new TabPane(); setupBasicSongPanel(); Tab basicTab = new Tab(LabelGrabber.INSTANCE.getLabel("basic.information.heading")); basicTab.setContent(basicSongPanel); basicTab.setClosable(false); tabPane.getTabs().add(basicTab); setupDetailedSongPanel(); Tab detailedTab = new Tab(LabelGrabber.INSTANCE.getLabel("detailed.info.heading")); detailedTab.setContent(detailedSongPanel); detailedTab.setClosable(false); tabPane.getTabs().add(detailedTab); setupTranslatePanel(); Tab translateTab = new Tab(LabelGrabber.INSTANCE.getLabel("translate.heading")); translateTab.setContent(translatePanel); translateTab.setClosable(false); tabPane.getTabs().add(translateTab); basicSongPanel.getLyricsField().getTextArea().textProperty().addListener((observable, oldValue, newValue) -> { if(!disableTextAreaListeners) { disableTextAreaListeners = true; translatePanel.getDefaultLyricsArea().getTextArea().replaceText(newValue); disableTextAreaListeners = false; } }); translatePanel.getDefaultLyricsArea().getTextArea().textProperty().addListener((observable, oldValue, newValue) -> { if(!disableTextAreaListeners) { disableTextAreaListeners = true; basicSongPanel.getLyricsField().getTextArea().replaceText(newValue); disableTextAreaListeners = false; } }); setupThemePanel(); Tab themeTab = new Tab(LabelGrabber.INSTANCE.getLabel("theme.heading")); themeTab.setContent(themePanel); themeTab.setClosable(false); tabPane.getTabs().add(themeTab); mainPane.setCenter(tabPane); confirmButton.setOnAction(t -> { cancel = false; saveSong(); }); cancelButton = new Button(LabelGrabber.INSTANCE.getLabel("cancel.button"), new ImageView(new Image("file:icons/cross.png"))); cancelButton.setOnAction(t -> { checkSave(); }); addToSchedCBox = new CheckBox(LabelGrabber.INSTANCE.getLabel("add.to.schedule.text")); HBox checkBoxPanel = new HBox(); HBox.setMargin(addToSchedCBox, new Insets(0, 0, 0, 10)); checkBoxPanel.getChildren().add(addToSchedCBox); VBox bottomPanel = new VBox(); bottomPanel.setSpacing(5); HBox buttonPanel = new HBox(); buttonPanel.setSpacing(10); buttonPanel.setAlignment(Pos.CENTER); buttonPanel.getChildren().add(confirmButton); buttonPanel.getChildren().add(cancelButton); bottomPanel.getChildren().add(checkBoxPanel); bottomPanel.getChildren().add(buttonPanel); BorderPane.setMargin(bottomPanel, new Insets(10, 0, 5, 0)); mainPane.setBottom(bottomPanel); setOnShowing(t -> { cancel = true; }); setOnCloseRequest(t -> { checkSave(); }); Scene scene = new Scene(mainPane); if (QueleaProperties.get().getUseDarkTheme()) { scene.getStylesheets().add("org/modena_dark.css"); } setScene(scene); }
Example 17
Source File: Dialog.java From Quelea with GNU General Public License v3.0 | 4 votes |
public Builder create() { stage = new Dialog(); stage.initOwner(QueleaApp.get().getMainWindow()); stage.initModality(Modality.APPLICATION_MODAL); stage.setIconified(false); stage.centerOnScreen(); stage.borderPanel = new BorderPane(); // icon stage.icon = new ImageView(); stage.borderPanel.setLeft(stage.icon); BorderPane.setMargin(stage.icon, new Insets(MARGIN)); // message stage.messageBox = new VBox(); stage.messageBox.setAlignment(Pos.CENTER_LEFT); stage.messageLabel = new Label(); stage.messageLabel.setWrapText(true); stage.messageLabel.setMinWidth(MESSAGE_MIN_WIDTH); stage.messageLabel.setMaxWidth(MESSAGE_MAX_WIDTH); stage.messageBox.getChildren().add(stage.messageLabel); stage.borderPanel.setCenter(stage.messageBox); BorderPane.setAlignment(stage.messageBox, Pos.CENTER); BorderPane.setMargin(stage.messageBox, new Insets(MARGIN, MARGIN, MARGIN, 2 * MARGIN)); // buttons stage.buttonsPanel = new HBox(); stage.buttonsPanel.setSpacing(MARGIN); stage.buttonsPanel.setAlignment(Pos.BOTTOM_CENTER); BorderPane.setMargin(stage.buttonsPanel, new Insets(0, 0, 1.5 * MARGIN, 0)); stage.borderPanel.setBottom(stage.buttonsPanel); stage.borderPanel.widthProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) { stage.buttonsPanel.layout(); } }); stage.scene = new Scene(stage.borderPanel); if (QueleaProperties.get().getUseDarkTheme()) { stage.scene.getStylesheets().add("org/modena_dark.css"); } stage.setScene(stage.scene); return this; }
Example 18
Source File: SQLColumnSettingsComponent.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public SQLColumnSettingsComponent() { columnsTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); value = new SQLColumnSettings(); TableColumn<SQLRowObject,String> columnName=new TableColumn<SQLRowObject,String> (value.getColumnName(0)); TableColumn<SQLRowObject,SQLExportDataType> columnType=new TableColumn<SQLRowObject,SQLExportDataType> (value.getColumnName(1)); TableColumn<SQLRowObject,String> columnValue= new TableColumn<SQLRowObject,String> (value.getColumnName(2)); columnName.setCellValueFactory(new PropertyValueFactory<>("Name")); //this is needed during connection to a database columnType.setCellValueFactory(new PropertyValueFactory<>("Type")); columnValue.setCellValueFactory(new PropertyValueFactory<>("Value")); columnsTable.getColumns().addAll(columnName,columnType,columnValue); //added all the columns in the table setValue(value); columnsTable.setStyle("-fx-selection-bar: #3399FF; -fx-selection-bar-non-focused: #E3E3E3;"); //CSS color change on selection of row columnsTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); columnName.setSortable(false); columnValue.setSortable(false); columnType.setSortable(false); columnName.setReorderable(false); columnValue.setReorderable(false); columnType.setReorderable(false); columnsTable.setPrefSize(550, 220); columnsTable.setFixedCellSize(columnsTable.getFixedCellSize()+20); columnsTable.setStyle("-fx-font: 10 \"Plain\""); //Setting action event on cells columnsTable.getSelectionModel().setCellSelectionEnabled(true); //individual cell selection enabled columnsTable.setEditable(true); //Editors on each cell columnName.setCellFactory(TextFieldTableCell.<SQLRowObject>forTableColumn()); columnName.setOnEditCommit(event -> { getValue().setValueAt(event.getNewValue(), event.getTablePosition().getRow(), 0); setValue(getValue()); //refresh the table }); columnValue.setCellFactory(TextFieldTableCell.<SQLRowObject>forTableColumn()); columnValue.setOnEditCommit(event -> { getValue().setValueAt(event.getNewValue().toUpperCase(), event.getTablePosition().getRow(), 2); setValue(getValue()); //refresh the table }); ArrayList<SQLExportDataType> exportDataTypeValues=new ArrayList<SQLExportDataType>(Arrays.asList(SQLExportDataType.values())); columnType.setCellFactory(ComboBoxTableCell.forTableColumn(FXCollections.observableArrayList(SQLExportDataType.values()))); columnType.setOnEditCommit(event -> { boolean selected = event.getNewValue().isSelectableValue(); if(!selected){ //case of invalid(Title) datatype selection getValue().setValueAt(exportDataTypeValues.get(exportDataTypeValues.indexOf(event.getNewValue())+1),event.getTablePosition().getRow(),1); } else { getValue().setValueAt(event.getNewValue(), event.getTablePosition().getRow(), 1); } setValue(getValue()); }); // Add buttons VBox buttonsPanel=new VBox(20); addColumnButton=new Button("Add"); removeColumnButton=new Button("Remove"); addColumnButton.setOnAction(this::actionPerformed); removeColumnButton.setOnAction(this::actionPerformed); buttonsPanel.getChildren().addAll(addColumnButton,removeColumnButton); this.setRight(buttonsPanel); this.setCenter(columnsTable); BorderPane.setMargin(buttonsPanel, new Insets(10)); }
Example 19
Source File: PVTree.java From phoebus with Eclipse Public License 1.0 | 4 votes |
public Node create() { final Label label = new Label(Messages.PV_Label); pv_name.setOnAction(event -> setPVName(pv_name.getText())); pv_name.setTooltip(new Tooltip(Messages.PV_TT)); PVAutocompleteMenu.INSTANCE.attachField(pv_name); final ToggleButton latch = new ToggleButton(null, getImageView("run.png")); latch.setTooltip(new Tooltip(Messages.LatchTT)); latch.setOnAction(event -> { tree.getModel().latchOnAlarm(latch.isSelected()); if (latch.isSelected()) latch.setGraphic(getImageView("pause_on_alarm.png")); else latch.setGraphic(getImageView("run.png")); }); final Button collapse = new Button(null, getImageView("collapse.gif")); collapse.setTooltip(new Tooltip(Messages.CollapseTT)); collapse.setOnAction(event -> tree.expandAll(false)); final Button alarms = new Button(null, getImageView("alarmtree.png")); alarms.setTooltip(new Tooltip(Messages.ExpandAlarmsTT)); alarms.setOnAction(event -> tree.expandAlarms()); final Button expand = new Button(null, getImageView("pvtree.png")); expand.setTooltip(new Tooltip(Messages.ExpandAllTT)); expand.setOnAction(event -> tree.expandAll(true)); // center vertically label.setMaxHeight(Double.MAX_VALUE); HBox.setHgrow(pv_name, Priority.ALWAYS); final HBox top = new HBox(5, label, pv_name, latch, collapse, alarms, expand); BorderPane.setMargin(top, new Insets(5, 5, 0, 5)); BorderPane.setMargin(tree.getNode(), new Insets(5)); final BorderPane layout = new BorderPane(tree.getNode()); layout.setTop(top); hookDragDrop(layout); return layout; }
Example 20
Source File: TimelinePanel.java From constellation with Apache License 2.0 | 4 votes |
/** * Creates organises the TimelinePanel's layers. */ private void doLayout() { // Layer that contains the timelinechart component: final BorderPane timelinePane = new BorderPane(); timelinePane.setCenter(timeline); // The layer that contains the time extent labels: final BorderPane labelsPane = new BorderPane(); BorderPane.setAlignment(lowerTime, Pos.CENTER); BorderPane.setAlignment(upperTime, Pos.CENTER); BorderPane.setMargin(lowerTime, new Insets(-32.0, -40.0, 0.0, -60.0)); BorderPane.setMargin(upperTime, new Insets(-32.0, -60.0, 0.0, -40.0)); labelsPane.setLeft(lowerTime); labelsPane.setRight(upperTime); labelsPane.setMouseTransparent(true); // Layer that combines the newly constructed time-extents with the timeline layer: final StackPane stackPane = new StackPane(); StackPane.setAlignment(labelsPane, Pos.CENTER); // extentLabelPane.maxHeightProperty().bind(stackPane.heightProperty()); StackPane.setAlignment(timelinePane, Pos.CENTER); // timelinePane.prefHeightProperty().bind(stackPane.heightProperty()); stackPane.setPadding(Insets.EMPTY); stackPane.getChildren().addAll(timelinePane, labelsPane); // Layout the menu bar and the timeline object: final VBox vbox = new VBox(); // stackPane.prefHeightProperty().bind(vbox.heightProperty()); VBox.setVgrow(toolbar, Priority.NEVER); VBox.setVgrow(stackPane, Priority.ALWAYS); vbox.getChildren().addAll(toolbar, stackPane); vbox.setAlignment(Pos.TOP_CENTER); vbox.setFillWidth(true); // Organise the inner pane: AnchorPane.setTopAnchor(vbox, 0d); AnchorPane.setBottomAnchor(vbox, 0d); AnchorPane.setLeftAnchor(vbox, 0d); AnchorPane.setRightAnchor(vbox, 0d); innerPane.getChildren().add(vbox); innerPane.prefHeightProperty().bind(super.heightProperty()); innerPane.prefWidthProperty().bind(super.widthProperty()); // Attach the inner pane to the root: this.getChildren().add(innerPane); }