javafx.geometry.Pos Java Examples

The following examples show how to use javafx.geometry.Pos. 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: AddressWithIconAndDirection.java    From bisq with GNU Affero General Public License v3.0 8 votes vote down vote up
public AddressWithIconAndDirection(String text, String address, boolean received) {
    Label directionIcon = new Label();
    directionIcon.getStyleClass().add("icon");
    directionIcon.getStyleClass().add(received ? "received-funds-icon" : "sent-funds-icon");
    AwesomeDude.setIcon(directionIcon, received ? AwesomeIcon.SIGNIN : AwesomeIcon.SIGNOUT);
    if (received)
        directionIcon.setRotate(180);
    directionIcon.setMouseTransparent(true);

    setAlignment(Pos.CENTER_LEFT);
    Label label = new AutoTooltipLabel(text);
    label.setMouseTransparent(true);
    HBox.setMargin(directionIcon, new Insets(0, 3, 0, 0));
    HBox.setHgrow(label, Priority.ALWAYS);

    hyperlink = new ExternalHyperlink(address);
    HBox.setMargin(hyperlink, new Insets(0));
    HBox.setHgrow(hyperlink, Priority.SOMETIMES);
    // You need to set max width to Double.MAX_VALUE to make HBox.setHgrow working like expected!
    // also pref width needs to be not default (-1)
    hyperlink.setMaxWidth(Double.MAX_VALUE);
    hyperlink.setPrefWidth(0);

    getChildren().addAll(directionIcon, label, hyperlink);
}
 
Example #2
Source File: SplitModule.java    From pdfsam with GNU Affero General Public License v3.0 8 votes vote down vote up
private VBox settingPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);
    prefix.addMenuItemFor(Prefix.CURRENTPAGE);
    prefix.addMenuItemFor(Prefix.FILENUMBER);
    prefix.addMenuItemFor("[TOTAL_FILESNUMBER]");

    pane.getChildren().addAll(selectionPane,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions),
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Output settings"), destinationPane),
            prefixTitled);
    return pane;
}
 
Example #3
Source File: ManageEnvironmentsDialog.java    From milkman with MIT License 6 votes vote down vote up
public ManageEnvironmentsDialogFxml(ManageEnvironmentsDialog controller){

			setHeading(label("Manage Environments"));

			StackPane stackPane = new StackPane();
			var list = controller.environmentList = new JFXListView<>();
			list.setVerticalGap(10.0);
			list.setMinHeight(400);
			stackPane.getChildren().add(list);

			var btn = button(icon(FontAwesomeIcon.PLUS, "1.5em"), controller::onCreateEnvironment);
			btn.getStyleClass().add("btn-add-entry");
			StackPane.setAlignment(btn, Pos.BOTTOM_RIGHT);
			stackPane.getChildren().add(btn);

			setBody(stackPane);

			JFXButton close = cancel(controller::onClose, "Close");
			close.getStyleClass().add("dialog-accept");
			setActions(close);

		}
 
Example #4
Source File: AttributeList.java    From constellation with Apache License 2.0 6 votes vote down vote up
public AttributeList(final ImportController importController, final RunPane runPane, final AttributeType attributeType) {
    this.runPane = runPane;

    this.importController = importController;
    this.attributeType = attributeType;
    attributeNodes = new HashMap<>();
    keys = new HashSet<>();

    setAlignment(Pos.CENTER);
    setMinSize(50, 100);
    setSpacing(1);
    setPadding(new Insets(2));
    setFillWidth(true);

    setAlignment(Pos.TOP_CENTER);
}
 
Example #5
Source File: PollenDashboard.java    From medusademo with Apache License 2.0 6 votes vote down vote up
private HBox getHBox(final String TEXT, final Gauge GAUGE) {
    Label label = new Label(TEXT);
    label.setPrefWidth(150);
    label.setFont(Font.font(26));
    label.setTextFill(MaterialDesign.GREY_800.get());
    label.setAlignment(Pos.CENTER_LEFT);
    label.setPadding(new Insets(0, 10, 0, 0));

    GAUGE.setBarBackgroundColor(Color.rgb(232, 231, 223));
    GAUGE.setAnimated(true);
    GAUGE.setAnimationDuration(1000);

    HBox hBox = new HBox(label, GAUGE);
    hBox.setSpacing(20);
    hBox.setAlignment(Pos.CENTER_LEFT);
    return hBox;
}
 
