javafx.geometry.Insets Java Examples

The following examples show how to use javafx.geometry.Insets. 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 Project: Solitaire   Author: prmr   File: SuitStack.java    License: GNU General Public License v2.0 7 votes vote down vote up
SuitStack(FoundationPile pIndex)
{
	aIndex = pIndex;
	setPadding(new Insets(PADDING));
	setStyle(BORDER_STYLE);
	final ImageView image = new ImageView(CardImages.getBack());
   	image.setVisible(false);
      	getChildren().add(image);
   	aDragHandler = new CardDragHandler(image);
   	image.setOnDragDetected(aDragHandler);
   	setOnDragOver(createOnDragOverHandler(image));
   	setOnDragEntered(createOnDragEnteredHandler());
   	setOnDragExited(createOnDragExitedHandler());
   	setOnDragDropped(createOnDragDroppedHandler());
   	GameModel.instance().addListener(this);
}
 
Example #2
Source Project: Medusa   Author: HanSolo   File: DesignClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null);

    // Tick Marks
    tickCanvas.setCache(false);
    drawTicks();
    tickCanvas.setCache(true);
    tickCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setStroke(clock.getHourColor());

    ZonedDateTime time = clock.getTime();

    updateTime(time);
}
 
Example #3
Source Project: paintera   Author: saalfeldlab   File: OverlayPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 */
public OverlayPane()
{
	super();
	super.getChildren().add(canvasPane);
	setBackground(new Background(new BackgroundFill(Color.BLACK.deriveColor(0.0, 1.0, 1.0, 0.0), CornerRadii.EMPTY, Insets.EMPTY)));

	this.overlayRenderers = new CopyOnWriteArrayList<>();

	final ChangeListener<Number> sizeChangeListener = (observable, oldValue, newValue)
			-> {
		final double wd = widthProperty().get();
		final double hd = heightProperty().get();
		final int    w  = (int) wd;
		final int    h  = (int) hd;
		if (w <= 0 || h <= 0)
			return;
		overlayRenderers.forEach(or -> or.setCanvasSize(w, h));
		layout();
		drawOverlays();
	};

	widthProperty().addListener(sizeChangeListener);
	heightProperty().addListener(sizeChangeListener);

}
 
Example #4
Source Project: xframium-java   Author: xframium   File: OptionStage.java    License: GNU General Public License v3.0 6 votes vote down vote up
private HBox buttons ()
{
  HBox hbox = new HBox (10);
  hbox.setAlignment (Pos.CENTER);

  okButton.setDefaultButton (true);
  okButton.setPrefWidth (80);

  cancelButton.setCancelButton (true);
  cancelButton.setPrefWidth (80);

  hbox.getChildren ().addAll (cancelButton, okButton);
  hbox.setPadding (new Insets (10, 10, 10, 10));

  return hbox;
}
 
Example #5
Source Project: ChatRoom-JavaFX   Author: Laity000   File: EmojiDisplayer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 创建emoji图片节点
 *
 * @param emoji
 *            emoji
 * @param size
 *            图片显示大小
 * @param pad
 *            图片间距
 * @param isCursor
 *            是否需要图片光标及鼠标处理事件
 * @return
 */
public static Node createEmojiNode(Emoji emoji, int size, int pad) {
	// 将表情放到stackpane中
	StackPane stackPane = new StackPane();
	stackPane.setMaxSize(size, size);
	stackPane.setPrefSize(size, size);
	stackPane.setMinSize(size, size);
	stackPane.setPadding(new Insets(pad));
	ImageView imageView = new ImageView();
	imageView.setFitWidth(size);
	imageView.setFitHeight(size);
	imageView.setImage(ImageCache.getInstance().getImage(getEmojiImagePath(emoji.getHex())));
	stackPane.getChildren().add(imageView);

	return stackPane;
}
 
Example #6
Source Project: bisq   Author: bisq-network   File: FormBuilder.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
                                                             int rowIndex,
                                                             String title1,
                                                             String title2,
                                                             double top) {
    Label label1 = addLabel(gridPane, rowIndex, title1);
    label1.getStyleClass().add("confirmation-label");
    Label label2 = addLabel(gridPane, rowIndex, title2);
    label2.getStyleClass().add("confirmation-value");
    GridPane.setColumnIndex(label2, 1);
    GridPane.setMargin(label1, new Insets(top, 0, 0, 0));
    GridPane.setHalignment(label1, HPos.LEFT);
    GridPane.setMargin(label2, new Insets(top, 0, 0, 0));

    return new Tuple2<>(label1, label2);
}
 
