Java Code Examples for javafx.scene.layout.HBox#setPadding()

The following examples show how to use javafx.scene.layout.HBox#setPadding() . 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: CustomGaugeSkinDemo.java    From medusademo with Apache License 2.0 7 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(gauge0, gauge1, gauge2, gauge3, gauge4, gauge5, gauge6, gauge7, gauge8, gauge9);
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(10));
    pane.setPrefWidth(400);

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Custom Gauge Skin");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 2
Source File: DemoSimpleGauge.java    From Enzo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) throws Exception {
    HBox pane = new HBox();
    pane.setPadding(new Insets(10, 10, 10, 10));
    pane.setSpacing(10);
    pane.getChildren().addAll(thermoMeter, wattMeter, energyMeter);

    final Scene scene = new Scene(pane, Color.BLACK);
    //scene.setFullScreen(true);

    stage.setTitle("SimpleGauge");
    stage.setScene(scene);
    stage.show();

    wattMeter.setValue(50);

    timer.start();

    calcNoOfNodes(scene.getRoot());
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 3
Source File: VertexTypeNodeProvider.java    From constellation with Apache License 2.0 6 votes vote down vote up
private VBox addFilter() {
    filterText.setPromptText("Filter Node types");
    final ToggleGroup toggleGroup = new ToggleGroup();
    startsWithRb.setToggleGroup(toggleGroup);
    startsWithRb.setPadding(new Insets(0, 0, 0, 5));
    startsWithRb.setSelected(true);
    final RadioButton containsRadioButton = new RadioButton("Contains");
    containsRadioButton.setToggleGroup(toggleGroup);
    containsRadioButton.setPadding(new Insets(0, 0, 0, 5));

    toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
        populateTree();
    });

    filterText.textProperty().addListener((observable, oldValue, newValue) -> {
        populateTree();
    });

    final HBox headerBox = new HBox(new Label("Filter: "), filterText, startsWithRb, containsRadioButton);
    headerBox.setAlignment(Pos.CENTER_LEFT);
    headerBox.setPadding(new Insets(5));

    final VBox box = new VBox(schemaLabel, headerBox, treeView);
    VBox.setVgrow(treeView, Priority.ALWAYS);
    return box;
}
 
Example 4
Source File: KeyboardExample.java    From JavaFX with MIT License 5 votes vote down vote up
public Node createNode() {
	final HBox keyboardNode = new HBox(6);
	keyboardNode.setPadding(new Insets(6));

	final List<Node> keyboardNodeChildren = keyboardNode.getChildren();
	for (final Key key : keys) {
		keyboardNodeChildren.add(key.createNode());
	}

	installEventHandler(keyboardNode);
	return keyboardNode;
}
 
Example 5
Source File: PreferencesStage.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
protected Node buttons()
{
  HBox box = new HBox(10.0D);
  this.saveButton = new Button("Save");
  this.saveButton.setDefaultButton(true);
  this.cancelButton = new Button("Cancel");
  this.cancelButton.setCancelButton(true);
  this.saveButton.setPrefWidth(80.0D);
  this.cancelButton.setPrefWidth(80.0D);
  box.getChildren().addAll(new Node[] { this.cancelButton, this.saveButton });
  box.setAlignment(Pos.BASELINE_CENTER);
  box.setPadding(new Insets(10.0D, 10.0D, 10.0D, 10.0D));
  return box;
}
 
Example 6
Source File: FGaugeDemo.java    From medusademo with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(fGauge, button);
    pane.setPadding(new Insets(10));
    pane.setSpacing(20);

    Scene scene = new Scene(pane);

    stage.setTitle("FGauge Demo");
    stage.setScene(scene);
    stage.show();
}
 