Example #6
Source File: HelloWorld.java    From Learn-Java-12-Programming with MIT License 6 votes vote down vote up
public void start(Stage primaryStage) {
    try {
        Text txt = new Text("What a beautiful image!");

        FileInputStream input = new FileInputStream("src/main/resources/packt.png");
        Image image = new Image(input);
        ImageView iv = new ImageView(image);

        VBox vb = new VBox(txt, iv);
        vb.setSpacing(20);
        vb.setAlignment(Pos.CENTER);
        vb.setPadding(new Insets(10, 10, 10, 10));

        Scene scene = new Scene(vb, 300, 200);

        primaryStage.setScene(scene);
        primaryStage.setTitle("JavaFX with embedded image");
        primaryStage.onCloseRequestProperty()
                .setValue(e -> System.out.println("Bye! See you later!"));
        primaryStage.show();
    } catch (Exception ex){
        ex.printStackTrace();
    }
}
 
Example #7
Source File: MessageBox.java    From SmartCity-ParkingManagement with Apache License 2.0 6 votes vote down vote up
public void display(final String title, final String message) {
	window = new Stage();
	window.initModality(Modality.APPLICATION_MODAL);
	window.setTitle(title);
	window.setMinWidth(250);
	window.setMinHeight(100);
	window.getIcons().add(new Image(getClass().getResourceAsStream("Smart_parking_icon.png")));

	final Label label = new Label();
	label.setText(message);

	final VBox layout = new VBox();
	layout.getChildren().addAll(label);
	layout.setAlignment(Pos.CENTER);

	final Scene scene = new Scene(layout);
	scene.getStylesheets().add(getClass().getResource("mainStyle.css").toExternalForm());
	window.setScene(scene);
	window.showAndWait();

}
 
Example #8
Source File: TrainingView.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public TrainingView() {

        label = new Label();

        Button button = new Button("train network model");
        button.setOnAction(e -> {
            Task task = train();
            button.disableProperty().bind(task.runningProperty());
        });
        series = new Series();
        series.setName("#iterations");
        Chart chart = createChart(series);

        VBox controls = new VBox(15.0, label, button, chart);
        controls.setAlignment(Pos.CENTER);

        setCenter(controls);
    }
 
Example #9
Source File: DotHTMLLabelJavaFxNode.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private void applyTableAlignAttributesOnTdPane(GridPane wrapper) {
	/*
	 * Graphviz documentation specifies for the ALIGN attribute on cells: If
	 * the cell does not contain text, then the contained image or table is
	 * centered.
	 *
	 * Further, by observation, unless the fixedsize attribute is set, in
	 * graphviz the inner table grows in both horizontal and vertical
	 * direction.
	 *
	 * TODO: revise these settings when the align attribute on table tags is
	 * implemented, as this may change some behaviour.
	 */
	GridPane.setHgrow(wrapper.getChildren().get(0), Priority.ALWAYS);
	GridPane.setVgrow(wrapper.getChildren().get(0), Priority.ALWAYS);
	wrapper.setAlignment(Pos.CENTER);
}
 
Example #10
Source File: StatisticCellWithArrows.java    From trex-stateless-gui with Apache License 2.0 6 votes vote down vote up
public StatisticCellWithArrows(double width, boolean odd, String unit) {
    this.unit = unit;
    setPrefSize(width, 22);
    setSpacing(5);
    setAlignment(Pos.CENTER_RIGHT);
    Platform.runLater(() -> {
        getStyleClass().add("statsTableColCell");
        if (odd) {
            getStyleClass().add("statsTableColCellOdd");
        }
    });
    imageView = new ImageView();
    getChildren().add(imageView);
    value = new Label();
    getChildren().add(value);
}
 
