List of usage examples for javafx.scene.layout Background Background
public Background(final @NamedArg("images") BackgroundImage... images)
From source file:ui.ChoseFonctionnalite.java
private void initUI() { Pane root = new Pane(); root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, new BackgroundSize(530, 400, true, true, true, true)))); JFXButton serveur = new JFXButton("SERVEUR"); serveur.setCursor(Cursor.HAND); serveur.setMinSize(171, 57);/*www.j av a 2 s. c o m*/ serveur.setLayoutX(179); serveur.setLayoutY(90); serveur.setFont(new Font(27)); serveur.setStyle("-fx-background-color: #9E21FF;"); serveur.setOnAction(event -> { startServerMode(); }); JFXButton client = new JFXButton("CLIENT"); client.setCursor(Cursor.HAND); client.setMinSize(171, 57); client.setLayoutX(179); client.setLayoutY(197); client.setFont(new Font(27)); client.setStyle("-fx-background-color: #9E21FF;"); client.setOnAction(event -> { startClientMode(event); }); Label info = new Label("choisir la maniere d'utiliser virtual remote"); info.setMinSize(529, 43); info.setLayoutX(10); info.setLayoutY(14); info.setFont(new Font("Algerian", 20)); root.getChildren().add(client); root.getChildren().add(serveur); root.getChildren().add(info); Scene scene = new Scene(root, 530, 400); stage.setTitle("Fontionnalit"); stage.setScene(scene); stage.setResizable(false); stage.initStyle(StageStyle.DECORATED); stage.setOnCloseRequest(event -> { System.exit(1); }); stage.show(); }
From source file:de.pixida.logtest.designer.automaton.Graph.java
Graph(final IAutomatonEditor aAutomatonEditor) { Validate.notNull(aAutomatonEditor);//from www. j a v a2s .c o m this.automatonEditor = aAutomatonEditor; this.pane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); final double minSizeX = 800.0; final double minSizeY = 600.0; this.pane.setMinSize(minSizeX, minSizeY); final double paddingRightBottom = 8.0; this.pane.setPadding(new Insets(0.0, paddingRightBottom, paddingRightBottom, 0.0)); this.pane.setOnMouseMoved(event -> this.mouseMovedOnPane(event)); this.pane.setOnMouseClicked(event -> this.mouseClickedOnPane(event)); final MenuItem mi = new MenuItem("Create new state"); mi.setGraphic(Icons.getIconGraphics("pencil_add")); mi.setOnAction(event -> { // The following code does not really belong here as the class is designed only to handle business belongings... it should be // moved somewhere else!? final AutomatonNode newNode = new AutomatonNode(Graph.this); newNode.setPosition(new Point2D(this.lastMousePositionOnPaneX, this.lastMousePositionOnPaneY)); newNode.setName("New state"); Graph.this.addObject(newNode); Graph.this.handleChange(); Graph.this.showConfigFrameOfObject(newNode); }); this.contextMenu.getItems().add(mi); }
From source file:org.cryptomator.ui.util.PasswordStrengthUtil.java
public Background getBackgroundWithStrengthColor(Number score) { Color c = this.getStrengthColor(score); BackgroundFill fill = new BackgroundFill(c, CornerRadii.EMPTY, Insets.EMPTY); return new Background(fill); }
From source file:ui.ChoseFonctionnalite.java
private void startClientMode(ActionEvent eventT) { //File config = new File("resource/config.json"); String host = ""; String port = "8000"; Stage stageModal = new Stage(); Pane root = new Pane(); root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, new BackgroundSize(530, 400, true, true, true, true)))); stageModal.setScene(new Scene(root, 200, 200)); stageModal.initStyle(StageStyle.UTILITY); Label adresse = new Label("Adresse serveur:"); adresse.setLayoutX(10);/* w w w .jav a 2 s. c o m*/ adresse.setLayoutY(10); adresse.setFont(Font.font("Arial", 16)); JFXTextField adresseInput = new JFXTextField("127.0.0.1"); adresseInput.setPrefWidth(180); adresseInput.setLayoutX(10); adresseInput.setLayoutY(40); JFXButton valider = new JFXButton("Se connecter"); valider.setCursor(Cursor.HAND); valider.setMinSize(100, 30); valider.setLayoutX(20); valider.setLayoutY(130); valider.setFont(new Font(20)); valider.setStyle("-fx-background-color: #9E21FF;"); valider.setOnAction(event -> { if (adresseInput.getText() != "") { stageModal.close(); InitClient initializeClient = new InitClient(stage, adresseInput.getText(), port); } }); root.getChildren().add(valider); root.getChildren().add(adresse); root.getChildren().add(adresseInput); stageModal.setTitle("Adresse serveur"); stageModal.initModality(Modality.WINDOW_MODAL); stageModal.initOwner(((Node) eventT.getSource()).getScene().getWindow()); stageModal.show(); }
From source file:deincraftlauncher.InstallController.java
@Override public void initialize(URL url, ResourceBundle rb) { instance = this; System.out.println("Starting Installer UI..."); int saveX = 393; int cancelY = 165; int saveY = 200; int sizeX = 481; Rectangle separator = new Rectangle(); separator.setWidth(sizeX);/* ww w .j a v a2 s .c o m*/ separator.setHeight(separatorSizeY); separator.setLayoutY(separatorY); separator.setFill(blueColor); mainPanel.getChildren().add(separator); mainPanel.setBackground(Background.EMPTY); TextButton cancel = new TextButton(saveX, cancelY, "cancel", Color.RED, mainPanel); cancel.setOnClick((TextButton tile) -> { cancel(); }); save = new TextButton(saveX, saveY, "Weiter", Color.GRAY, mainPanel); save.setFocusable(false); save.setOnClick((TextButton tile) -> { Continue(); }); login = new TextButton(14, 151, "Login", Color.BLUE, mainPanel); login.setOnClick((TextButton tile) -> { doLogin(null); }); Label Title = new Label(); Title.setText("Installer"); Title.setPrefSize(sizeX, separatorY); Title.setTextFill(Color.WHITESMOKE); Title.setTextAlignment(TextAlignment.CENTER); Title.setFont(DesignHelpers.getFocusFont(42)); Title.setAlignment(Pos.CENTER); mainPanel.getChildren().add(Title); pathLabel.setBackground(new Background(new BackgroundFill(Color.rgb(170, 170, 170), radii, insets))); //ContinueButton.setBackground(new Background(new BackgroundFill(Color.rgb(100, 190, 100), radii, insets))); //Green Version setDefaultPath(); System.out.println("starting done"); }
From source file:com.ggvaidya.scinames.complexquery.ComplexQueryViewController.java
public void setQueryStatus(String status) { if (status.equals("ok")) { queryStatusTextField.setBackground( new Background(new BackgroundFill(Paint.valueOf("green"), CornerRadii.EMPTY, Insets.EMPTY))); queryStatusTextField.setAlignment(Pos.CENTER); queryStatusTextField.setText("Query executed successfully"); } else {// w ww. j ava2 s.c om queryStatusTextField.setBackground( new Background(new BackgroundFill(Paint.valueOf("red"), CornerRadii.EMPTY, Insets.EMPTY))); queryStatusTextField.setAlignment(Pos.CENTER); queryStatusTextField.setText(status); } }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.java
EventNodeBase(Type tlEvent, EventNodeBase<?> parent, DetailsChartLane<?> chartLane) { this.chartLane = chartLane; this.tlEvent = tlEvent; this.parentNode = parent; sleuthkitCase = chartLane.getController().getAutopsyCase().getSleuthkitCase(); eventsModel = chartLane.getController().getEventsModel(); eventTypeImageView.setImage(getEventType().getFXImage()); if (tlEvent.getEventIDsWithHashHits().isEmpty()) { show(hashIV, false);//from ww w .j a v a2s .c om } if (tlEvent.getEventIDsWithTags().isEmpty()) { show(tagIV, false); } if (chartLane.getController().getEventsModel().getEventTypeZoom() == EventTypeZoomLevel.SUB_TYPE) { evtColor = getEventType().getColor(); } else { evtColor = getEventType().getBaseType().getColor(); } SELECTION_BORDER = new Border(new BorderStroke(evtColor.darker().desaturate(), BorderStrokeStyle.SOLID, CORNER_RADII_3, new BorderWidths(2))); defaultBackground = new Background( new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII_3, Insets.EMPTY)); highlightedBackground = new Background( new BackgroundFill(evtColor.deriveColor(0, 1.1, 1.1, .3), CORNER_RADII_3, Insets.EMPTY)); setBackground(defaultBackground); Tooltip.install(this, this.tooltip); //set up mouse hover effect and tooltip setOnMouseEntered(mouseEntered -> { Tooltip.uninstall(chartLane, AbstractTimelineChart.getDefaultTooltip()); showHoverControls(true); toFront(); }); setOnMouseExited(mouseExited -> { showHoverControls(false); if (parentNode != null) { parentNode.showHoverControls(true); } else { Tooltip.install(chartLane, AbstractTimelineChart.getDefaultTooltip()); } }); setOnMouseClicked(new ClickHandler()); show(controlsHBox, false); }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java
public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode, EventDetailChart chart) {/*from www. ja v a 2 s . c om*/ this.event = event; descLOD.set(event.getLOD()); this.parentEventNode = parentEventNode; this.chart = chart; final Region region = new Region(); HBox.setHgrow(region, Priority.ALWAYS); final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton); hBox.setPrefWidth(USE_COMPUTED_SIZE); hBox.setMinWidth(USE_PREF_SIZE); hBox.setPadding(new Insets(2, 5, 2, 5)); hBox.setAlignment(Pos.CENTER_LEFT); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null); BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT); borderPane.setPrefWidth(USE_COMPUTED_SIZE); getChildren().addAll(spanRegion, borderPane); setAlignment(Pos.TOP_LEFT); setMinHeight(24); minWidthProperty().bind(spanRegion.widthProperty()); setPrefHeight(USE_COMPUTED_SIZE); setMaxHeight(USE_PREF_SIZE); //set up subnode pane sizing contraints subNodePane.setPrefHeight(USE_COMPUTED_SIZE); subNodePane.setMinHeight(USE_PREF_SIZE); subNodePane.setMinWidth(USE_PREF_SIZE); subNodePane.setMaxHeight(USE_PREF_SIZE); subNodePane.setMaxWidth(USE_PREF_SIZE); subNodePane.setPickOnBounds(false); //setup description label eventTypeImageView.setImage(event.getType().getFXImage()); descrLabel.setGraphic(eventTypeImageView); descrLabel.setPrefWidth(USE_COMPUTED_SIZE); descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); descrLabel.setMouseTransparent(true); setDescriptionVisibility(chart.getDescrVisibility().get()); //setup backgrounds final Color evtColor = event.getType().getColor(); spanFill = new Background( new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)); setBackground( new Background(new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY))); setCursor(Cursor.HAND); spanRegion.setStyle("-fx-border-width:2 0 2 2; -fx-border-radius: 2; -fx-border-color: " + ColorUtilities.getRGBCode(evtColor) + ";"); // NON-NLS spanRegion.setBackground(spanFill); //set up mouse hover effect and tooltip setOnMouseEntered((MouseEvent e) -> { //defer tooltip creation till needed, this had a surprisingly large impact on speed of loading the chart installTooltip(); spanRegion.setEffect(new DropShadow(10, evtColor)); minusButton.setVisible(true); plusButton.setVisible(true); minusButton.setManaged(true); plusButton.setManaged(true); toFront(); }); setOnMouseExited((MouseEvent e) -> { spanRegion.setEffect(null); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); }); setOnMouseClicked(new EventMouseHandler()); plusButton.disableProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL)); minusButton.disableProperty().bind(descLOD.isEqualTo(event.getLOD())); plusButton.setOnMouseClicked(e -> { final DescriptionLOD next = descLOD.get().next(); if (next != null) { loadSubClusters(next); descLOD.set(next); } }); minusButton.setOnMouseClicked(e -> { final DescriptionLOD previous = descLOD.get().previous(); if (previous != null) { loadSubClusters(previous); descLOD.set(previous); } }); }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java
/** apply the 'effect' to visually indicate highlighted nodes * * @param applied true to apply the highlight 'effect', false to remove it *//*from w w w . j a v a2s.co m*/ void applyHighlightEffect(boolean applied) { if (applied) { descrLabel.setStyle("-fx-font-weight: bold;"); // NON-NLS spanFill = new Background(new BackgroundFill(getEvent().getType().getColor().deriveColor(0, 1, 1, .3), CORNER_RADII, Insets.EMPTY)); spanRegion.setBackground(spanFill); setBackground(new Background(new BackgroundFill( getEvent().getType().getColor().deriveColor(0, 1, 1, .2), CORNER_RADII, Insets.EMPTY))); } else { descrLabel.setStyle("-fx-font-weight: normal;"); // NON-NLS spanFill = new Background(new BackgroundFill(getEvent().getType().getColor().deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)); spanRegion.setBackground(spanFill); setBackground(new Background(new BackgroundFill( getEvent().getType().getColor().deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY))); } }
From source file:net.rptools.tokentool.controller.TokenTool_Controller.java
@FXML void initialize() { // Note: A Pane is added to the compositeTokenPane so the ScrollPane doesn't consume the mouse events assert fileManageOverlaysMenu != null : "fx:id=\"fileManageOverlaysMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileSaveAsMenu != null : "fx:id=\"fileSaveAsMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileExitMenu != null : "fx:id=\"fileExitMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert editCaptureScreenMenu != null : "fx:id=\"editCaptureScreenMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert editCopyImageMenu != null : "fx:id=\"editCopyImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert editPasteImageMenu != null : "fx:id=\"editPasteImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert helpAboutMenu != null : "fx:id=\"helpAboutMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert saveOptionsPane != null : "fx:id=\"saveOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayOptionsPane != null : "fx:id=\"overlayOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert backgroundOptionsPane != null : "fx:id=\"backgroundOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert zoomOptionsPane != null : "fx:id=\"zoomOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert compositeTokenPane != null : "fx:id=\"compositeTokenPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert tokenPreviewPane != null : "fx:id=\"tokenPreviewPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitScrollPane != null : "fx:id=\"portraitScrollPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert compositeGroup != null : "fx:id=\"compositeGroup\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayTreeView != null : "fx:id=\"overlayTreeview\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitImageView != null : "fx:id=\"portraitImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert maskImageView != null : "fx:id=\"maskImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayImageView != null : "fx:id=\"overlayImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert tokenImageView != null : "fx:id=\"tokenImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert useFileNumberingCheckbox != null : "fx:id=\"useFileNumberingCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayUseAsBaseCheckbox != null : "fx:id=\"overlayUseAsBaseCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'."; assert clipPortraitCheckbox != null : "fx:id=\"clipPortraitCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileNameTextField != null : "fx:id=\"fileNameTextField\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileNameSuffixLabel != null : "fx:id=\"fileNameSuffixLabel\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileNameSuffixTextField != null : "fx:id=\"fileNameSuffixTextField\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayNameLabel != null : "fx:id=\"overlayNameLabel\" was not injected: check your FXML file 'TokenTool.fxml'."; assert backgroundColorPicker != null : "fx:id=\"backgroundColorPicker\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayAspectToggleButton != null : "fx:id=\"overlayAspectToggleButton\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitTransparencySlider != null : "fx:id=\"portraitTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitBlurSlider != null : "fx:id=\"portraitBlurSlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitGlowSlider != null : "fx:id=\"portraitGlowSlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayTransparencySlider != null : "fx:id=\"overlayTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayWidthSpinner != null : "fx:id=\"overlayWidthSpinner\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayHeightSpinner != null : "fx:id=\"overlayHeightSpinner\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayTreeProgressBar != null : "fx:id=\"overlayTreeProgressIndicator\" was not injected: check your FXML file 'ManageOverlays.fxml'."; executorService = Executors.newCachedThreadPool(runable -> { loadOverlaysThread = Executors.defaultThreadFactory().newThread(runable); loadOverlaysThread.setDaemon(true); return loadOverlaysThread; });/* w w w . j a va 2 s . c o m*/ overlayTreeView.setShowRoot(false); overlayTreeView.getSelectionModel().selectedItemProperty().addListener( (observable, oldValue, newValue) -> updateCompositImageView((TreeItem<Path>) newValue)); addPseudoClassToLeafs(overlayTreeView); // Bind color picker to compositeTokenPane background fill backgroundColorPicker.setValue(Color.TRANSPARENT); ObjectProperty<Background> background = compositeTokenPane.backgroundProperty(); background.bind(Bindings.createObjectBinding(() -> { BackgroundFill fill = new BackgroundFill(backgroundColorPicker.getValue(), CornerRadii.EMPTY, Insets.EMPTY); return new Background(fill); }, backgroundColorPicker.valueProperty())); // Bind transparency slider to portraitImageView opacity portraitTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { portraitImageView.setOpacity(new_val.doubleValue()); updateTokenPreviewImageView(); } }); // // Restrict text field to valid filename characters // Pattern validDoubleText = Pattern.compile("[^a-zA-Z0-9\\\\._ \\\\/`~!@#$%\\\\^&\\\\(\\\\)\\\\-\\\\=\\\\+\\\\[\\\\]\\\\{\\\\}',\\\\\\\\:]"); // Pattern validText = Pattern.compile("[^a-zA-Z0-9 ]"); // TextFormatter<> textFormatter = new TextFormatter<>( // change -> { // String newText = change.getControlNewText(); // if (validText.matcher(newText).matches()) { // return change; // } else // return null; // }); // UnaryOperator<TextFormatter.Change> filter = new UnaryOperator<TextFormatter.Change>() { // @Override // public TextFormatter.Change apply(TextFormatter.Change t) { // String validText = "[^a-zA-Z0-9]"; // // if (t.isReplaced()) // if (t.getText().matches(validText)) // t.setText(t.getControlText().substring(t.getRangeStart(), t.getRangeEnd())); // // if (t.isAdded()) { // if (t.getText().matches(validText)) { // return null; // } // } // // return t; // } // }; UnaryOperator<Change> filter = change -> { String text = change.getText(); if (text.matches(AppConstants.VALID_FILE_NAME_PATTERN)) { return change; } else { change.setText(FileSaveUtil.cleanFileName(text)); ; return change; } // // return null; }; TextFormatter<String> textFormatter = new TextFormatter<>(filter); fileNameTextField.setTextFormatter(textFormatter); // Effects GaussianBlur gaussianBlur = new GaussianBlur(0); Glow glow = new Glow(0); gaussianBlur.setInput(glow); // Bind blur slider to portraitImageView opacity portraitBlurSlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { gaussianBlur.setRadius(new_val.doubleValue()); portraitImageView.setEffect(gaussianBlur); updateTokenPreviewImageView(); } }); // Bind glow slider to portraitImageView opacity portraitGlowSlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { glow.setLevel(new_val.doubleValue()); portraitImageView.setEffect(gaussianBlur); updateTokenPreviewImageView(); } }); // Bind transparency slider to overlayImageView opacity overlayTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { overlayImageView.setOpacity(new_val.doubleValue()); updateTokenPreviewImageView(); } }); // Bind width/height spinners to overlay width/height overlayWidthSpinner.getValueFactory().valueProperty() .bindBidirectional(overlayHeightSpinner.getValueFactory().valueProperty()); overlayWidthSpinner.valueProperty().addListener( (observable, oldValue, newValue) -> overlayWidthSpinner_onTextChanged(oldValue, newValue)); overlayHeightSpinner.valueProperty().addListener( (observable, oldValue, newValue) -> overlayHeightSpinner_onTextChanged(oldValue, newValue)); }