Example #7
Source Project: oim-fx   Author: oimchat   File: ImageFrame.java    License: MIT License 6 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);
	
	Image image=new Image("com/javafx/demo/only/wallpaper1.jpg");
	ImageView iv=new ImageView(image);
	
	
	rootPane.setPadding(new Insets(30, 0, 0, 0));
	rootPane.getChildren().add(rootVBox);
	
	Button button=new Button("",iv);
	rootVBox.getChildren().add(button);
}
 
Example #8
Source Project: chuidiang-ejemplos   Author: chuidiang   File: Example1.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
private void buildAndShowMainWindow(Stage primaryStage) {
    primaryStage.setTitle("Hello World!!");
    GridPane gridPane = new GridPane();
    gridPane.setAlignment(Pos.CENTER);
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.setPadding(new Insets(25, 25, 25, 25));

    button = new Button("Click me!");
    gridPane.add(button,1,1);

    text = new TextField();
    gridPane.add(text, 2, 1);

    clockLabel = new Label();
    gridPane.add(clockLabel, 1,2, 2, 1);

    Scene scene = new Scene(gridPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example #9
Source Project: examples-javafx-repos1   Author: bekwam   File: GetDataDialog.java    License: Apache License 2.0 6 votes vote down vote up
public void init() {
    vbox = new VBox();
    vbox.setSpacing(20.0d);
    vbox.setPadding(new Insets(10.0d));

    TextField tf = new TextField();

    Button btn = new Button("Submit");
    btn.setOnAction( (evt) -> {
        data = tf.getText();
        ((Button)evt.getSource()).getScene().getWindow().hide();
    } );

    vbox.getChildren().add(new Label("Enter Data"));
    vbox.getChildren().add(tf);
    vbox.getChildren().add(btn);
}
 
Example #10
Source Project: bisq   Author: bisq-network   File: FormBuilder.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
public static <T> Tuple3<Label, ComboBox<T>, TextField> addLabelComboBoxLabel(GridPane gridPane,
                                                                              int rowIndex,
                                                                              String title,
                                                                              String textFieldText,
                                                                              double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    HBox hBox = new HBox();
    hBox.setSpacing(10);

    ComboBox<T> comboBox = new JFXComboBox<>();
    TextField textField = new TextField(textFieldText);
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);

    hBox.getChildren().addAll(comboBox, textField);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(hBox);

    return new Tuple3<>(label, comboBox, textField);
}
 
Example #11
Source Project: phoebus   Author: ControlSystemStudio   File: TextSymbolRepresentation.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Label createJFXNode ( ) throws Exception {

    Label symbol = new Label();

    symbol.setAlignment(JFXUtil.computePos(model_widget.propHorizontalAlignment().getValue(), model_widget.propVerticalAlignment().getValue()));
    symbol.setBackground(model_widget.propTransparent().getValue()
        ? null
        : new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY))
    );
    symbol.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
    symbol.setTextFill(JFXUtil.convert(model_widget.propForegroundColor().getValue()));
    symbol.setText("\u263A");

    enabled = model_widget.propEnabled().getValue();

    Styles.update(symbol, Styles.NOT_ENABLED, !enabled);

    return symbol;

}
 
Example #12
Source Project: BlockMap   Author: Minecraft-Technik-Wiki   File: AutoCompleteItem.java    License: MIT License 6 votes vote down vote up
public AutoCompleteItem() {
	name = new Label();
	name.setAlignment(Pos.CENTER_LEFT);
	name.setStyle("-fx-font-weight: bold;");

	path = new Label();
	path.setMaxWidth(Double.POSITIVE_INFINITY);
	HBox.setHgrow(path, Priority.ALWAYS);
	HBox.setMargin(path, new Insets(0, 8, 0, 0));
	path.setAlignment(Pos.CENTER_RIGHT);
	path.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);

	graphic = new ImageView();
	graphic.setPreserveRatio(true);
	graphic.fitHeightProperty().bind(Bindings.createDoubleBinding(() -> name.getFont().getSize() * 1.2, name.fontProperty()));

	setText(null);
	setGraphic(new HBox(2, graphic, name, path));
	setPrefWidth(0);
}
 