Example #11
Source File: ColorPickerSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ColorPickerSample() {
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler() {

        public void handle(Event t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    getChildren().add(outerVBox);
}
 
Example #12
Source File: TrayDemo.java    From oim-fx with MIT License 6 votes vote down vote up
@Override
public void start(final Stage stage) throws Exception {
	enableTray(stage);

	GridPane grid = new GridPane();
	grid.setAlignment(Pos.CENTER);
	grid.setHgap(20);
	grid.setVgap(20);
	grid.setGridLinesVisible(true);
	grid.setPadding(new Insets(25, 25, 25, 25));

	Button b1 = new Button("测试1");
	Button b2 = new Button("测试2");
	grid.add(b1, 0, 0);
	grid.add(b2, 1, 1);

	Scene scene = new Scene(grid, 800, 600);
	stage.setScene(scene);
	stage.setOnCloseRequest(new EventHandler<WindowEvent>() {

		@Override
		public void handle(WindowEvent arg0) {
			stage.hide();
		}
	});
}
 
Example #13
Source File: Popup.java    From ApkToolPlus with Apache License 2.0 6 votes vote down vote up
private Popup() {
    super();
    // 设置背景颜色
    setBackgroundColor(20,20,20,0.5f);
    contentBox = new VBox();

    // 间隔
    Region topRegion = new Region();
    topRegion.setPrefHeight(30);
    contentBox.getChildren().add(topRegion);

    // 提示信息
    text = new Text();
    text.setStyle("-fx-fill: white; -fx-font-size:24;-fx-font-family: \"Microsoft YaHei\";-fx-text-alignment: CENTER;");
    contentBox.getChildren().add(text);

    // 设置内容居中
    contentBox.alignmentProperty().set(Pos.CENTER);
    // 设置布局居中
    setAlignment(contentBox,Pos.CENTER);
    getChildren().add(contentBox);
}
 
Example #14
Source File: ProgressIndicatorTest.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
private Parent createRoot() {
	StackPane stackPane = new StackPane();

	BorderPane controlsPane = new BorderPane();
	controlsPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
	stackPane.getChildren().add(controlsPane);
	controlsPane.setCenter(new TableView<Void>());

	ProgressIndicator indicator = new ProgressIndicator();
	indicator.setMaxSize(120, 120);
	stackPane.getChildren().add(indicator);
	StackPane.setAlignment(indicator, Pos.BOTTOM_RIGHT);
	StackPane.setMargin(indicator, new Insets(20));

	return stackPane;
}
 
Example #15
Source File: Board.java    From fx2048 with GNU General Public License v3.0 6 votes vote down vote up
private void createToolBar() {
    // toolbar
    var hPadding = new HBox();
    hPadding.setMinSize(gridWidth, TOOLBAR_HEIGHT);
    hPadding.setPrefSize(gridWidth, TOOLBAR_HEIGHT);
    hPadding.setMaxSize(gridWidth, TOOLBAR_HEIGHT);

    hToolbar.setAlignment(Pos.CENTER);
    hToolbar.getStyleClass().add("game-backGrid");
    hToolbar.setMinSize(gridWidth, TOOLBAR_HEIGHT);
    hToolbar.setPrefSize(gridWidth, TOOLBAR_HEIGHT);
    hToolbar.setMaxSize(gridWidth, TOOLBAR_HEIGHT);

    vGame.getChildren().add(hPadding);
    vGame.getChildren().add(hToolbar);
}
 
Example #16
Source File: ChatController.java    From ChatRoom-JavaFX with Apache License 2.0 6 votes vote down vote up
/**
 * 处理通知信息的显示
 * @param notice
 */
public void addNotification(String notice){
	Platform.runLater(() ->{
		SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");//设置日期格式
		String timer = df.format(new Date());// new Date()为获取当前系统时间
		String content = timer +  ": " + notice;
		BubbledTextFlow noticeBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
		//noticeBubbled.setTextFill(Color.web("#031c30"));
		noticeBubbled.setBackground(new Background(new BackgroundFill(Color.WHITE,
                   null, null)));
           HBox x = new HBox();
           //x.setMaxWidth(chatPaneListView.getWidth() - 20);
           x.setAlignment(Pos.TOP_CENTER);
           noticeBubbled.setBubbleSpec(BubbleSpec.FACE_TOP);
           x.getChildren().addAll(noticeBubbled);
           chatPaneListView.getItems().add(x);
	});
}
 
Example #17
Source File: RotateModule.java    From pdfsam with GNU Affero General Public License v3.0 6 votes vote down vote up
private VBox settingPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);
    VBox.setVgrow(selectionPane, Priority.ALWAYS);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);
    prefix.addMenuItemFor(Prefix.FILENUMBER);
    prefix.addMenuItemFor("[TOTAL_FILESNUMBER]");

    TitledPane options = Views.titledPane(DefaultI18nContext.getInstance().i18n("Rotate settings"), rotateOptions);

    pane.getChildren().addAll(selectionPane, options,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Output settings"), destinationPane),
            prefixTitled);
    return pane;
}
 
