當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。