本文整理匯總了Java中javafx.scene.layout.StackPane.setAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java StackPane.setAlignment方法的具體用法?Java StackPane.setAlignment怎麽用?Java StackPane.setAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.StackPane
的用法示例。
在下文中一共展示了StackPane.setAlignment方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ToggleSwitchSkin
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
/**
* Constructor for all SkinBase instances.
*
* @param control The control for which this Skin should attach to.
*/
protected ToggleSwitchSkin(ToggleSwitch control) {
super(control);
thumb = new StackPane();
thumbArea = new StackPane();
label = new LabeledText(control);
labelContainer = new StackPane();
updateLabel(control);
getChildren().addAll(labelContainer, thumbArea, thumb);
labelContainer.getChildren().addAll(label);
StackPane.setAlignment(label, Pos.CENTER_LEFT);
thumb.getStyleClass().setAll("thumb");
thumbArea.getStyleClass().setAll("thumb-area");
thumbArea.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
thumb.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
control.selectedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue.booleanValue() != oldValue.booleanValue())
selectedStateChanged();
});
}
示例2: createUi
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void createUi() {
getStyleClass().add(TITLE_BAR_STYLE_CLASS);
setAlignment(Pos.CENTER_RIGHT);
setMaxWidth(Double.MAX_VALUE);
Region selectedBar = new Region();
selectedBar.getStyleClass().add(HIGHLIGHT_STYLE_CLASS);
selectedBar.setMinWidth(Region.USE_PREF_SIZE);
selectedBar.setMaxHeight(Region.USE_PREF_SIZE);
selectedBar.setMaxWidth(Double.MAX_VALUE);
StackPane.setAlignment(selectedBar, Pos.BOTTOM_CENTER);
StackPane labelPane = new StackPane(label, selectedBar);
labelPane.setMaxHeight(Double.MAX_VALUE);
labelPane.setMaxWidth(Region.USE_PREF_SIZE);
Region filler = new Region();
HBox.setHgrow(filler, Priority.ALWAYS);
rightLabel.getStyleClass().setAll(RIGHT_LABEL_STYLE_CLASS);
new FadeInAnimator().apply(expanded, selectedBar);
new FadeInAnimator().apply(expanded, rightLabel);
getChildren().addAll(labelPane, filler, rightLabel);
}
示例3: Indicator
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
public Indicator() {
Circle c = new Circle(5);
Line l = new Line();
l.setStartX(0);
l.endXProperty().bind(this.widthProperty().subtract(10));
c.getStyleClass().add("timeindicator");
l.getStyleClass().add("timeindicator");
StackPane.setAlignment(c, Pos.CENTER_LEFT);
this.getChildren().add(l);
this.getChildren().add(c);
this.translateYProperty().bind(this.heightProperty().divide(2).negate());
}
示例4: wrap
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
protected Node wrap(Node node) {
StackPane outerPane = new StackPane();
outerPane.setStyle("-fx-padding: 20px;");
StackPane stackPane = new StackPane();
stackPane.setStyle(
"-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 20px;");
outerPane.getChildren().add(stackPane);
StackPane.setAlignment(node, Pos.CENTER);
stackPane.getChildren().add(node);
return outerPane;
}
示例5: productbyType
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
public static BorderPane productbyType(String type) {
BorderPane products = new BorderPane();
products.setPadding(new Insets(10,20,10,20));
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String query = DBUtils.prepareSelectQuery(" * ",
" classroomflipkart.productdetail AS T ," +
" ( "+ DBUtils.prepareSelectQuery("productId",
" classroomflipkart.homeproducts ",
"type = '"+type+"'")+
" ) AS S",
" T.productId = S.productId ");
try {
con = DBUtils.getConnection();
stmt = con.prepareStatement(query);
rs = stmt.executeQuery();
rs.last();
int size = rs.getRow();
if (size>0){
rs.beforeFirst();
Label title = new Label(type+"");
title.setFont(Font.font("Open Sans", FontWeight.BOLD,17));
title.setPadding(new Insets(10));
title.setAlignment(Pos.CENTER);
HBox productList = new HBox(20);
productList.setAlignment(Pos.CENTER);
while (rs.next()) {
String productId = rs.getString("productId");
String productName = rs.getString("productName");
String newPrice = rs.getString("newPrice");
String oldPrice = rs.getString("oldPrice");
String category = rs.getString("category");
String subcategory = rs.getString("subcategory");
String imageName = rs.getString("imageName");
String productAvailability = rs.getString("productAvailability");
productList.getChildren().add(productDetail.productByType(productId,productName,newPrice,oldPrice,category,subcategory,imageName, productAvailability));
}
ScrollPane proScroller = new ScrollPane(productList);
proScroller.setFitToHeight(true);
proScroller.setFitToWidth(true);
proScroller.setPannable(true);
proScroller.setPadding(new Insets(0,0,30,0));
StackPane titlePane = new StackPane(title);
titlePane.setAlignment(Pos.CENTER);
StackPane productPane = new StackPane(proScroller);
productPane.setAlignment(Pos.CENTER);
products.setTop(titlePane);
products.setCenter(productPane);
}
} catch (Exception e) {
products.setCenter(new Label(e.getMessage()));
e.printStackTrace();
} finally {
DBUtils.closeAll(rs, stmt, con);
return products;
}
}
示例6: addCanvasToRootPane
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void addCanvasToRootPane(Image image) {
if (image == null) {
return;
}
rootPane.setPrefWidth(image.getWidth());
rootPane.setPrefHeight(image.getHeight());
rootPane.getChildren().add(canvas);
StackPane.setAlignment(canvas, Pos.TOP_CENTER);
}
示例7: initLooks
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void initLooks(){
rectangle.setStrokeWidth(STROKE_WIDTH);
rectangle.setFill(Color.LIGHTSKYBLUE);
rectangle.setStroke(Color.BLACK);
StackPane.setAlignment(title, Pos.CENTER);
VBox.setMargin(attributes, new Insets(5,0,0,5));
VBox.setMargin(operations, new Insets(5,0,0,5));
}
示例8: initLooks
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void initLooks(){
rectangle.setStrokeWidth(STROKE_WIDTH);
rectangle.setFill(Color.LIGHTSKYBLUE);
rectangle.setStroke(Color.BLACK);
StackPane.setAlignment(title, Pos.CENTER);
VBox.setMargin(values, new Insets(5,0,0,5));
}
示例9: PackageNodeView
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
public PackageNodeView(PackageNode node) {
super(node);
refNode = node;
title = new Text(node.getTitle());
title.setFont(Font.font("Verdana", FontWeight.BOLD, 12));
//TODO Ugly solution, hardcoded value.
title.setWrappingWidth(node.getWidth() - 7);
container = new VBox();
bodyStackPane = new StackPane();
container.setSpacing(0);
createRectangles();
container.getChildren().add(top);
bodyStackPane.getChildren().addAll(body, title);
container.getChildren().addAll(bodyStackPane);
StackPane.setAlignment(title, Pos.TOP_CENTER);
StackPane.setAlignment(top, Pos.CENTER_LEFT);
setTitleSize();
this.getChildren().add(container);
this.setTranslateX(node.getTranslateX());
this.setTranslateY(node.getTranslateY());
createHandles();
}
示例10: initUi
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void initUi() {
root.getStylesheets().add(getClass().getResource(STYLESHEET).toExternalForm());
root.getStyleClass().add(STYLE_CLASS);
playButton.setGraphic(Svg.PLAY.node());
pauseButton.setGraphic(Svg.PAUSE.node());
stopButton.setGraphic(Svg.STOP.node());
HBox labelBox = new HBox(currentTimeLabel, finalTimeLabel);
labelBox.setMaxWidth(Region.USE_PREF_SIZE);
labelBox.setAlignment(Pos.CENTER_LEFT);
StackPane.setAlignment(labelBox, Pos.CENTER_RIGHT);
currentTimeLabel.getStyleClass().add(CURRENT_TIME_LABEL_STYLE_CLASS);
HBox buttonBox = new HBox(playButton, pauseButton, stopButton);
buttonBox.getStyleClass().add(BUTTON_BOX_STYLE_CLASS);
buttonBox.setMaxWidth(Region.USE_PREF_SIZE);
root.getChildren().addAll(buttonBox, labelBox);
}
示例11: 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();
}
示例12: init
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void init() {
setPadding(new Insets(GuiConstants.padding));
HBox center = new HBox(GuiConstants.padding);
getChildren().add(center);
StackPane.setAlignment(center, Pos.CENTER);
center.setAlignment(Pos.CENTER);
matchClassButton.setText("match classes");
matchClassButton.setOnAction(event -> matchClasses());
matchClassButton.setDisable(true);
center.getChildren().add(matchClassButton);
matchMemberButton.setText("match members");
matchMemberButton.setOnAction(event -> matchMembers());
matchMemberButton.setDisable(true);
center.getChildren().add(matchMemberButton);
matchPerfectMembersButton.setText("match 100% members");
matchPerfectMembersButton.setOnAction(event -> matchPerfectMembers());
matchPerfectMembersButton.setDisable(true);
center.getChildren().add(matchPerfectMembersButton);
HBox right = new HBox(GuiConstants.padding);
getChildren().add(right);
StackPane.setAlignment(right, Pos.CENTER_RIGHT);
right.setAlignment(Pos.CENTER_RIGHT);
right.setPickOnBounds(false);
unmatchClassButton.setText("unmatch classes");
unmatchClassButton.setOnAction(event -> unmatchClass());
unmatchClassButton.setDisable(true);
right.getChildren().add(unmatchClassButton);
unmatchMemberButton.setText("unmatch members");
unmatchMemberButton.setOnAction(event -> unmatchMember());
unmatchMemberButton.setDisable(true);
right.getChildren().add(unmatchMemberButton);
SelectListener selectListener = new SelectListener();
srcPane.addListener(selectListener);
dstPane.addListener(selectListener);
}
示例13: start
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group());
stage.setTitle("Checkbox Sample");
stage.setWidth(250);
stage.setHeight(150);
rect.setArcHeight(10);
rect.setArcWidth(10);
rect.setFill(Color.rgb(41, 41, 41));
for (int i = 0; i < names.length; i++) {
final Image image = images[i] =
new Image(getClass().getResourceAsStream(names[i] + ".png"));
final ImageView icon = icons[i] = new ImageView();
final CheckBox cb = cbs[i] = new CheckBox(names[i]);
cb.selectedProperty().addListener(
(ObservableValue<? extends Boolean> ov,
Boolean old_val, Boolean new_val) -> {
icon.setImage(new_val ? image : null);
});
}
VBox vbox = new VBox();
vbox.getChildren().addAll(cbs);
vbox.setSpacing(5);
HBox hbox = new HBox();
hbox.getChildren().addAll(icons);
hbox.setPadding(new Insets(0, 0, 0, 5));
StackPane stack = new StackPane();
stack.getChildren().add(rect);
stack.getChildren().add(hbox);
StackPane.setAlignment(rect, Pos.TOP_CENTER);
HBox root = new HBox();
root.getChildren().add(vbox);
root.getChildren().add(stack);
root.setSpacing(40);
root.setPadding(new Insets(20, 10, 10, 20));
((Group) scene.getRoot()).getChildren().add(root);
stage.setScene(scene);
stage.show();
}
示例14: createStackPane
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
public static StackPane createStackPane(double width, double height, Pos alignment)
{
StackPane pane = createStackPane(width, height);
pane.setAlignment(alignment);
return pane;
}
示例15: initLooks
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void initLooks(){
rectangle.setStrokeWidth(STROKE_WIDTH);
rectangle.setFill(Color.LIGHTSKYBLUE);
rectangle.setStroke(Color.BLACK);
StackPane.setAlignment(title, Pos.CENTER);
}