Example #18
Source File: LineNumberFactory.java    From RichTextFX with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public Node apply(int idx) {
    Val<String> formatted = nParagraphs.map(n -> format(idx+1, n));

    Label lineNo = new Label();
    lineNo.setFont(DEFAULT_FONT);
    lineNo.setBackground(DEFAULT_BACKGROUND);
    lineNo.setTextFill(DEFAULT_TEXT_FILL);
    lineNo.setPadding(DEFAULT_INSETS);
    lineNo.setAlignment(Pos.TOP_RIGHT);
    lineNo.getStyleClass().add("lineno");

    // bind label's text to a Val that stops observing area's paragraphs
    // when lineNo is removed from scene
    lineNo.textProperty().bind(formatted.conditionOnShowing(lineNo));

    return lineNo;
}
 
Example #19
Source File: ProcessController.java    From tools-ocr with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ProcessController(){
    VBox vBox = new VBox();
    vBox.setAlignment(Pos.BASELINE_CENTER);
    vBox.setMinWidth(300);
    vBox.setBackground(new Background(new BackgroundFill(Color.rgb(250, 250, 250), CornerRadii.EMPTY, Insets.EMPTY)));
    ProgressIndicator progressIndicator = new ProgressIndicator();
    progressIndicator.setStyle(CommUtils.STYLE_TRANSPARENT);
    int circleSize = 75;
    progressIndicator.setMinWidth(circleSize);
    progressIndicator.setMinHeight(circleSize);
    Label topLab = new Label("正在识别图片,请稍等.....");
    topLab.setFont(Font.font(18));
    vBox.setSpacing(10);
    vBox.setPadding(new Insets(20, 0, 20, 0));
    vBox.getChildren().add(progressIndicator);
    vBox.getChildren().add(topLab);
    Scene scene = new Scene(vBox, Color.TRANSPARENT);
    setScene(scene);
    initStyle(StageStyle.TRANSPARENT);
    CommUtils.initStage(this);
}
 
Example #20
Source File: JfxTableEditor.java    From milkman with MIT License 6 votes vote down vote up
public JfxTableEditor() {
	table.setShowRoot(false);
	table.setEditable(true);
	table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

	JavaFxUtils.publishEscToParent(table);
	this.getChildren().add(table);
	addItemBtn = new JFXButton();
	addItemBtn.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
	addItemBtn.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.PLUS, "1.5em"));
	addItemBtn.getStyleClass().add("btn-add-entry");
	StackPane.setAlignment(addItemBtn, Pos.BOTTOM_RIGHT);
	StackPane.setMargin(addItemBtn, new Insets(0, 20, 20, 0));
	this.getChildren().add(addItemBtn);

	final KeyCombination keyCodeCopy = PlatformUtil.getControlKeyCombination(KeyCode.C);
	final KeyCombination keyCodePaste = PlatformUtil.getControlKeyCombination(KeyCode.V);
    table.setOnKeyPressed(event -> {
        if (keyCodeCopy.match(event)) {
            copySelectionToClipboard();
        }
        if (keyCodePaste.match(event)) {
        	pasteSelectionFromClipboard();
        }
    });
}
 
Example #21
Source File: RunUiSamples.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    final BorderPane root = new BorderPane();

    final FlowPane buttons = new FlowPane();
    buttons.setAlignment(Pos.CENTER_LEFT);
    root.setCenter(buttons);
    root.setBottom(makeScreenShot);

    buttons.getChildren().add(new MyButton("AcqButtonTests", new AcqButtonTests()));

    final Scene scene = new Scene(root);

    primaryStage.setTitle(this.getClass().getSimpleName());
    primaryStage.setScene(scene);
    primaryStage.setOnCloseRequest(evt -> System.exit(0));
    primaryStage.show();
}
 
