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


Java HBox.setOnMouseClicked方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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


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