Example 7
Source File: ChoiceBoxSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    scene.setFill(Color.ALICEBLUE);
    stage.setScene(scene);
    stage.show();

    stage.setTitle("ChoiceBox Sample");
    stage.setWidth(300);
    stage.setHeight(200);

    label.setFont(Font.font("Arial", 25));
    label.setLayoutX(40);

    final String[] greetings = new String[] { "Hello", "Hola", "Привет", "你好", "こんにちは" };
    final ChoiceBox cb = new ChoiceBox(FXCollections.observableArrayList("English", "Español", "Русский", "简体中文", "日本語"));

    cb.getSelectionModel().selectedIndexProperty()
            .addListener((ObservableValue<? extends Number> ov, Number old_val, Number new_val) -> {
                label.setText(greetings[new_val.intValue()]);
            });

    cb.setTooltip(new Tooltip("Select the language"));
    cb.setValue("English");
    HBox hb = new HBox();
    hb.getChildren().addAll(cb, label);
    hb.setSpacing(30);
    hb.setAlignment(Pos.CENTER);
    hb.setPadding(new Insets(10, 0, 0, 10));

    ((Group) scene.getRoot()).getChildren().add(hb);

}
 
Example 8
Source File: TooltipSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(330);
    stage.setHeight(150);

    total.setFont(new Font("Arial", 20));

    for (int i = 0; i < rooms.length; i++) {
        final CheckBox cb = cbs[i] = new CheckBox(rooms[i]);
        final Integer rate = rates[i];
        final Tooltip tooltip = new Tooltip("$" + rates[i].toString());
        tooltip.setFont(new Font("Arial", 16));
        cb.setTooltip(tooltip);
        cb.selectedProperty().addListener((ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) -> {
            if (cb.isSelected()) {
                sum = sum + rate;
            } else {
                sum = sum - rate;
            }
            total.setText("Total: $" + sum.toString());
        });
    }

    VBox vbox = new VBox();
    vbox.getChildren().addAll(cbs);
    vbox.setSpacing(5);
    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(total);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

    ((Group) scene.getRoot()).getChildren().add(root);

    stage.setScene(scene);
    stage.show();
}
 
Example 9
Source File: SettingsView.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
private HBox settingsViewLeft() {
    HBox hBox = Styler.hContainer(20);
    hBox.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    hBox.setId("clientBuilder");
    hBox.setPadding(new Insets(20, 20, 20, 20));
    Label title = (Label) Styler.styleAdd(new Label("Settings"), "title");
    hBox.getChildren().add(Styler.vContainer(20, title));
    return hBox;
}
 
Example 10
Source File: ConsolePane.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
private HBox getHBox (Insets insets, Pos alignment)
{
  HBox hbox = new HBox ();
  hbox.setPadding (insets);
  hbox.setSpacing (10);
  hbox.setAlignment (alignment);
  return hbox;
}
 
Example 11
Source File: Viewer3d.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** @param disabled Disable mouse interaction?
 *  @throws Exception on error
 */
public Viewer3d (final boolean disabled) throws Exception
{
    axes = buildAxes();
    view.getChildren().add(axes);

    root = new Group(view);
    root.setDepthTest(DepthTest.ENABLE);

    scene = new SubScene(root, 1024, 768, true, SceneAntialiasing.BALANCED);
    scene.setManaged(false);
    scene.setFill(Color.GRAY);
    scene.heightProperty().bind(heightProperty());
    scene.widthProperty().bind(widthProperty());

    buildCamera();

    scene.setCamera(camera);

    // Legend, placed on top of 3D scene
    final HBox legend = new HBox(10, createAxisLabel("X Axis", Color.RED),
            createAxisLabel("Y Axis", Color.GREEN),
            createAxisLabel("Z Axis", Color.BLUE));
    legend.setPadding(new Insets(10));

    getChildren().setAll(scene, legend);

    if (! disabled)
        handleMouse(this);
}
 
Example 12
Source File: TradeStepView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private GridPane createInfoPopover() {
    GridPane infoGridPane = new GridPane();
    int rowIndex = 0;
    infoGridPane.setHgap(5);
    infoGridPane.setVgap(10);
    infoGridPane.setPadding(new Insets(10, 10, 10, 10));
    Label label = addMultilineLabel(infoGridPane, rowIndex++, Res.get("portfolio.pending.tradePeriodInfo"));
    label.setMaxWidth(450);

    HBox warningBox = new HBox();
    warningBox.setMinHeight(30);
    warningBox.setPadding(new Insets(5));
    warningBox.getStyleClass().add("warning-box");
    GridPane.setRowIndex(warningBox, rowIndex);
    GridPane.setColumnSpan(warningBox, 2);

    Label warningIcon = new Label();
    AwesomeDude.setIcon(warningIcon, AwesomeIcon.WARNING_SIGN);
    warningIcon.getStyleClass().add("warning");

    Label warning = new Label(Res.get("portfolio.pending.tradePeriodWarning"));
    warning.setWrapText(true);
    warning.setMaxWidth(410);

    warningBox.getChildren().addAll(warningIcon, warning);
    infoGridPane.getChildren().add(warningBox);

    return infoGridPane;
}
 