Example #22
Source File: CanvasViewColorsPopup.java    From arma-dialog-creator with MIT License 6 votes vote down vote up
public CanvasViewColorsPopup() {
	super(ArmaDialogCreator.getPrimaryStage(), new VBox(10), null, false, true, false);

	ResourceBundle bundle = Lang.ApplicationBundle();

	setTitle(bundle.getString("Popups.Colors.popup_title"));

	myStage.initStyle(StageStyle.UTILITY);
	setupColorPickers();
	myStage.setMinWidth(400);
	myRootElement.setPadding(new Insets(5, 5, 5, 5));
	myRootElement.setAlignment(Pos.TOP_LEFT);
	myRootElement.getChildren().addAll(
			colorOption(bundle.getString("Popups.Colors.selection"), cpSelection),
			colorOption(bundle.getString("Popups.Colors.abs_region"), cpAbsRegion),
			colorOption(bundle.getString("Popups.Colors.grid"), cpGrid),
			colorOption(bundle.getString("Popups.Colors.background"), cpEditorBg)
	);
}
 
Example #23
Source File: TimeZoneEditorFactory.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
protected Node createEditorControls() {
    final VBox controls = new VBox();
    controls.setSpacing(CONTROLS_DEFAULT_VERTICAL_SPACING);
    controls.setAlignment(Pos.CENTER);

    final ObservableList<ZoneId> timeZones = FXCollections.observableArrayList();
    ZoneId.getAvailableZoneIds().forEach(id -> {
        timeZones.add(ZoneId.of(id));
    });
    timeZoneComboBox = new ComboBox<>();
    timeZoneComboBox.setItems(timeZones.sorted(zoneIdComparator));
    final Callback<ListView<ZoneId>, ListCell<ZoneId>> cellFactory = (final ListView<ZoneId> p) -> new ListCell<ZoneId>() {
        @Override
        protected void updateItem(final ZoneId item, boolean empty) {
            super.updateItem(item, empty);
            if (item != null) {
                setText(TimeZoneUtilities.getTimeZoneAsString(item));
            }
        }
    };
    timeZoneComboBox.setCellFactory(cellFactory);
    timeZoneComboBox.setButtonCell(cellFactory.call(null));
    timeZoneComboBox.getSelectionModel().select(TimeZone.getTimeZone(ZoneOffset.UTC).toZoneId());
    timeZoneComboBox.getSelectionModel().selectedItemProperty().addListener((o, n, v) -> {
        update();
    });

    controls.getChildren().addAll(timeZoneComboBox);
    return controls;
}
 
Example #24
Source File: ADCProjectInitWindow.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
public WorkspaceSelectionStep(@NotNull ADCProjectInitWindow adcProjectInitWindow) {
	super(new VBox(20));
	this.adcProjectInitWindow = adcProjectInitWindow;
	workspaceDirectory = ApplicationProperty.LAST_WORKSPACE.getValue();
	if (workspaceDirectory == null) {
		workspaceDirectory = Workspace.DEFAULT_WORKSPACE_DIRECTORY;
	}

	content.setAlignment(Pos.CENTER);
	content.setMaxWidth(STAGE_WIDTH / 4 * 3);
	final Label lblChooseWorkspace = new Label(bundle.getString("choose_workspace"));
	lblChooseWorkspace.setFont(Font.font(20));
	content.getChildren().add(new VBox(5, lblChooseWorkspace, new Label(bundle.getString("workspace_about"))));

	final FileChooserPane chooserPane = new FileChooserPane(
			ArmaDialogCreator.getPrimaryStage(), FileChooserPane.ChooserType.DIRECTORY,
			lblChooseWorkspace.getText(),
			workspaceDirectory
	);
	chooserPane.setChosenFile(workspaceDirectory);
	chooserPane.getChosenFileObserver().addListener(new ValueListener<File>() {
		@Override
		public void valueUpdated(@NotNull ValueObserver<File> observer, File oldValue, File newValue) {
			if (newValue != null) {
				workspaceDirectory = newValue;
			}
		}
	});
	content.getChildren().add(chooserPane);

}
 
