本文整理匯總了Java中javafx.scene.layout.HBox.setAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java HBox.setAlignment方法的具體用法?Java HBox.setAlignment怎麽用?Java HBox.setAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.HBox
的用法示例。
在下文中一共展示了HBox.setAlignment方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
public void start(Stage primaryStage, ScrollPane rootLayout) throws Exception {
primaryStage.setTitle("Change Hotkeys");
Scene myScene = new Scene(rootLayout);
ourStage = primaryStage;
myScene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
public void handle(KeyEvent event) {
if (changeHotkey) {
if (addHotkey(event, changeHotkeyFunction)) {
changeHotkey = false;
}
}
}
});
Label divider = new Label();
HBox labelHbox = new HBox(divider);
divider.setText("----These hotkeys are not changeable----");
labelHbox.setAlignment(Pos.CENTER);
for (String key : HOTKEYS) {
hotkeyVBox.getChildren().add(hotkeys.get(key).getHotkeyHBox());
}
hotkeyVBox.getChildren().add(labelHbox);
for (ImmutableHotkey hotkey : IMMUTABLE_HOTKEYS) {
hotkeyVBox.getChildren().add(hotkey.getHotkeyHBox());
}
primaryStage.setScene(myScene);
}
示例2: createFrameRateControl
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
/**
* Create the frame rate control.
*/
@FXThread
private void createFrameRateControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_FRAME_RATE + ":");
frameRateField = new IntegerTextField();
frameRateField.prefWidthProperty().bind(root.widthProperty());
frameRateField.setMinMax(5, 100);
frameRateField.addChangeListener((observable, oldValue, newValue) -> validate());
FXUtils.addToPane(label, container);
FXUtils.addToPane(frameRateField, container);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(frameRateField, CSSClasses.SETTINGS_DIALOG_FIELD);
}
示例3: createDefaultCameraLampEnabledControl
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
/**
* Create the checkbox for configuring enabling camera lamp by default.
*/
@FXThread
private void createDefaultCameraLampEnabledControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_DEFAULT_EDITOR_CAMERA_LAMP_ENABLED + ":");
defaultCameraLampEnabledCheckBox = new CheckBox();
defaultCameraLampEnabledCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());
FXUtils.addToPane(label, container);
FXUtils.addToPane(defaultCameraLampEnabledCheckBox, container);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(defaultCameraLampEnabledCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
示例4: 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);
}
});
}
示例5: RregulloPunen
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
public RregulloPunen(int id, boolean kryer, TeDhenat td){
stage.initModality(Modality.APPLICATION_MODAL);
stage.setResizable(false);
stage.setTitle("Rregullo");
HBox btn = new HBox(5);
btn.getChildren().addAll(btnOk, btnAnulo);
btn.setAlignment(Pos.CENTER_RIGHT);
GridPane grid = new GridPane();
grid.add(cbKryer, 0, 0);
grid.add(btn, 0, 1);
grid.setVgap(10);
grid.setAlignment(Pos.CENTER);
cbKryer.setSelected(kryer);
btnOk.setOnAction(e -> {
azhurno(id);
new Thread(new Runnable() {
@Override
public void run() {
td.mbush();
}
}).start();
});
btnAnulo.setOnAction(e -> stage.close());
Scene scene = new Scene(grid, 230, 100);
scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
stage.setScene(scene);
stage.show();
}
示例6: RecurrencePopupSkin
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
public RecurrencePopupSkin(RecurrencePopup popup) {
super();
this.popup = popup;
Button okButton = new Button(Messages.getString("RecurrencePopupSkin.OK")); //$NON-NLS-1$
okButton.setDefaultButton(true);
okButton.setOnAction(evt -> {
popup.hide();
popup.fireEvent(
new RecurrencePopupEvent(RecurrencePopupEvent.OK_PRESSED));
});
Button cancelButton = new Button(Messages.getString("RecurrencePopupSkin.CANCEL")); //$NON-NLS-1$
cancelButton.setCancelButton(true);
cancelButton.setOnAction(evt -> {
popup.hide();
popup.fireEvent(
new RecurrencePopupEvent(RecurrencePopupEvent.CANCEL_PRESSED));
});
HBox buttonBox = new HBox();
buttonBox.setAlignment(Pos.CENTER);
buttonBox.getChildren().addAll(cancelButton, okButton);
buttonBox.getStyleClass().add("button-pane"); //$NON-NLS-1$
BorderPane contentPane = new BorderPane();
contentPane.getStyleClass().add("content"); //$NON-NLS-1$
contentPane.setCenter(popup.getRecurrenceView());
contentPane.setBottom(buttonBox);
stackPane = popup.getRoot();
stackPane.getChildren().add(contentPane);
}
示例7: createDemoNode
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
public static Node createDemoNode() {
XYZDataset dataset = createDataset();
Chart3D chart = createChart(dataset);
Chart3DViewer viewer = new Chart3DViewer(chart);
BorderPane node = new BorderPane();
node.setCenter(viewer);
HBox container = new HBox();
CheckBox checkBox = new CheckBox("Logarithmic Axis?");
checkBox.setSelected(true);
checkBox.setOnAction((e) -> {
XYZPlot plot = (XYZPlot) chart.getPlot();
if (checkBox.isSelected()) {
LogAxis3D logAxis = new LogAxis3D("Y (log scale)");
logAxis.setTickLabelOrientation(LabelOrientation.PERPENDICULAR);
logAxis.receive(new ChartStyler(chart.getStyle()));
plot.setYAxis(logAxis);
} else {
NumberAxis3D yAxis = new NumberAxis3D("Y");
yAxis.setTickLabelOrientation(LabelOrientation.PERPENDICULAR);
yAxis.receive(new ChartStyler(chart.getStyle()));
plot.setYAxis(yAxis);
}
});
container.setAlignment(Pos.CENTER);
container.setPadding(new Insets(4.0, 4.0, 4.0, 4.0));
container.getChildren().add(checkBox);
node.setBottom(container);
return node;
}
示例8: constructContainer
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
@Override
public Parent constructContainer()
{
bp.setId("loginviewbg");
bottom = new HBox(50);
bottom.setAlignment(Pos.CENTER);
bottom.setMaxWidth(300);
bottom.setPadding(new Insets(20,50,150,280));
AllFields = new VBox(50);
AllFields.setAlignment(Pos.CENTER);
AllFields.setMaxWidth(300);
AllFields.setPadding(new Insets(100,20,20,20));
btnOwnDMO = new AppButton("Eigenes DMO");
btnForeignDMO = new AppButton("Fremdes DMO");
back = new BackButton(getFXController(), "Zur�ck");
home = new HomeButton(getFXController());
AllFields.getChildren().addAll(btnOwnDMO, btnForeignDMO, back, home);
bottom.getChildren().addAll(back, home);
bp.setCenter(AllFields);
bp.setBottom(bottom);
btnOwnDMO.setOnAction(e -> getFXController().showView("savedownloadstackowndmoview"));
btnForeignDMO.setOnAction(e -> getFXController().showView("savedownloadstackforeigndmoview"));
back.setOnAction(e -> getFXController().showView("doorsavepathselectionview"));
return bp;
}
開發者ID:CoffeeCodeSwitzerland,項目名稱:Lernkartei_2017,代碼行數:35,代碼來源:SaveDownloadstackOnServerDialogView.java
示例9: OptionsPane
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
/**
* Creation of the OptionsPane. Pass in a map that fully maps all titles to their respective panes.
* <p>
* CAUTION: Map should can't be null. However, the map can be empty.
*
* @param optionsMenuModel
* Map from tree names to panes
*/
public OptionsPane( Map<OptionSection, Pane> optionsMenuModel )
{
//TODO use some kind of selection model to default to select first item or last item selected
optionScreenMap = optionsMenuModel;
sections = new OptionsSettingsTree(optionsMenuModel.keySet());
sections.setTreeDoubleClick(this::onTreeDoubleClick);
sectionView = new SwapPane();
SplitPane sectionContentSplitPane = new SplitPane();
sectionContentSplitPane.setOrientation(Orientation.HORIZONTAL);
sectionContentSplitPane.getItems().addAll(sections, sectionView);
sectionContentSplitPane.setDividerPositions(0.2, 1);
setCenter(sectionContentSplitPane);
okAction = () -> {
};
cancelAction = () -> {
};
Button okButton = new Button();
okButton.setText("OK");
okButton.setOnMouseClicked(this::okButtonClicked);
Button cancelButton = new Button();
cancelButton.setText("Cancel");
cancelButton.setOnMouseClicked(this::cancelButtonClicked);
HBox buttonBar = new HBox();
buttonBar.getChildren().addAll(okButton, cancelButton);
buttonBar.setAlignment(Pos.BASELINE_RIGHT);
setBottom(buttonBar);
}
示例10: _initializeGUI
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
private void _initializeGUI() {
this.setCenter(this._root);
this._root.setAlignment(Pos.CENTER);
HBox outputSettingsPane = new HBox(5);
outputSettingsPane.setAlignment(Pos.CENTER);
this._root.getChildren().addAll(
outputSettingsPane,
this._generateButton
);
outputSettingsPane.getChildren().addAll(
new Label("Output:"),
this._outputTextField,
this._browseButton,
this._openFileButton
);
this._browseButton.setCursor(Cursor.HAND);
Tooltip browseButtonTooltip = new Tooltip("Browse for Output Folder");
this._browseButton.setTooltip(browseButtonTooltip);
this._openFileButton.setCursor(Cursor.HAND);
Tooltip openFileButtonTooltip = new Tooltip("Open Email Template");
this._openFileButton.setTooltip(openFileButtonTooltip);
this._generateButton.setCursor(Cursor.HAND);
Tooltip generateButtonTooltip = new Tooltip("Generate Email Template");
this._generateButton.setTooltip(generateButtonTooltip);
this._generateButton.setFont(Font.font(16));
this._generateButton.setMinWidth(256);
this._generateButton.setStyle("-fx-background-radius: 50; -fx-padding: 10;");
((Stage) this._fileNotExistsAlert.getDialogPane().getScene().getWindow()).getIcons().add(new Image(this.getClass().getResourceAsStream(EmailTemplateMakerApp.ICON)));
}
示例11: ConfigurationContext
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
private ConfigurationContext(GazePlay gazePlay, BorderPane root, Scene scene) {
super(gazePlay, root, scene);
HomeButton homeButton = createHomeButtonInConfigurationManagementScreen(gazePlay);
HBox rightControlPane = new HBox();
ControlPanelConfigurator.getSingleton().customizeControlePaneLayout(rightControlPane);
rightControlPane.setAlignment(Pos.CENTER_RIGHT);
rightControlPane.getChildren().add(homeButton);
HBox leftControlPane = new HBox();
ControlPanelConfigurator.getSingleton().customizeControlePaneLayout(leftControlPane);
leftControlPane.setAlignment(Pos.CENTER_LEFT);
BorderPane bottomControlPane = new BorderPane();
bottomControlPane.setLeft(leftControlPane);
bottomControlPane.setRight(rightControlPane);
root.setBottom(bottomControlPane);
GridPane gridPane = buildConfigGridPane(this);
root.setCenter(gridPane);
root.setStyle(
"-fx-background-color: rgba(0, 0, 0, 1); -fx-background-radius: 8px; -fx-border-radius: 8px; -fx-border-width: 5px; -fx-border-color: rgba(60, 63, 65, 0.7); -fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.8), 10, 0, 0, 0);");
}
示例12: createHorizontalBox
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
public static HBox createHorizontalBox(double width, double height, double translateX, double translateY, String style, Pos alignment, Insets insets)
{
HBox box = createHorizontalBox(width, height, translateX, translateY, style, insets);
box.setAlignment(alignment);
return box;
}
示例13: constructContainer
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
@Override
public Parent constructContainer() {
webContent.loadContent("<html><body><b>Missing a manual</b></body></html>");
try {
// To avoid strange chars like "", the html -Tag is added here separately:
webContent.loadContent("<html>"+Functions.fileToString(new File(
"src/views/txt/anleitung.htm"))+"</html>");
} catch (Exception e) {
e.printStackTrace();
}
double pageWidth = this.getFXController().getMyFXStage().getOPTIMAL_WIDTH();
double pageHeight = this.getFXController().getMyFXStage().getOPTIMAL_HEIGHT();
debug.Debugger.out("ManualView sizes: w:"+pageWidth+" h:"+pageHeight);
//webPage.setPrefHeight(pageHeight);
//webContent.setJavaScriptEnabled(true);
webPage.setPrefWidth(pageWidth*.93);
webPage.applyCss();
webPage.setId("anleitung");
Label labelTitel = new Label("Anleitung");
labelTitel.setId("anleitungstitel");
BackButton backBtn = new BackButton(this.getFXController());
BorderPane headLayout = new BorderPane(labelTitel);
headLayout.setPadding(new Insets(5));
//ScrollPane scroller = new ScrollPane();
//scroller.setMaxWidth(800);
//scroller.setHbarPolicy(ScrollBarPolicy.NEVER);
//scroller.setVbarPolicy(ScrollBarPolicy.ALWAYS);
//scroller.setContent(contentLayout);
VBox contentLayout = new VBox(0);
contentLayout.getChildren().addAll(webPage);
contentLayout.setMinHeight(pageHeight*0.6);
contentLayout.setPrefWidth(pageWidth*.93);
HBox controlLayout = new HBox(5);
controlLayout.setAlignment(Pos.BOTTOM_CENTER);
controlLayout.getChildren().addAll(backBtn);
controlLayout.setPadding(new Insets(10));
BorderPane mainLayout = new BorderPane();
mainLayout.setPadding(new Insets(25));
mainLayout.setTop(headLayout);
mainLayout.setCenter(contentLayout);
mainLayout.setBottom(controlLayout);
return mainLayout;
}
示例14: Mesazhi
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
public Mesazhi(String titulli, String titulli_msg, String mesazhi, ShikoKonsumatoret sk, int skId){
stage.setTitle(titulli);
stage.initModality(Modality.APPLICATION_MODAL);
stage.setResizable(false);
Button btnAnulo = new Button("Anulo");
HBox root = new HBox(15);
VBox sub_root = new VBox(10);
HBox btn = new HBox(5);
Text ttl = new Text(titulli_msg);
ttl.setFont(Font.font(16));
Button btnOk = new Button("Ne rregull");
btn.getChildren().addAll(btnAnulo, btnOk);
btn.setAlignment(Pos.CENTER_RIGHT);
btnOk.setOnAction(e -> {
sk.fshi(skId);
stage.close();
});
btnOk.setOnKeyPressed(e -> {
if (e.getCode().equals(KeyCode.ENTER)) stage.close();
else if (e.getCode().equals(KeyCode.ESCAPE)) stage.close();
});
btnAnulo.setOnAction(e -> stage.close());
root.setPadding(new Insets(20));
sub_root.getChildren().addAll(ttl, new Label(mesazhi), btn);
if (titulli == "Gabim")
root.getChildren().add(new ImageView(new Image("/sample/foto/error.png")));
else if (titulli == "Sukses")
root.getChildren().add(new ImageView(new Image("/sample/foto/success.png")));
else if (titulli == "Informacion")
root.getChildren().add(new ImageView(new Image("/sample/foto/question.png")));
else if (titulli == "Info")
root.getChildren().add(new ImageView(new Image("/sample/foto/info.png")));
root.getChildren().add(sub_root);
root.setAlignment(Pos.TOP_CENTER);
Scene scene = new Scene(root, 450, 150);
scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
btnOk.isFocused();
stage.setScene(scene);
stage.show();
}
示例15: getActionPane
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
private VBox getActionPane(){
progress= new Text("Gate\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");
Image iconf= new Image(AllAttendance.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);
Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);
txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");
txtsearch= new TextField();
initFilter();
Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
setAddAttendance();
});
Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");
btnView.setOnAction(e -> {
timelineDown.play();
});
btnCloseView.setOnAction(e -> {
timelineUp.play();
});
VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);
HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);
//btnadd was beside txtfinger
VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));
HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
}