use of javafx.scene.layout.Background in project Board-Instrumentation-Framework by intel.
the class Demo method start.
@Override
public void start(Stage stage) {
HBox lcd = new HBox();
lcd.setPadding(new Insets(15, 15, 15, 15));
lcd.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
lcd.setSpacing(10);
lcd.setAlignment(Pos.CENTER);
lcd.setFillHeight(false);
HBox.setMargin(seg3, new Insets(0, 20, 0, 0));
lcd.getChildren().addAll(seg0, seg1, seg2, seg3, seg4, seg5);
/*
for (int i = 0 ; i < 256 ; i++) {
System.out.println(i + " : " + Character.toString((char) i));
}
*/
StackPane pane = new StackPane();
pane.getChildren().setAll(lcd);
Scene scene = new Scene(pane, Color.BLACK);
stage.setTitle("Sixteen Segment DemoGauge");
stage.setScene(scene);
stage.show();
timer.start();
}
use of javafx.scene.layout.Background in project tokentool by RPTools.
the class TokenTool_Controller method initialize.
@FXML
void initialize() {
// events
assert fileOpenPDF_Menu != null : "fx:id=\"fileOpenPDF_Menu\" was not injected: check your FXML file 'TokenTool.fxml'.";
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 dndHighlights != null : "fx:id=\"dndHighlights\" 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 backgroundImageView != null : "fx:id=\"backgroundImageView\" 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 useTokenNameCheckbox != null : "fx:id=\"useTokenNameCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert savePortraitOnDragCheckbox != null : "fx:id=\"savePortraitOnDragCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert useBackgroundOnDragCheckbox != null : "fx:id=\"useBackgroundOnDragCheckbox\" 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 portraitNameTextField != null : "fx:id=\"portraitNameTextField\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitNameSuffixLabel != null : "fx:id=\"portraitNameSuffixLabel\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitNameSuffixTextField != null : "fx:id=\"portraitNameSuffixTextField\" 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 overlayInfoLabel != null : "fx:id=\"overlayInfoLabel\" 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'.";
assert layerMenuButton != null : "fx:id=\"layerMenuButton\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert backgroundMenuItem != null : "fx:id=\"backgroundMenuItem\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitMenuItem != null : "fx:id=\"portraitMenuItem\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayMenuItem != null : "fx:id=\"overlayMenuItem\" was not injected: check your FXML file 'TokenTool.fxml'.";
// We're getting the defaults set by the FXML before updating them with the saved preferences...
AppConstants.DEFAULT_MASK_IMAGE = maskImageView.getImage();
AppConstants.DEFAULT_OVERLAY_IMAGE = overlayImageView.getImage();
AppConstants.DEFAULT_PORTRAIT_IMAGE = portraitImageView.getImage();
AppConstants.DEFAULT_PORTRAIT_IMAGE_X = portraitImageView.getTranslateX();
AppConstants.DEFAULT_PORTRAIT_IMAGE_Y = portraitImageView.getTranslateY();
AppConstants.DEFAULT_PORTRAIT_IMAGE_SCALE = portraitImageView.getScaleY();
AppConstants.DEFAULT_PORTRAIT_IMAGE_ROTATE = portraitImageView.getRotate();
AppConstants.DEFAULT_SAVE_PORTRAIT_ON_DRAG = getSavePortraitOnDragCheckbox();
AppConstants.DEFAULT_USE_BACKGROUND_ON_DRAG = getUseBackgroundOnDragCheckbox();
AppConstants.DEFAULT_PORTRAIT_NAME_TEXT_FIELD = getPortraitNameTextField();
AppConstants.DEFAULT_USE_TOKEN_NAME = getUseTokenNameCheckbox();
AppConstants.DEFAULT_PORTRAIT_NAME_SUFFIX_TEXT_FIELD = getPortraitNameSuffixTextField();
executorService = Executors.newCachedThreadPool(runable -> {
loadOverlaysThread = Executors.defaultThreadFactory().newThread(runable);
loadOverlaysThread.setDaemon(true);
return loadOverlaysThread;
});
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();
}
});
// Set filters and bindings for file name inputs
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;
};
fileNameTextField.setTextFormatter(new TextFormatter<>(filter));
portraitNameTextField.setTextFormatter(new TextFormatter<>(filter));
portraitNameTextField.textProperty().bind(fileNameTextField.textProperty().concat(portraitNameSuffixTextField.textProperty()));
// Bind portrait name to token name if useTokenNameCheckbox is checked
portraitNameTextField.disableProperty().bind(useTokenNameCheckbox.selectedProperty());
portraitNameSuffixLabel.disableProperty().bind(useTokenNameCheckbox.selectedProperty().not());
portraitNameSuffixTextField.disableProperty().bind(useTokenNameCheckbox.selectedProperty().not());
// Bind the use background on drag to save portrait on drag checkbox
useBackgroundOnDragCheckbox.disableProperty().bind(savePortraitOnDragCheckbox.selectedProperty().not());
useTokenNameCheckbox.selectedProperty().addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected) {
portraitNameTextField.textProperty().bind(fileNameTextField.textProperty().concat(portraitNameSuffixTextField.textProperty()));
} else {
portraitNameTextField.textProperty().unbind();
}
});
/* 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));
overlayWidthSpinner.getValueFactory().setConverter(new StringConverter<Integer>() {
@Override
public String toString(Integer object) {
return object.toString();
}
@Override
public Integer fromString(String string) {
int value = 256;
try {
value = Integer.parseInt(string);
} catch (NumberFormatException e) {
log.debug("Invalid overlay size entered.", e);
}
return value;
}
});
overlayHeightSpinner.valueProperty().addListener((observable, oldValue, newValue) -> overlayHeightSpinner_onTextChanged(oldValue, newValue));
overlayHeightSpinner.getValueFactory().setConverter(new StringConverter<Integer>() {
@Override
public String toString(Integer object) {
return object.toString();
}
@Override
public Integer fromString(String string) {
int value = 256;
try {
value = Integer.parseInt(string);
} catch (NumberFormatException e) {
log.info("NOPE");
}
return value;
}
});
// Bind the background/portrait pane widths to keep things centered.
// Otherwise StackPane sets width/height to largest value from the ImageView nodes within it
imagesStackPane.minWidthProperty().bind(compositeTokenPane.widthProperty());
imagesStackPane.minHeightProperty().bind(compositeTokenPane.heightProperty());
}
use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.
the class JFXSliderSkin method initListeners.
private void initListeners() {
// delegate slider mouse events to track node
getSkinnable().setOnMousePressed(me -> {
if (!me.isConsumed()) {
me.consume();
track.fireEvent(me);
}
});
getSkinnable().setOnMouseReleased(me -> {
if (!me.isConsumed()) {
me.consume();
track.fireEvent(me);
}
});
getSkinnable().setOnMouseDragged(me -> {
if (!me.isConsumed()) {
me.consume();
track.fireEvent(me);
}
});
// animate value node
track.addEventHandler(MouseEvent.MOUSE_PRESSED, (event) -> {
timeline.setRate(1);
timeline.play();
});
track.addEventHandler(MouseEvent.MOUSE_RELEASED, (event) -> {
timeline.setRate(-1);
timeline.play();
});
thumb.addEventHandler(MouseEvent.MOUSE_PRESSED, (event) -> {
timeline.setRate(1);
timeline.play();
});
thumb.addEventHandler(MouseEvent.MOUSE_RELEASED, (event) -> {
timeline.setRate(-1);
timeline.play();
});
track.backgroundProperty().addListener((o, oldVal, newVal) -> {
// prevent internal color change
if (!internalChange && newVal != null)
trackColor = newVal.getFills().get(0).getFill();
});
thumb.backgroundProperty().addListener((o, oldVal, newVal) -> {
// prevent internal color change
if (!internalChange && newVal != null) {
thumbColor = newVal.getFills().get(0).getFill();
if (getSkinnable().getValue() == getSkinnable().getMin()) {
internalChange = true;
thumb.setBackground(new Background(new BackgroundFill(trackColor, new CornerRadii(20), Insets.EMPTY)));
internalChange = false;
}
}
});
refreshSliderValueBinding();
getSkinnable().valueProperty().addListener((o, oldVal, newVal) -> {
internalChange = true;
if (getSkinnable().getMin() == newVal.doubleValue()) {
thumb.setBackground(new Background(new BackgroundFill(trackColor, new CornerRadii(20), Insets.EMPTY)));
animatedThumb.pseudoClassStateChanged(PseudoClass.getPseudoClass("min"), true);
} else if (oldVal.doubleValue() == getSkinnable().getMin()) {
thumb.setBackground(new Background(new BackgroundFill(thumbColor, new CornerRadii(20), Insets.EMPTY)));
animatedThumb.pseudoClassStateChanged(PseudoClass.getPseudoClass("min"), false);
}
internalChange = false;
});
getSkinnable().orientationProperty().addListener((o, oldVal, newVal) -> initAnimation(newVal));
animatedThumb.layoutBoundsProperty().addListener((o, oldVal, newVal) -> initAnimation(getSkinnable().getOrientation()));
}
use of javafx.scene.layout.Background in project Retrospector by NonlinearFruit.
the class Retrospector method init.
@Override
public void init() {
ImageView splash = new ImageView(new Image(SPLASH_IMAGE, SPLASH_WIDTH, SPLASH_HEIGHT, true, true));
loadProgress = new ProgressBar(0);
loadProgress.setPrefWidth(SPLASH_WIDTH);
progressText = new Label("Initializing . . .");
progressText.setBackground(new Background(new BackgroundFill(Color.GHOSTWHITE, new CornerRadii(5), new Insets(0))));
splashLayout = new VBox();
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
progressText.setAlignment(Pos.CENTER);
// splashLayout.setEffect(new DropShadow());
splashLayout.setBackground(Background.EMPTY);
}
use of javafx.scene.layout.Background in project Smartcity-Smarthouse by TechnionYP5777.
the class Controller method initialize.
@Override
public void initialize(final URL location, final ResourceBundle __) {
pane.setPrefSize(1200, 800);
List<Tile> tiles = new ArrayList<>();
for (int i = 0; i < ROWS_NUM * TILES_IN_ROW; ++i) {
final Integer loc = i;
final Tile t = TileBuilder.create().prefSize(TILE_SIZE, TILE_SIZE).skinType(SkinType.TEXT).description("Choose a widget:\nClick me!\t\t").descriptionAlignment(Pos.CENTER).textVisible(true).build();
setTileEventHandlers(t, loc);
tiles.add(t);
}
pane.getChildren().addAll(tiles);
pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), null, null)));
// pane.setPadding(new Insets(5));
// pane.setPrefHeight((TILE_SIZE+8)*ROWS_NUM);
// pane.setPrefWidth((TILE_SIZE+8)*TILES_IN_ROW);
}
Aggregations