Example 13
Source File: MainScene.java    From mars-sim with 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 14
Source File: Palette.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
/** Create UI elements
 *  @return Top-level Node of the UI
 */
@SuppressWarnings("unchecked")
public Node create()
{
    final VBox palette = new VBox();

    final Map<WidgetCategory, Pane> palette_groups = createWidgetCategoryPanes(palette);
    groups = palette_groups.values();
    createWidgetEntries(palette_groups);

    final ScrollPane palette_scroll = new ScrollPane(palette);
    palette_scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
    palette_scroll.setFitToWidth(true);

    // TODO Determine the correct size for the main node
    // Using 2*PREFERRED_WIDTH was determined by trial and error
    palette_scroll.setMinWidth(PREFERRED_WIDTH + 12);
    palette_scroll.setPrefWidth(PREFERRED_WIDTH);

    // Copy the widgets, i.e. the children of each palette_group,
    // to the userData.
    // Actual children are now updated based on search by widget name
    palette_groups.values().forEach(group -> group.setUserData(new ArrayList<Node>(group.getChildren())));

    final TextField searchField = new ClearingTextField();
    searchField.setPromptText(Messages.SearchTextField);
    searchField.setTooltip(new Tooltip(Messages.WidgetFilterTT));
    searchField.setPrefColumnCount(9);
    searchField.textProperty().addListener( ( observable, oldValue, search_text ) ->
    {
        final String search = search_text.toLowerCase().trim();
        palette_groups.values().stream().forEach(group ->
        {
            group.getChildren().clear();
            final List<Node> all_widgets = (List<Node>)group.getUserData();
            if (search.isEmpty())
                group.getChildren().setAll(all_widgets);
            else
                group.getChildren().setAll(all_widgets.stream()
                                                      .filter(node ->
                                                      {
                                                         final String text = ((ToggleButton) node).getText().toLowerCase();
                                                         return text.contains(search);
                                                      })
                                                     .collect(Collectors.toList()));
        });
    });
    HBox.setHgrow(searchField, Priority.NEVER);

    final HBox toolsPane = new HBox(6);
    toolsPane.setAlignment(Pos.CENTER_RIGHT);
    toolsPane.setPadding(new Insets(6));
    toolsPane.getChildren().add(searchField);

    BorderPane paletteContainer = new BorderPane();
    paletteContainer.setTop(toolsPane);
    paletteContainer.setCenter(palette_scroll);

    return paletteContainer;
}
 
Example 15
Source File: SearchView.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
/** Create search view
 *
 *  <p>While technically a {@link SplitPane},
 *  should be treated as generic {@link Node},
 *  using only the API defined in here
 *
 *  @param model
 *  @param undo
 */
