当前位置: 首页>>代码示例>>Java>>正文


Java HBox.setMargin方法代码示例

本文整理汇总了Java中javafx.scene.layout.HBox.setMargin方法的典型用法代码示例。如果您正苦于以下问题:Java HBox.setMargin方法的具体用法?Java HBox.setMargin怎么用?Java HBox.setMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.HBox的用法示例。


在下文中一共展示了HBox.setMargin方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAlignment

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void setAlignment() {
	label.setPrefWidth(200);
	changeButton.setMinWidth(71);
	unbindButton.setMinWidth(71);
	hbox = new HBox(label, textField, changeButton, unbindButton);
	hbox.setAlignment(Pos.CENTER_LEFT);
	hbox.setPrefHeight(31);
	label.setText(getPrettyName());
	label.setAlignment(Pos.CENTER_LEFT);
	Insets labelInset = new Insets(0, 0, 0, 10);
	Insets buttonInset = new Insets(0, 10, 0, 0);
	unbindButton.setMinHeight(31);
	hbox.setMargin(label, labelInset);
	hbox.setMargin(unbindButton, buttonInset);
	textField.setEditable(false);
	hbox.setHgrow(textField, Priority.ALWAYS);
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:18,代码来源:HotkeyController.java

示例2: setupBox

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void setupBox(VBox box, String labelString, VBox content) {
	final HBox boxLabel = new HBox();
	final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0);
	final Label label = new Label(labelString);
	boxLabel.setBackground(HEADER_BACKGROUND);
	label.setFont(GROUP_FONT);
	HBox.setMargin(arrow, HALF_MARGIN_INSETS);
	boxLabel.setAlignment(Pos.CENTER_LEFT);
	boxLabel.getChildren().addAll(arrow, label);
	boxLabel.setCursor(Cursor.HAND);
	box.getChildren().add(boxLabel);
	boxLabel.setOnMouseClicked(e -> {
		if (box.getChildren().size() > 1) {
			box.getChildren().remove(content);
			arrow.setRotate(0);
		} else {
			box.getChildren().add(content);
			arrow.setRotate(90);
		}
	});
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:22,代码来源:TimelineDiffViewerRenderer.java

示例3: processSegments

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void processSegments() {
	for (Map.Entry<HBox, List<List<DiffKind>>> e : lineToSegments.entrySet()) {
		final HBox line = e.getKey();
		final List<String> descriptions = segmentToDescription.get(line);
		final List<Node> children = line.getChildren();
		final List<List<DiffKind>> segments = e.getValue();
		int idx = 0;
		for (List<DiffKind> segment : segments) {
			if (segment == null) {
				final Rectangle rectangle = new Rectangle(WIDTH, 8, Color.TRANSPARENT);
				HBox.setMargin(rectangle, MARGIN_INSETS);
				children.add(rectangle);
			} else {
				DiffKind[] seg = new DiffKind[segment.size()];
				for (int i = 0; i < seg.length; i++) {
					seg[i] = segment.get(i);
				}
				final String description = descriptions.get(idx);
				final ValueView view = new ValueView(description, seg);
				HBox.setMargin(view, MARGIN_INSETS);
				children.add(view);
				idx++;
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:27,代码来源:TimelineDiffViewerRenderer.java

示例4: createLeftHandSide

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
protected Node createLeftHandSide() {
    DayPage dayPage = getSkinnable();

    // today label
    todayLabel = new Label();
    todayLabel.getStyleClass().add("today-label"); //$NON-NLS-1$
    todayLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    todayLabel.setAlignment(Pos.TOP_LEFT);
    todayLabel.setTextOverrun(OverrunStyle.CLIP);
    todayLabel.setMinWidth(Region.USE_PREF_SIZE);
    HBox.setHgrow(todayLabel, Priority.ALWAYS);

    // year month view
    yearMonthView = dayPage.getYearMonthView();
    yearMonthView.setSelectionMode(SelectionMode.SINGLE);
    yearMonthView.setShowMonth(false);
    yearMonthView.setShowYear(false);
    yearMonthView.setShowTodayButton(false);
    HBox.setHgrow(yearMonthView, Priority.NEVER);
    getSkinnable().bind(yearMonthView, true);

    HBox header = new HBox(10);
    header.setFillHeight(true);
    header.getChildren().addAll(todayLabel, yearMonthView);
    header.getStyleClass().add("header");

    AgendaView agendaView = dayPage.getAgendaView();
    getSkinnable().bind(agendaView, true);
    HBox.setMargin(agendaView, new Insets(10, 0, 0, 0));

    BorderPane leftHandSide = new BorderPane();
    leftHandSide.getStyleClass().add("left-side");
    leftHandSide.setTop(header);
    leftHandSide.setCenter(agendaView);
    HBox.setHgrow(leftHandSide, Priority.ALWAYS);
    return leftHandSide;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:38,代码来源:DayPageSkin.java

示例5: Tag

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
Tag(String tag) {
    getStyleClass().setAll("tag");
    Button removeButton = new Button("X");
    removeButton.setOnAction((evt) -> tags.remove(tag));
    Text text = new Text(tag);
    HBox.setMargin(text, new Insets(0, 0, 0, 5));
    getChildren().addAll(text, removeButton);
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:9,代码来源:TagBar.java

示例6: addBlankState

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void addBlankState(HBox line) {
	final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, Color.TRANSPARENT);
	HBox.setMargin(rectangle, MARGIN_INSETS);
	line.getChildren().add(rectangle);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:6,代码来源:TimelineDiffViewerRenderer.java

示例7: setupStatesPane

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private Pane setupStatesPane() {
	final Label titleLabel = new Label("All execution states (0)");
	nbStates.addListener((v, o, n) -> {
		String s = "All execution states (" + n.intValue() + ")";
		Platform.runLater(() -> {
			titleLabel.setText(s);
			titleLabel.setContentDisplay(ContentDisplay.RIGHT);
			final ImageView nodeGraphic = new ImageView();
			nodeGraphic.setImage(playGraphic);
			titleLabel.setGraphic(nodeGraphic);
			isInReplayMode.addListener((val, old, neu) -> {
				if (old != neu) {
					if (neu) {
						nodeGraphic.setImage(replayGraphic);
					} else {
						nodeGraphic.setImage(playGraphic);
					}
				}
			});
		});
	});
	titleLabel.setFont(statesFont);
	VBox.setMargin(titleLabel, HALF_MARGIN_INSETS);
	titleLabel.setAlignment(Pos.CENTER);
	final ScrollBar scrollBar = new ScrollBar();
	scrollBar.setVisibleAmount(1);
	scrollBar.setBlockIncrement(10);
	scrollBar.setMin(0);
	final IntegerBinding statesRange = visibleStatesRange.subtract(1);
	scrollBar.disableProperty().bind(statesRange.lessThanOrEqualTo(0));
	scrollBar.maxProperty().bind(statesRange);
	scrollBar.valueProperty().addListener((v, o, n) -> {
		if (o.intValue() != n.intValue() && n.intValue() != currentState.intValue()) {
			currentState.set(n.intValue());
		}
	});
	currentState.addListener((v, o, n) -> {
		if (o.intValue() != n.intValue() && n.intValue() != scrollBar.valueProperty().intValue()) {
			scrollBar.setValue(n.intValue());
		}
	});
	final HBox hBox = new HBox();
	final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0);
	HBox.setMargin(arrow, HALF_MARGIN_INSETS);
	final Label toggleValuesLabel = new Label("Timeline for dynamic information	");
	toggleValuesLabel.setFont(statesFont);
	hBox.setAlignment(Pos.CENTER_LEFT);
	hBox.getChildren().addAll(arrow, toggleValuesLabel);
	hBox.setCursor(Cursor.HAND);
	hBox.setOnMouseClicked((e) -> {
		if (bodyScrollPane.isVisible()) {
			bodyScrollPane.setVisible(false);
			arrow.setRotate(0);
		} else {
			bodyScrollPane.setVisible(true);
			arrow.setRotate(90);
		}
	});
	VBox.setMargin(hBox, HALF_MARGIN_INSETS);
	headerPane.getChildren().addAll(scrollBar, titleLabel, statesPane, hBox);
	VBox.setMargin(statesPane, MARGIN_INSETS);

	return headerPane;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:65,代码来源:MultidimensionalTimelineRenderer.java

示例8: margin

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public static <T extends Node> T margin(T t, Insets inset) {
  HBox.setMargin(t, inset);
  return t;
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:5,代码来源:LayoutUtil.java

示例9: refresh

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public void refresh() {

        reservationsWrapper.getChildren().clear();

        int i = 0;
        for(Reservation reservation : controller.getReservations()) {
            HBox horizontalWrapper = new HBox();
            horizontalWrapper.setSpacing(10);
            horizontalWrapper.setAlignment(Pos.CENTER);

            String filename = null;

            switch (reservation.getSpot().getSpotType()) {
                case HOUSE: filename = "cabin.png"; break;
                case TRAILER: filename = "trailer.png"; break;
                case RESTAURANT: filename = "cutlery.png"; break;
                case PARKING: filename = "parking.png"; break;
                case POOL: filename = "swimming-pool.png"; break;
                case SPORT: filename = "kayak.png"; break;
                case TENT: filename = "tent.png"; break;
            }

            Image bigImage = new Image(new File("res/items/x64/" + filename).toURI().toString());
            ImageView locationImageView = new ImageView(bigImage);
            HBox.setMargin(locationImageView, new Insets(0, 0, 0, 20));
            horizontalWrapper.getChildren().add(locationImageView);

            VBox verticalWrapper = new VBox();
            horizontalWrapper.getChildren().add(verticalWrapper);
            verticalWrapper.setAlignment(Pos.CENTER_LEFT);

            horizontalWrapper.setOnMouseClicked(mouseEvent -> {
                ReservationManagerDialog reservationManagerDialog = new ReservationManagerDialog(controller, reservation, new ImageView(bigImage));
                reservationManagerDialog.showAndWait();
                refresh();
            });

            verticalWrapper.setMinWidth(HomeView.TAB_CONTENT_W / 4);
            verticalWrapper.setPadding(new Insets(20));

            Client client = reservation.getClient();

            Text clientNameText = new Text(client.getFirstname() + " " + client.getLastname());
            clientNameText.setFont(new Font(20));
            clientNameText.setFill(Color.WHITE);
            verticalWrapper.getChildren().add(clientNameText);

            Text spotText = new Text("Emplacement : " + reservation.getSpot().getName());
            spotText.setFont(new Font(15));
            spotText.setFill(Color.WHITE);
            verticalWrapper.getChildren().add(spotText);

            Text personCountText = new Text("Nombre de personnnes : " + reservation.getPersonCount());
            personCountText.setFont(new Font(15));
            personCountText.setFill(Color.WHITE);
            verticalWrapper.getChildren().add(personCountText);

            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            Text datesText = new Text("Dates début/fin : " + dateFormat.format(new Date(reservation.getStarttime().getTime())) + " / " + dateFormat.format(new Date(reservation.getEndtime().getTime())));
            datesText.setFont(new Font(15));
            datesText.setFill(Color.WHITE);
            verticalWrapper.getChildren().add(datesText);

            if (i++ % 2 == 1)
                horizontalWrapper.setStyle("-fx-background-color: #336699;");
            else
                horizontalWrapper.setStyle("-fx-background-color: #0F355C;");

            reservationsWrapper.getChildren().add(horizontalWrapper);
        }
    }
 
开发者ID:Moccko,项目名称:campingsimulator2017,代码行数:72,代码来源:ReservationsView.java

示例10: TagWithoutRemove

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
TagWithoutRemove(String tag) {
    getStyleClass().setAll("tag");
    Text text = new Text(tag);
    HBox.setMargin(text, new Insets(0, 5, 0, 5));
    getChildren().addAll(text);
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:7,代码来源:TagBar.java


注:本文中的javafx.scene.layout.HBox.setMargin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。