Example #13
Source Project: arma-dialog-creator   Author: kayler-renslow   File: ControlPropertiesEditorPane.java    License: MIT License 6 votes vote down vote up
/** @return a titled pane for the accordion that holds all properties of a certain {@link ConfigPropertyCategory} */
@NotNull
private PlaceholderTitledPane getPropertiesTitledPane(@NotNull String title, @NotNull ConfigPropertyCategory category) {
	final VBox vb = new VBox(10);
	vb.setFillWidth(true);
	vb.setPadding(new Insets(5));
	final Label lblNoProps = new Label(bundle.getString("ControlPropertiesConfig.no_properties_available"));
	final PlaceholderTitledPane tp = new PlaceholderTitledPane(title, lblNoProps, vb, true);
	final ScrollPane scrollPane = tp.getScrollPane();
	if (scrollPane != null) {
		scrollPane.setFitToWidth(true);
		scrollPane.setStyle("-fx-background-color:transparent");
	}
	tp.setAnimated(false);

	return tp;
}
 
Example #14
Source Project: arma-dialog-creator   Author: kayler-renslow   File: CanvasViewColorsPopup.java    License: 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 #15
Source Project: FXMaps   Author: fxpresso   File: DirectionsPane.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Adds a notification located at the top of the vertical pane, which 
 * displays warning or other information about the current API state.
 * (i.e. if its in Beta etc.)
 * 
 * @param message   the message to display
 */
public void addDirectionsBulletinPane(String message) {
    Label l = new Label(message);
    l.setBackground(new Background(
        new BackgroundFill(
            Color.color(
                Color.YELLOW.getRed(), 
                Color.YELLOW.getGreen(), 
                Color.YELLOW.getBlue(), 0.4d),
            new CornerRadii(5), 
            null)));
    l.setWrapText(true);
    l.setPrefWidth(200);
    l.setPadding(new Insets(5,5,5,5));
    directionsBox.getChildren().add(l);
}
 
Example #16
Source Project: mars-sim   Author: mars-sim   File: ProgressIndicatorTest.java    License: 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 #17
Source Project: Medusa   Author: HanSolo   File: SlimSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    titleText.setText(gauge.getTitle());
    unitText.setText(gauge.getUnit());
    resizeStaticText();

    barBackground.setStroke(gauge.getBarBackgroundColor());
    setBarColor(gauge.getCurrentValue());
    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
}
 
Example #18
Source Project: bisq   Author: bisq-network   File: VoteResultView.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void initialize() {
    gridRow = phasesView.addGroup(root, gridRow);

    selectedVoteResultListItemListener = (observable, oldValue, newValue) -> onResultsListItemSelected(newValue);

    createCyclesTable();
    exportButton = addButton(root, ++gridRow, Res.get("shared.exportJSON"));
    exportButton.getStyleClass().add("text-button");
    GridPane.setMargin(exportButton, new Insets(10, -10, -50, 0));
    GridPane.setColumnSpan(exportButton, 2);
    GridPane.setHalignment(exportButton, HPos.RIGHT);

    proposalResultsWindow.onClose(() -> proposalsTableView.getSelectionModel().clearSelection());
}
 
Example #19
Source Project: xframium-java   Author: xframium   File: SpyPane.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected VBox getVBox ()
{
  VBox vbox = new VBox ();
  vbox.setSpacing (15);
  vbox.setPadding (new Insets (10, 10, 10, 10));    // trbl
  return vbox;
}
 
Example #20
Source Project: chart-fx   Author: GSI-CS-CO   File: SidesPane.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void set(Node node) {
    if (node instanceof Region) {
        ((Region) node).setPadding(Insets.EMPTY);
        ((Region) node).setPrefHeight(-1);
        ((Region) node).setMinHeight(0);
        ((Region) node).setPrefWidth(-1);
        ((Region) node).setMinWidth(0);
    }
    super.set(node);
}
 
Example #21
Source Project: helloiot   Author: adrianromero   File: ViewNumberChart.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Node constructContent() {
    VBox vboxroot = new VBox();
    vboxroot.setSpacing(10.0);   
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    level = new Label();
    level.setAlignment(Pos.CENTER_RIGHT);
    level.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    level.getStyleClass().add("unitmaintext");
    HBox.setHgrow(level, Priority.SOMETIMES);
    
    boxview.getChildren().add(level);
    
    areachart = new ChartNode();
    StackPane chart = areachart.getNode();
    chart.setMinSize(40.0, 50.0);
    chart.setPrefSize(40.0, 50.0);
    chart.setPadding(Insets.EMPTY);
    
    StackPane stack = new StackPane(chart);
    VBox.setVgrow(stack, Priority.SOMETIMES);   
    stack.setPadding(new Insets(0.0, 0.0, 0.0, 3.0));
    vboxroot.getChildren().addAll(boxview, stack);
    
    initialize();
    return vboxroot;
}
 
