當前位置: 首頁>>代碼示例>>Java>>正文


Java StackPane.setMargin方法代碼示例

本文整理匯總了Java中javafx.scene.layout.StackPane.setMargin方法的典型用法代碼示例。如果您正苦於以下問題:Java StackPane.setMargin方法的具體用法?Java StackPane.setMargin怎麽用?Java StackPane.setMargin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.layout.StackPane的用法示例。


在下文中一共展示了StackPane.setMargin方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addState

import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
	final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
	rectangle.setArcHeight(WIDTH);
	rectangle.setArcWidth(WIDTH);
	rectangle.setUserData(state);
	Label text = new Label(computeStateLabel(stateIndex));
	text.setTextOverrun(OverrunStyle.ELLIPSIS);
	text.setAlignment(Pos.CENTER);
	text.setMouseTransparent(true);
	text.setTextFill(Color.WHITE);
	text.setFont(STATE_FONT);
	text.setMaxWidth(WIDTH);
	final Tooltip tooltip = new Tooltip(stateDescription);
	Tooltip.install(rectangle, tooltip);
	StackPane layout = new StackPane();
	StackPane.setMargin(rectangle, MARGIN_INSETS);
	layout.getChildren().addAll(rectangle, text);
	line.getChildren().add(layout);
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:20,代碼來源:TimelineDiffViewerRenderer.java

示例2: impl_updateBalloonLayoutX

import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void impl_updateBalloonLayoutX() {
	if (positionMode == PositionMode.ABSOLUTE || character == null || character.getParent() == null) return;
	if (positionMode == PositionMode.RELATIVE){
		try{
			loadPositionFromStorage();
			return;
		} catch (Exception e){ }
	}
	double x = character.localToScreen(character.getBoundsInLocal()).getMinX();
	double width = prefWidth(-1)*stackPane.getScaleX();

	boolean rightAlign = x-width>0;
	x += rightAlign ? (-width) : character.getWidth();
	relocate(x, getPosition().getY());

	bubblesGroup.setScaleX((rightAlign) ? 1 : -1);
	StackPane.setMargin(content, new Insets(margin.getTop(), (rightAlign) ? margin.getRight() : margin.getLeft(),
			margin.getBottom(), (!rightAlign) ? margin.getRight() : margin.getLeft()));
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:20,代碼來源:Balloon.java

示例3: initUi

import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void initUi() {
    root.setMinSize(0, 0);
    root.setPrefSize(1, 1); // Decouple from children.
    root.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    root.getStyleClass().add(STYLE_CLASS);
    root.getStylesheets().add(getClass().getResource(STYLESHEET).toExternalForm());
    root.setAlignment(Pos.TOP_LEFT);
    root.getChildren().addAll(panningComponent.getRoot(), addButton);

    panningComponent.getChildren().addAll(sceneContent, resizerComponent.getRoot(), selectionBox.getRoot());

    StackPane.setMargin(addButton, new Insets(15));
    addButton.setGraphic(Svg.PLUS_FAT.node());
    addButton.setFocusTraversable(false);

    FocusHelper.requestFocusOnPress(panningComponent.getRoot());
}
 
開發者ID:rmfisher,項目名稱:fx-animation-editor,代碼行數:18,代碼來源:SceneComponent.java

示例4: start

import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) {
    double[] values = new double[]{50,166,200,106,94,211,172,133,132,185,152,131,158,180,172,314,262,160};

    //---->Default graph using plotter<----
    LineGraph graph = new LineGraph(400,200, Theme.TRAFFIC);
    graph.setInterval(20);

    //Populating the graph
    for (double value : values) {
        graph.addValue(value);
    }

    graph.render(LineGraph.Render.ALL);

    StackPane background = new StackPane();
    background.setPrefHeight(300);
    background.setPrefWidth(600);
    background.setStyle("-fx-background-color: radial-gradient(center 50% 50%, radius 100%, #2a367f, #1f2756)");

    background.getChildren().add(graph);
    StackPane.setAlignment(graph, Pos.CENTER);

    StackPane axis = new StackPane();
    axis.setMaxSize(500,50);
    Line divider = new Line(50,0,550,0);
    divider.setStroke(Color.WHITE);
    divider.setOpacity(0.3);
    axis.getChildren().add(divider);
    StackPane.setAlignment(divider,Pos.CENTER);
    Label time1 = new Label("8am");
    Label time2 = new Label("5pm");
    time1.setTextFill(Color.WHITE);
    time2.setTextFill(Color.WHITE);
    time1.setOpacity(0.5);
    time2.setOpacity(0.5);
    time1.setFont(Font.font("Calibri",16));
    time2.setFont(Font.font("Calibri",16));
    axis.getChildren().addAll(time1,time2);
    StackPane.setAlignment(time1,Pos.BOTTOM_LEFT);
    StackPane.setMargin(time1, new Insets(0,0,0,30));
    StackPane.setAlignment(time2, Pos.BOTTOM_RIGHT);
    StackPane.setMargin(time2, new Insets(0,30,0,0));

    background.getChildren().add(axis);
    StackPane.setAlignment(axis, Pos.BOTTOM_CENTER);
    StackPane.setMargin(axis, new Insets(0,0,40,0));

    primaryStage.setScene(new Scene(background));
    primaryStage.setTitle("Traffic");
    primaryStage.show();
}
 