public SearchView(final Model model, final UndoableActionManager undo)
{
    this.model = model;
    this.undo = undo;

    // Archive List

    // Pattern: ____________ [Search]
    pattern.setTooltip(new Tooltip(Messages.SearchPatternTT));
    pattern.setMaxWidth(Double.MAX_VALUE);
    HBox.setHgrow(pattern, Priority.ALWAYS);
    final Button search = new Button(Messages.Search);
    search.setTooltip(new Tooltip(Messages.SearchTT));
    final HBox search_row = new HBox(5.0, new Label(Messages.SearchPattern), pattern, search);
    search_row.setAlignment(Pos.CENTER_LEFT);
    pattern.setOnAction(event -> searchForChannels());
    search.setOnAction(event -> searchForChannels());

    //  ( ) Add .. (x) Replace search result
    final RadioButton result_add = new RadioButton(Messages.AppendSearchResults);
    result_add.setTooltip(new Tooltip(Messages.AppendSearchResultsTT));
    result_replace = new RadioButton(Messages.ReplaceSearchResults);
    result_replace.setTooltip(new Tooltip(Messages.ReplaceSearchResultsTT));
    final ToggleGroup result_handling = new ToggleGroup();
    result_add.setToggleGroup(result_handling);
    result_replace.setToggleGroup(result_handling);
    result_replace.setSelected(true);
    final HBox replace_row = new HBox(5.0, result_add, result_replace);
    replace_row.setAlignment(Pos.CENTER_RIGHT);

    // PV Name  |  Source
    // ---------+--------
    //          |
    final TableColumn<ChannelInfo, String> pv_col = new TableColumn<>(Messages.PVName);
    pv_col.setCellValueFactory(cell ->  new SimpleStringProperty(cell.getValue().getName()));
    pv_col.setReorderable(false);
    channel_table.getColumns().add(pv_col);

    final TableColumn<ChannelInfo, String> archive_col = new TableColumn<>(Messages.ArchiveName);
    archive_col.setCellValueFactory(cell ->  new SimpleStringProperty(cell.getValue().getArchiveDataSource().getName()));
    archive_col.setReorderable(false);
    channel_table.getColumns().add(archive_col);
    channel_table.setPlaceholder(new Label(Messages.SearchPatternTT));

    // PV name column uses most of the space, archive column the rest
    pv_col.prefWidthProperty().bind(channel_table.widthProperty().multiply(0.8));
    archive_col.prefWidthProperty().bind(channel_table.widthProperty().subtract(pv_col.widthProperty()));

    channel_table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    VBox.setVgrow(channel_table, Priority.ALWAYS);
    search_row.setPadding(new Insets(5, 5, 0, 5));
    replace_row.setPadding(new Insets(5, 5, 0, 5));
    final VBox bottom = new VBox(5, search_row,
                                    replace_row,
                                    channel_table);
    setOrientation(Orientation.VERTICAL);
    getItems().setAll(archive_list, bottom);
    setDividerPositions(0.2f);

    final ContextMenu menu = new ContextMenu();
    channel_table.setContextMenu(menu);
    channel_table.setOnContextMenuRequested(this::updateContextMenu);

    setupDrag();

    Platform.runLater(() -> pattern.requestFocus());
}
 
Example 16
Source File: ChatPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {

		textLabel.setStyle("-fx-font-size: 16px;");

		HBox line = new HBox();
		line.setMinHeight(1);
		line.setStyle("-fx-background-color:#d6d6d6;");

		middleToolBarBox.setPadding(new Insets(10, 0, 0, 20));
		middleToolBarBox.setMinHeight(25);
		middleToolBarBox.setSpacing(10);
		middleToolBarBox.setAlignment(Pos.CENTER_LEFT);

		VBox writeTempBox = new VBox();

		writeTempBox.getChildren().add(line);
		writeTempBox.getChildren().add(middleToolBarBox);

		chatShowPane.setStyle("-fx-background-color:#f5f5f5;");
		writeBorderPane.setStyle("-fx-background-color:#ffffff;");

		writeBorderPane.setTop(writeTempBox);
		writeBorderPane.setCenter(chatWritePane);

		splitPane.setTop(chatShowPane);
		splitPane.setBottom(writeBorderPane);
		splitPane.setPrefWidth(780);

		HBox textHBox = new HBox();
		textHBox.setPadding(new Insets(28, 0, 15, 28));
		textHBox.setAlignment(Pos.CENTER_LEFT);
		textHBox.getChildren().add(textLabel);

		topRightButtonBox.setAlignment(Pos.CENTER_RIGHT);
		topRightButtonBox.setPadding(new Insets(25, 20, 0, 0));

		VBox topRightButtonVBox = new VBox();
		topRightButtonVBox.setAlignment(Pos.CENTER);
		topRightButtonVBox.getChildren().add(topRightButtonBox);

		BorderPane topBorderPane = new BorderPane();
		topBorderPane.setCenter(textHBox);
		topBorderPane.setRight(topRightButtonVBox);

		HBox topLine = new HBox();
		topLine.setMinHeight(1);
		topLine.setStyle("-fx-background-color:#d6d6d6;");

		VBox topVBox = new VBox();
		topVBox.setPadding(new Insets(0, 0, 0, 0));
		topVBox.getChildren().add(topBorderPane);
		topVBox.getChildren().add(topLine);

		sendButton.setText("发送");

		sendButton.setPrefSize(72, 24);
		sendButton.setFocusTraversable(false);

		bottomButtonBox.setStyle("-fx-background-color:#ffffff;");
		bottomButtonBox.setPadding(new Insets(0, 15, 0, 0));
		bottomButtonBox.setSpacing(5);
		bottomButtonBox.setAlignment(Pos.CENTER_RIGHT);
		bottomButtonBox.setMinHeight(40);
		bottomButtonBox.getChildren().add(sendButton);

		BorderPane borderPane = new BorderPane();
		borderPane.setCenter(splitPane);
		borderPane.setBottom(bottomButtonBox);

		baseBorderPane.setTop(topVBox);
		baseBorderPane.setCenter(borderPane);

		this.getChildren().add(baseBorderPane);
	}
 