Example #22
Source Project: bisq   Author: bisq-network   File: TakeOfferView.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
private VBox getTradeFeeFieldsBox() {
    tradeFeeInBtcLabel = new Label();
    tradeFeeInBtcLabel.setMouseTransparent(true);
    tradeFeeInBtcLabel.setId("trade-fee-textfield");

    tradeFeeInBsqLabel = new Label();
    tradeFeeInBsqLabel.setMouseTransparent(true);
    tradeFeeInBsqLabel.setId("trade-fee-textfield");

    VBox vBox = new VBox();
    vBox.setSpacing(6);
    vBox.setMaxWidth(300);
    vBox.setAlignment(DevEnv.isDaoActivated() ? Pos.CENTER_RIGHT : Pos.CENTER_LEFT);
    vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);

    tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBtcToggle.setText("BTC");
    tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));

    tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBsqToggle.setText("BSQ");
    tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));

    VBox tradeFeeToggleButtonBox = new VBox();
    tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);

    HBox hBox = new HBox();
    hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
    hBox.setMinHeight(47);
    hBox.setMaxHeight(hBox.getMinHeight());
    HBox.setHgrow(vBox, Priority.ALWAYS);
    HBox.setHgrow(tradeFeeToggleButtonBox, Priority.NEVER);

    final Tuple2<Label, VBox> tradeInputBox = getTradeInputBox(hBox, Res.get("createOffer.tradeFee.descriptionBSQEnabled"));

    tradeFeeDescriptionLabel = tradeInputBox.first;

    return tradeInputBox.second;
}
 
Example #23
Source Project: Medusa   Author: HanSolo   File: DigitalClockSkin.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * height))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    ZonedDateTime time = clock.getTime();

    textColor  = clock.getTextColor();
    dateColor  = clock.getDateColor();
    alarmColor = clock.getAlarmColor();

    drawTime(time);
}
 
Example #24
Source Project: arma-dialog-creator   Author: kayler-renslow   File: ConfigPropertyEditor.java    License: MIT License 5 votes vote down vote up
/**
 Resets the the current value editor. The new value editor will be what {@link #constructNewPropertyValueEditor()}
 returns.
 <p>
 Before invoking this method, be sure to clear the listeners of {@link #propertyValueEditor} with
 {@link ConfigPropertyValueEditor#clearListeners()}.
 */
private void resetPropertyValueEditor() {
	if (propertyValueEditor != null) {
		propertyValueEditor.clearListeners();
	}
	propertyValueEditor = constructNewPropertyValueEditor();
	HBox.setHgrow(stackPanePropertyInput, propertyValueEditor.displayFullWidth() ?
			Priority.ALWAYS : Priority.NEVER
	);
	stackPanePropertyInput.getChildren().setAll(propertyValueEditor.getRootNode());
	if (configProperty.getValue() instanceof SVRaw) {
		if (configProperty.getValueOptions().length == 0) {
			stackPanePropertyInput.setPadding(new Insets(1));
			stackPanePropertyInput.setBorder(
					new Border(
							new BorderStroke(
									Color.DARKORANGE,
									BorderStrokeStyle.DASHED,
									CornerRadii.EMPTY,
									BorderStroke.THIN
							)
					)
			);
		}
	} else {
		stackPanePropertyInput.setBorder(null);
		stackPanePropertyInput.setPadding(Insets.EMPTY);
	}

	updateEditModeFromProperty();
	updateContainerInheritanceTint();
}
 
Example #25
Source Project: SmartModInserter   Author: narrowtux   File: SavesTabController.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void init() {
    tab.setContent(root);
    saves.setItems(store.getSaves());
    saves.setCellFactory(saveListView -> {
        return new ListCell<Save>() {
            @Override
            protected void updateItem(Save save, boolean empty) {
                Runnable r = () -> {
                    super.updateItem(save, empty);
                    if (!empty) {
                        setText(null);
                        GridPane pane = new GridPane();
                        pane.setHgap(10);
                        pane.setVgap(4);
                        pane.setPadding(new Insets(0, 10, 0, 10));
                        ImageView screenshot = new ImageView(save.getScreenshot());
                        screenshot.setPreserveRatio(true);
                        screenshot.setFitWidth(75);
                        pane.add(screenshot, 0, 0, 1, 2);
                        Label name = new Label(save.getName());
                        Label fileName = new Label(save.getPath().getFileName().toString());
                        pane.add(name, 1, 0, 1, 1);
                        pane.add(fileName, 1, 1, 1, 1);
                        setGraphic(pane);
                    }
                };

                if (Platform.isFxApplicationThread()) {
                    r.run();
                } else {
                    Platform.runLater(r);
                }
            }
        };
    });
}
 
Example #26
Source Project: bisq   Author: bisq-network   File: TakeOfferView.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
private Label createPopoverLabel(String text) {
    final Label label = new Label(text);
    label.setPrefWidth(300);
    label.setWrapText(true);
    label.setPadding(new Insets(10));
    return label;
}
 