開發者ID:DrMerfy,項目名稱:GraphCreator,代碼行數:53,代碼來源:Traffic.java

示例5: Balloon

import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
Balloon(String id, String text) {
	instance=this;

	bubbleShadow.setRadius(10.0);
	bubbleShadow.setOffsetX(1.5);
	bubbleShadow.setOffsetY(2.5);
	bubbleShadow.setColor(Color.color(0, 0, 0, Main.getProperties().getFloat("balloon.shadow-opacity", 1.0f)));

	Text label = new Text("");
	label.setStyle("-fx-alignment: center; -fx-text-alignment: center; -fx-content-display: center;");
	label.setTextAlignment(TextAlignment.CENTER);
	label.setWrappingWidth(300);
	if (defaultFont != null) {
		label.setFont(defaultFont);
	} else {
		label.setFont(LocalFont.defaultFont);
	}

	Integer animation_delay = Main.getProperties().getInteger("balloon.text-animation-delay", 50);
	if (animation_delay > 0)
		symbolsAdder = new SymbolsAdder(text, animation_delay);
	else
		label.setText(text);

	content = label;
	StackPane contentPane = new StackPane();
	contentPane.getChildren().add(content);

	bubblesGroup = new Group(bubbleShapes);

	stackPane.getChildren().add(bubblesGroup);
	stackPane.getChildren().add(contentPane);
	StackPane.setMargin(content, margin);

	setBalloonScaleFactor(Main.getProperties().getFloat("balloon.scale_factor", 100));
	getChildren().add(stackPane);

	setBalloonOpacity(Main.getProperties().getFloat("balloon.opacity", 100));

	setOnMousePressed(event -> {
		lastClick = System.currentTimeMillis();
		if ((positionMode != PositionMode.AUTO) && event.getButton().equals(MouseButton.PRIMARY)) {
			startDrag(event);
		}
	});
	setOnMouseReleased(event -> {
		if(!isDragging() && event.getButton().equals(MouseButton.PRIMARY) && (System.currentTimeMillis()-lastClick)<200) {
			if (character != null) {
				character.say(null);
			} else {
				close();
			}
		}
	});

	setOnMouseEntered(event -> {
		if (character != null && timeoutTimeline != null) {
			timeoutTimeline.stop();
		}
	});
	setOnMouseExited(event -> {
		if (character != null && timeoutTimeline != null) {
			timeoutTimeline.play();
		}
	});

	mouseEventNotificator
			.setOnClickListener()
			.setOnMovedListener()
			// TODO: Figure out how to write more precise check.
			.setOnScrollListener(event -> true);
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:73,代碼來源:Balloon.java


注:本文中的javafx.scene.layout.StackPane.setMargin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。