Example #25
Source File: ChatController.java    From ChatRoom-JavaFX with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateItem(UserInfo item, boolean empty) {
	// TODO Auto-generated method stub
	super.updateItem(item, empty);
	setGraphic(null);
          setText(null);
          if (item != null) {

              HBox hBox = new HBox();
              hBox.setSpacing(5); //节点之间的间距

           Text name = new Text(item.getUsername());
           name.setFont(new Font("Arial", 20));//字体样式和大小
           ImageView statusImageView = new ImageView();
           Image statusImage = new Image("images/online.png", 16, 16,true,true);
           statusImageView.setImage(statusImage);

           if(item.getUsername().equals(Utils.ALL)){

           	name.setText("group chat >");
           	statusImageView.setImage(null);
           	//hBox.setStyle("-fx-background-color: #336699;"); //背景色

           }
           ImageView pictureImageView = new ImageView();
           Image image = new Image("images/" + item.getUserpic(),50,50,true,true);
           pictureImageView.setImage(image);

           hBox.getChildren().addAll(statusImageView, pictureImageView, name);
           //hBox.getChildren().addAll(pictureImageView, name);
           hBox.setAlignment(Pos.CENTER_LEFT);
           setGraphic(hBox);
          }
}
 
Example #26
Source File: Notification.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
Notification(String title, Node content) {
    requireNotNullArg(content, "Notification content cannot be blank");
    getStyleClass().add("notification");
    getStyleClass().addAll(Style.CONTAINER.css());
    setId(UUID.randomUUID().toString());
    Button closeButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.TIMES);
    closeButton.getStyleClass().addAll("close-button");
    closeButton.setOnAction(e -> eventStudio().broadcast(new RemoveNotificationRequestEvent(getId())));
    Label titleLabel = new Label(title);
    titleLabel.setPrefWidth(Integer.MAX_VALUE);
    titleLabel.getStyleClass().add("notification-title");
    StackPane top = new StackPane(titleLabel, closeButton);
    top.setAlignment(Pos.TOP_RIGHT);
    getChildren().addAll(top, content);
    setOpacity(0);
    setOnMouseEntered(e -> {
        fade.stop();
        setOpacity(1);
    });
    setOnMouseClicked(e -> {
        setOnMouseEntered(null);
        setOnMouseExited(null);
        fade.stop();
        eventStudio().broadcast(new RemoveNotificationRequestEvent(getId()));
    });
    fade.setFromValue(1);
    fade.setToValue(0);
}
 
Example #27
Source File: BlackLevelGenerator.java    From testing-video with GNU General Public License v3.0 5 votes vote down vote up
private static Label text(Resolution res, ColorMatrix matrix, int col) {
    Label l = new Label(Integer.toString(getLuma(matrix, col)));
    l.setFont(font(res.height / 54));
    l.setTextFill(gray(matrix.fromLumaCode(matrix.YMIN * 4)));
    l.setTextAlignment(TextAlignment.CENTER);
    l.setAlignment(Pos.CENTER);
    l.setPrefSize(getW(res.width, col), getLabelH(res.height));
    return l;
}
 
Example #28
Source File: TradeWizardItem.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public TradeWizardItem(Class<? extends TradeStepView> viewClass, String title, String iconLabel) {
        this.viewClass = viewClass;
        this.iconLabel = iconLabel;

        setMouseTransparent(true);
        setText(title);
//        setPrefHeight(40);
        setPrefWidth(360);
        setAlignment(Pos.CENTER_LEFT);
        setDisabled();
    }
 
Example #29
Source File: CursorSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Node createBox(Cursor cursor) {
    Label label = new Label(cursor.toString());
    label.setAlignment(Pos.CENTER);
    label.setPrefSize(85, 85);
    label.setStyle("-fx-border-color: #aaaaaa; -fx-background-color: #dddddd;");
    label.setCursor(cursor);
    return label;
}
 
Example #30
Source File: Notification.java    From Enzo with Apache License 2.0 5 votes vote down vote up
/**
 * @param STAGE_REF  The Notification will be positioned relative to the given Stage.<br>
 * 					If null then the Notification will be positioned relative to the primary Screen.
 * @param POPUP_LOCATION  The default is TOP_RIGHT of primary Screen.
 */
public static void setPopupLocation(final Stage STAGE_REF, final Pos POPUP_LOCATION) {
    if (null != STAGE_REF) {
        INSTANCE.stage.initOwner(STAGE_REF);
        Notifier.stageRef = STAGE_REF;
    }
    Notifier.popupLocation = POPUP_LOCATION;
}