Example #27
Source Project: mars-sim   Author: mars-sim   File: MainScene.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
	 * Create the tool windows tool bar
	 */
	public void createJFXToolbar() {
//		JFXButton b0 = new JFXButton("Help");
		JFXButton b1 = new JFXButton("Search");
		JFXButton b2 = new JFXButton("Time");
		JFXButton b3 = new JFXButton("Monitor");
		JFXButton b4 = new JFXButton("Mission");
		JFXButton b5 = new JFXButton("Science");
		JFXButton b6 = new JFXButton("Resupply");

//		setQuickToolTip(b0, "Open Help Browser");
		setQuickToolTip(b1, "Search Box");
		setQuickToolTip(b2, "Time Tool");
		setQuickToolTip(b3, "Monitor Tool");
		setQuickToolTip(b4, "Mission Wizard");
		setQuickToolTip(b5, "Science Tool");
		setQuickToolTip(b6, "Resupply Tool");

		toolbar = new HBox();
		toolbar.setPadding(new Insets(5,5,5,5));
//		toolbar.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
		toolbar.getChildren().addAll(b1, b2, b3, b4, b5, b6);

//		b0.setOnAction(e -> desktop.openToolWindow(GuideWindow.NAME));
		b1.setOnAction(e -> desktop.openToolWindow(SearchWindow.NAME));
		b2.setOnAction(e -> desktop.openToolWindow(TimeWindow.NAME));
		b3.setOnAction(e -> desktop.openToolWindow(MonitorWindow.NAME));
		b4.setOnAction(e -> desktop.openToolWindow(MissionWindow.NAME));
		b5.setOnAction(e -> desktop.openToolWindow(ScienceWindow.NAME));
		b6.setOnAction(e -> desktop.openToolWindow(ResupplyWindow.NAME));

//		b0.setOnAction(toolbarHandler);		
//		EventHandler<ActionEvent> toolbarHandler = new EventHandler<ActionEvent>() {
//			public void handle(ActionEvent ae) {
//				String s = ((JFXButton)ae.getTarget()).getText();		
//			}
//		}
	}
 
Example #28
Source Project: marathonv5   Author: jalian-systems   File: TextValidatorSample.java    License: Apache License 2.0 5 votes vote down vote up
public TextValidatorSample() {
    String validatorCss = TextValidatorSample.class.getResource("Validators.css").toExternalForm();
    
    TextField dateField = new TextField();
    dateField.setPromptText("Enter a Large Number");
    dateField.setMaxHeight(TextField.USE_PREF_SIZE);

    TextInputValidatorPane<TextField> pane = new TextInputValidatorPane<TextField>();
    pane.setContent(dateField);
    pane.setValidator(new Validator<TextField>() {
        public ValidationResult validate(TextField control) {
            try {
                String text = control.getText();
                if (text == null || text.trim().equals("")) return null;
                double d = Double.parseDouble(text);
                if (d < 1000) {
                    return new ValidationResult("Should be > 1000", ValidationResult.Type.WARNING);
                }
                return null; // succeeded
            } catch (Exception e) {
                // failed
                return new ValidationResult("Bad number", ValidationResult.Type.ERROR);
            }
        }
    });

    StackPane rootSP = new StackPane();
    rootSP.setPadding(new Insets(12));
    rootSP.getChildren().add(pane);
    pane.getStylesheets().add(validatorCss);
    getChildren().add(rootSP);
}
 
Example #29
Source Project: oim-fx   Author: oimchat   File: TitleListNodePane.java    License: MIT License 5 votes vote down vote up
private void initComponent() {

		textLabel.setStyle("-fx-text-fill:#787b87;-fx-font-size: 14px;");
		
		HBox textHBox = new HBox();
		textHBox.setStyle("-fx-background-color:rgba(240,240,240,0.8);");
		textHBox.setPadding(new Insets(4, 0, 4, 20));
		textHBox.getChildren().add(textLabel);
		
		this.setTop(textHBox);
		this.setCenter(centerVBox);
		this.setStyle("-fx-background-color:rgba(250,250,250,0.8);");
	}
 
Example #30
Source Project: Medusa   Author: HanSolo   File: TextClockSkin.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * height))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    ZonedDateTime time = clock.getTime();

    dateFormat = Helper.getDateFormat(clock.getLocale());

    textColor  = clock.getTextColor();
    timeText.setFill(textColor);

    dateColor  = clock.getDateColor();
    dateText.setFill(dateColor);

    drawTime(time);
}