Example 17
Source File: OfferBookView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void initialize() {
    root.setPadding(new Insets(15, 15, 5, 15));

    final TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 2, Res.get("offerbook.availableOffers"));
    titledGroupBg.getStyleClass().add("last");

    HBox hBox = new HBox();
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.setSpacing(35);
    hBox.setPadding(new Insets(10, 0, 0, 0));

    final Tuple3<VBox, Label, AutocompleteComboBox<TradeCurrency>> currencyBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox(
            Res.get("offerbook.filterByCurrency"));
    final Tuple3<VBox, Label, AutocompleteComboBox<PaymentMethod>> paymentBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox(
            Res.get("offerbook.filterByPaymentMethod"));

    createOfferButton = new AutoTooltipButton();
    createOfferButton.setMinHeight(40);
    createOfferButton.setGraphicTextGap(10);
    AnchorPane.setRightAnchor(createOfferButton, 0d);
    AnchorPane.setBottomAnchor(createOfferButton, 0d);

    hBox.getChildren().addAll(currencyBoxTuple.first, paymentBoxTuple.first, createOfferButton);
    AnchorPane.setLeftAnchor(hBox, 0d);
    AnchorPane.setTopAnchor(hBox, 0d);
    AnchorPane.setBottomAnchor(hBox, 0d);

    AnchorPane anchorPane = new AnchorPane();
    anchorPane.getChildren().addAll(hBox, createOfferButton);

    GridPane.setHgrow(anchorPane, Priority.ALWAYS);
    GridPane.setRowIndex(anchorPane, gridRow);
    GridPane.setColumnSpan(anchorPane, 2);
    GridPane.setMargin(anchorPane, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
    root.getChildren().add(anchorPane);

    currencyComboBox = currencyBoxTuple.third;

    paymentMethodComboBox = paymentBoxTuple.third;
    paymentMethodComboBox.setCellFactory(GUIUtil.getPaymentMethodCellFactory());

    tableView = new TableView<>();

    GridPane.setRowIndex(tableView, ++gridRow);
    GridPane.setColumnIndex(tableView, 0);
    GridPane.setColumnSpan(tableView, 2);
    GridPane.setMargin(tableView, new Insets(10, 0, -10, 0));
    GridPane.setVgrow(tableView, Priority.ALWAYS);
    root.getChildren().add(tableView);

    marketColumn = getMarketColumn();

    priceColumn = getPriceColumn();
    tableView.getColumns().add(priceColumn);
    amountColumn = getAmountColumn();
    tableView.getColumns().add(amountColumn);
    volumeColumn = getVolumeColumn();
    tableView.getColumns().add(volumeColumn);
    paymentMethodColumn = getPaymentMethodColumn();
    tableView.getColumns().add(paymentMethodColumn);
    signingStateColumn = getSigningStateColumn();
    tableView.getColumns().add(signingStateColumn);
    avatarColumn = getAvatarColumn();
    tableView.getColumns().add(getActionColumn());
    tableView.getColumns().add(avatarColumn);

    tableView.getSortOrder().add(priceColumn);
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Label placeholder = new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.multipleOffers")));
    placeholder.setWrapText(true);
    tableView.setPlaceholder(placeholder);

    marketColumn.setComparator(Comparator.comparing(
            o -> CurrencyUtil.getCurrencyPair(o.getOffer().getCurrencyCode()),
            Comparator.nullsFirst(Comparator.naturalOrder())
    ));
    priceColumn.setComparator(Comparator.comparing(o -> o.getOffer().getPrice(), Comparator.nullsFirst(Comparator.naturalOrder())));
    amountColumn.setComparator(Comparator.comparing(o -> o.getOffer().getMinAmount()));
    volumeColumn.setComparator(Comparator.comparing(o -> o.getOffer().getMinVolume(), Comparator.nullsFirst(Comparator.naturalOrder())));
    paymentMethodColumn.setComparator(Comparator.comparing(o -> o.getOffer().getPaymentMethod()));
    avatarColumn.setComparator(Comparator.comparing(o -> o.getOffer().getOwnerNodeAddress().getFullAddress()));

    nrOfOffersLabel = new AutoTooltipLabel("");
    nrOfOffersLabel.setId("num-offers");
    GridPane.setHalignment(nrOfOffersLabel, HPos.LEFT);
    GridPane.setVgrow(nrOfOffersLabel, Priority.NEVER);
    GridPane.setValignment(nrOfOffersLabel, VPos.TOP);
    GridPane.setRowIndex(nrOfOffersLabel, ++gridRow);
    GridPane.setColumnIndex(nrOfOffersLabel, 0);
    GridPane.setMargin(nrOfOffersLabel, new Insets(10, 0, 0, 0));
    root.getChildren().add(nrOfOffersLabel);

    offerListListener = c -> nrOfOffersLabel.setText(Res.get("offerbook.nrOffers", model.getOfferList().size()));

    // Fixes incorrect ordering of Available offers:
    // https://github.com/bisq-network/bisq-desktop/issues/588
    priceFeedUpdateCounterListener = (observable, oldValue, newValue) -> tableView.sort();
}
 
Example 18
Source File: ConsoleMessageTab.java    From xframium-java with GNU General Public License v3.0 4 votes vote down vote up
public ConsoleMessageTab ()
{
  super ("Filters");

  setClosable (false);
  consoleMessageTable.getSelectionModel ().selectedItemProperty ()
      .addListener ( (obs, oldSelection, newSelection) -> select (newSelection));

  HBox box = new HBox (10);                         // spacing
  box.setPadding (new Insets (10, 10, 10, 10));     // trbl
  box.setAlignment (Pos.CENTER_LEFT);

  Label lblTime = new Label ("Time");
  Label lblSubsytem = new Label ("Task");
  Label lblMessageCode = new Label ("Code");
  Label lblMessageText = new Label ("Text");
  box.getChildren ().addAll (lblTime, txtTime, lblSubsytem, txtTask, lblMessageCode,
                             txtMessageCode, lblMessageText, txtMessageText);

  BorderPane borderPane = new BorderPane ();
  borderPane.setTop (box);
  borderPane.setCenter (consoleMessageTable);

  setContent (borderPane);

  FilteredList<ConsoleMessage> filteredData =
      new FilteredList<> (consoleMessageTable.messages, m -> true);

  SortedList<ConsoleMessage> sortedData = new SortedList<> (filteredData);
  sortedData.comparatorProperty ().bind (consoleMessageTable.comparatorProperty ());

  consoleMessageTable.setItems (sortedData);

  txtTime.textProperty ()
      .addListener ( (observable, oldValue, newValue) -> setFilter (filteredData));
  txtTask.textProperty ()
      .addListener ( (observable, oldValue, newValue) -> setFilter (filteredData));
  txtMessageCode.textProperty ()
      .addListener ( (observable, oldValue, newValue) -> setFilter (filteredData));
  txtMessageText.textProperty ()
      .addListener ( (observable, oldValue, newValue) -> setFilter (filteredData));
}
 
Example 19
Source File: WalletPasswordWindow.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void addButtons() {
    BusyAnimation busyAnimation = new BusyAnimation(false);
    Label deriveStatusLabel = new AutoTooltipLabel();

    unlockButton = new AutoTooltipButton(Res.get("shared.unlock"));
    unlockButton.setDefaultButton(true);
    unlockButton.getStyleClass().add("action-button");
    unlockButton.setDisable(true);
    unlockButton.setOnAction(e -> {
        String password = passwordTextField.getText();
        checkArgument(password.length() < 500, Res.get("password.tooLong"));
        KeyCrypterScrypt keyCrypterScrypt = walletsManager.getKeyCrypterScrypt();
        if (keyCrypterScrypt != null) {
            busyAnimation.play();
            deriveStatusLabel.setText(Res.get("password.deriveKey"));
            ScryptUtil.deriveKeyWithScrypt(keyCrypterScrypt, password, aesKey -> {
                if (walletsManager.checkAESKey(aesKey)) {
                    if (aesKeyHandler != null)
                        aesKeyHandler.onAesKey(aesKey);

                    hide();
                } else {
                    busyAnimation.stop();
                    deriveStatusLabel.setText("");

                    UserThread.runAfter(() -> new Popup()
                            .warning(Res.get("password.wrongPw"))
                            .onClose(this::blurAgain).show(), Transitions.DEFAULT_DURATION, TimeUnit.MILLISECONDS);
                }
            });
        } else {
            log.error("wallet.getKeyCrypter() is null, that must not happen.");
        }
    });

    forgotPasswordButton = new AutoTooltipButton(Res.get("password.forgotPassword"));
    forgotPasswordButton.setOnAction(e -> {
        forgotPasswordButton.setDisable(true);
        unlockButton.setDefaultButton(false);
        showRestoreScreen();
    });

    Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
    cancelButton.setOnAction(event -> {
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });

    HBox hBox = new HBox();
    hBox.setMinWidth(560);
    hBox.setPadding(new Insets(0, 0, 0, 0));
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.getChildren().add(unlockButton);
    if (!hideForgotPasswordButton)
        hBox.getChildren().add(forgotPasswordButton);
    if (!hideCloseButton)
        hBox.getChildren().add(cancelButton);
    hBox.getChildren().addAll(busyAnimation, deriveStatusLabel);
    gridPane.getChildren().add(hBox);


    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.LEFT);
    columnConstraints1.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1);
}
 
Example 20
Source File: Mesazhi.java    From Automekanik with GNU General Public License v3.0 4 votes vote down vote up
public Mesazhi(String titulli, String titulli_msg, String mesazhi, ShikoPunetoret sp, DritarjaKryesore dk){
    stage.setTitle(titulli);
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setResizable(false);
    Button btnAnulo = new Button("Anulo");
    HBox root = new HBox(15);
    VBox sub_root = new VBox(10);
    HBox btn = new HBox(5);
    Text ttl = new Text(titulli_msg);
    ttl.setFont(Font.font(16));
    Button btnOk = new Button("Ne rregull");
    btn.getChildren().addAll(btnAnulo, btnOk);
    btn.setAlignment(Pos.CENTER_RIGHT);

    btnOk.setOnAction(e -> {
        sp.fshi(sp.strEmri.toLowerCase() + sp.strMbiemri.toLowerCase());
        stage.close();
    });
    btnOk.setOnKeyPressed(e -> {
        if (e.getCode().equals(KeyCode.ENTER)) stage.close();
        else if (e.getCode().equals(KeyCode.ESCAPE)) stage.close();
    });

    btnAnulo.setOnAction(e -> stage.close());

    root.setPadding(new Insets(20));
    sub_root.getChildren().addAll(ttl, new Label(mesazhi), btn);
    if (titulli == "Gabim")
        root.getChildren().add(new ImageView(new Image("/sample/foto/error.png")));
    else if (titulli == "Sukses")
        root.getChildren().add(new ImageView(new Image("/sample/foto/success.png")));
    else if (titulli == "Informacion")
        root.getChildren().add(new ImageView(new Image("/sample/foto/question.png")));
    else if (titulli == "Info")
        root.getChildren().add(new ImageView(new Image("/sample/foto/info.png")));
    root.getChildren().add(sub_root);
    root.setAlignment(Pos.TOP_CENTER);
    Scene scene = new Scene(root, 450, 150);
    scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
    btnOk.isFocused();
    stage.setScene(scene);
    stage.show();
}