本文整理汇总了Java中javafx.scene.layout.Region类的典型用法代码示例。如果您正苦于以下问题:Java Region类的具体用法?Java Region怎么用?Java Region使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Region类属于javafx.scene.layout包,在下文中一共展示了Region类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initUi
import javafx.scene.layout.Region; //导入依赖的package包/类
private void initUi() {
super.getChildren().addAll(titleBar, outerStackPane);
outerStackPane.getChildren().add(innerStackPane);
innerStackPane.getChildren().add(noElementSelectedLabel);
content.addListener((v, o, n) -> onContentChanged(o, n));
outerStackPane.setMinHeight(0);
outerStackPane.setAlignment(Pos.TOP_CENTER);
innerStackPane.setMinHeight(Region.USE_PREF_SIZE);
noElementSelectedLabel.visibleProperty().bind(showingProperty().not());
noElementSelectedLabel.setText(LABEL_TEXT);
noElementSelectedLabel.getStyleClass().setAll(LABEL_STYLE_CLASS);
collapseAnimator.apply(titleBar.expandedProperty(), titleBar.animatedProperty(), outerStackPane);
}
示例2: createUi
import javafx.scene.layout.Region; //导入依赖的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: createAndShowTableWindow
import javafx.scene.layout.Region; //导入依赖的package包/类
private void createAndShowTableWindow(ComboBox<String> traceNameComboBox) {
openedWindowsCtr++;
List<String> traceNames = new ArrayList<>();
for (int i = 0; i < plotData.getAllTraces().size(); i++) {
traceNames.add(plotData.getAllTraces().get(i).getTraceName());
}
traceNameComboBox.setItems(FXCollections.observableList(traceNames));
traceNameComboBox.getSelectionModel().select(0);
HBox hbox = new HBox();
traceNameComboBox.getSelectionModel().select(0);
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
hbox.getChildren().addAll(new Label("Please Select a trace :"), spacer, traceNameComboBox);
updateTableValues(traceNameComboBox);
Scene scene = new Scene(new Group());
VBox vbox = new VBox();
VBox.setVgrow(table, Priority.ALWAYS);
vbox.setSpacing(5);
vbox.setPadding(new Insets(10, 10, 10, 10));
vbox.prefWidthProperty().bind(scene.widthProperty());
vbox.prefHeightProperty().bind(scene.heightProperty());
vbox.getChildren().addAll(hbox, table);
((Group) scene.getRoot()).getChildren().addAll(vbox);
Stage stage = new Stage();
stage.setOnCloseRequest(e -> closeTableWindow());
stage.setWidth(300);
stage.setHeight(400);
stage.setScene(scene);
stage.sizeToScene();
stage.showAndWait();
}
示例4: AddPropertiesView
import javafx.scene.layout.Region; //导入依赖的package包/类
public AddPropertiesView(TestPropertiesInfo issueInfo) {
this.issueInfo = issueInfo;
initComponents();
// @formatter:off
Label severityLabel = new Label("Severity: ");
severityLabel.setMinWidth(Region.USE_PREF_SIZE);
tmsLink.setOnAction((e) -> {
try {
Desktop.getDesktop().browse(new URI(tmsLink.getText()));
} catch (Exception e1) {
FXUIUtils._showMessageDialog(null, "Unable to open link: " + tmsLink.getText(), "Unable to open link",
AlertType.ERROR);
e1.printStackTrace();
}
});
formPane.addFormField("Name: ", nameField)
.addFormField("Description: ", descriptionField)
.addFormField("ID: ", idField, severityLabel, severities);
String tmsPattern = System.getProperty(Constants.PROP_TMS_PATTERN);
if (tmsPattern != null && tmsPattern.length() > 0) {
tmsLink.textProperty().bind(Bindings.format(tmsPattern, idField.textProperty()));
formPane.addFormField("", tmsLink);
}
// @formatter:on
setCenter(content);
}
示例5: initComponents
import javafx.scene.layout.Region; //导入依赖的package包/类
private void initComponents() {
VBox.setVgrow(fixtureList, Priority.ALWAYS);
fixtureList.setId("fixture-list-view");
fixtureList.setItems(fixtuers);
fixtureList.setOnMouseClicked((e) -> {
if (e.getClickCount() == 2)
onSelect(fixtureList.getSelectionModel().getSelectedItem());
});
fixtureList.getSelectionModel().select(selectedFixture);
fixtureList.getSelectionModel().selectedIndexProperty().addListener((listener) -> {
updateButtonState();
});
selectButton.setOnAction((e) -> onSelect(fixtureList.getSelectionModel().getSelectedItem()));
cancelButton.setOnAction((e) -> onCancel());
buttonBar.getButtons().addAll(selectButton, cancelButton);
buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
updateButtonState();
}
示例6: createBrowserField
import javafx.scene.layout.Region; //导入依赖的package包/类
private HBox createBrowserField() {
HBox browseFieldBox = new HBox(5);
dirField = new TextField();
dirField.setId("DirectoryField");
dirField.textProperty().addListener((observable, oldValue, newValue) -> updateOKButton());
HBox.setHgrow(dirField, Priority.ALWAYS);
Button browseButton = FXUIUtils.createButton("browse", "Browse directory", true, "Browse");
FileSelectionHandler browserListener;
String fileType = fileSelectionInfo.getFileType();
if (fileType != null) {
browserListener = new FileSelectionHandler(this,
new ExtensionFilter(fileType, Arrays.asList(fileSelectionInfo.getExtensionFilters())), this, null,
fileSelectionInfo.getTitle());
} else {
browserListener = new FileSelectionHandler(this, null, this, null, fileSelectionInfo.getTitle());
browserListener.setMode(FileSelectionHandler.DIRECTORY_CHOOSER);
}
browserListener.setPreviousDir(new File(System.getProperty(Constants.PROP_PROJECT_DIR, ProjectLayout.projectDir)));
browseButton.setOnAction(browserListener);
Label label = createLabel("Name: ");
label.setMinWidth(Region.USE_PREF_SIZE);
label.setId("FileSelectedLabel");
browseFieldBox.getChildren().addAll(label, dirField, browseButton);
VBox.setMargin(browseFieldBox, new Insets(5, 5, 5, 5));
return browseFieldBox;
}
示例7: _initButtonBase
import javafx.scene.layout.Region; //导入依赖的package包/类
public static ButtonBase _initButtonBase(String name, String toolTip, boolean enabled, String buttonText, ButtonBase button) {
button.setId(name + "Button");
button.setTooltip(new Tooltip(toolTip));
Node enabledIcon = getImageFrom(name, "icons/", FromOptions.NULL_IF_NOT_EXISTS);
if (enabledIcon != null) {
button.setText(null);
button.setGraphic(enabledIcon);
}
if (buttonText != null) {
button.setText(buttonText);
} else if (enabledIcon == null) {
button.setText(name);
}
button.setDisable(!enabled);
button.setMinWidth(Region.USE_PREF_SIZE);
return button;
}
示例8: initComponents
import javafx.scene.layout.Region; //导入依赖的package包/类
private void initComponents() {
VBox.setVgrow(historyView, Priority.ALWAYS);
historyView.setItems(FXCollections.observableArrayList(runHistoryInfo.getTests()));
historyView.setCellFactory(new Callback<ListView<JSONObject>, ListCell<JSONObject>>() {
@Override public ListCell<JSONObject> call(ListView<JSONObject> param) {
return new HistoryStateCell();
}
});
VBox historyBox = new VBox(5);
HBox.setHgrow(historyBox, Priority.ALWAYS);
countField.setText(getRemeberedCount());
if (countNeeded) {
form.addFormField("Max count of remembered runs: ", countField);
}
historyBox.getChildren().addAll(new Label("Select test", FXUIUtils.getIcon("params")), historyView, form);
verticalButtonBar.setId("vertical-buttonbar");
historyPane.setId("history-pane");
historyPane.getChildren().addAll(historyBox, verticalButtonBar);
doneButton.setOnAction((e) -> onOK());
buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
buttonBar.getButtons().addAll(doneButton);
}
示例9: initProgressBarUI
import javafx.scene.layout.Region; //导入依赖的package包/类
private void initProgressBarUI() {
Label runLabel = new Label("Runs: ");
runLabel.setMinWidth(Region.USE_PREF_SIZE);
nRuns = new Text((int) progress + "/" + maxTestCount);
Label errorLabel = new Label("Errors: ");
errorLabel.setMinWidth(Region.USE_PREF_SIZE);
errorLabel.setGraphic(FXUIUtils.getIcon("error"));
errorLabel.setPadding(new Insets(0, 0, 0, 80));
errorText = new Text(errors + "");
Label failureLabel = new Label("Failures: ");
failureLabel.setMinWidth(Region.USE_PREF_SIZE);
failureLabel.setGraphic(FXUIUtils.getIcon("failure"));
failureLabel.setPadding(new Insets(0, 0, 0, 80));
failureText = new Text(failures + "");
progressBarString.setAlignment(Pos.CENTER);
progressBarString.setPadding(new Insets(5, 0, 5, 0));
progressBarString.getChildren().addAll(runLabel, nRuns, errorLabel, errorText, failureLabel, failureText);
}
示例10: initComponents
import javafx.scene.layout.Region; //导入依赖的package包/类
private void initComponents() {
initCheckList();
splitPane.getItems().addAll(leftPane, rightPane);
splitPane.setDividerPositions(0.25);
boolean insert = checkListInfo.isInsert();
if (insert) {
doneButton = FXUIUtils.createButton("insert", "Insert", true, "Insert");
doneButton.setOnAction((e) -> onInsert());
doneButton.setDisable(true);
} else {
doneButton = FXUIUtils.createButton("ok", "Done", true, "Done");
doneButton.setOnAction((e) -> onDone());
}
buttonBar.getButtons().addAll(doneButton);
if (insert) {
Button cancelButton = FXUIUtils.createButton("cancel", "Cancel", true, "Cancel");
cancelButton.setOnAction((e) -> onCancel());
buttonBar.getButtons().add(cancelButton);
}
buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
}
示例11: initCheckList
import javafx.scene.layout.Region; //导入依赖的package包/类
private void initCheckList() {
ToolBar toolBar = new ToolBar();
toolBar.getItems().add(new Text("Check Lists"));
toolBar.setMinWidth(Region.USE_PREF_SIZE);
leftPane.setTop(toolBar);
checkListElements = checkListInfo.getCheckListElements();
checkListView = new ListView<CheckListForm.CheckListElement>(checkListElements);
checkListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
CheckListElement selectedItem = checkListView.getSelectionModel().getSelectedItem();
if (selectedItem == null) {
doneButton.setDisable(true);
return;
}
Node checkListForm = getChecklistFormNode(selectedItem, Mode.DISPLAY);
if (checkListForm == null) {
doneButton.setDisable(true);
return;
}
doneButton.setDisable(false);
ScrollPane sp = new ScrollPane(checkListForm);
sp.setFitToWidth(true);
sp.setPadding(new Insets(0, 0, 0, 10));
rightPane.setCenter(sp);
});
leftPane.setCenter(checkListView);
}
示例12: initComponents
import javafx.scene.layout.Region; //导入依赖的package包/类
private void initComponents() {
webView.setId("webView");
webView.getEngine().getLoadWorker().stateProperty().addListener(new HyperlinkRedirectListener(webView));
VBox.setVgrow(webView, Priority.ALWAYS);
WebEngine engine = webView.getEngine();
if (blurbInfo.getURL() != null)
engine.load(blurbInfo.getURL().toExternalForm());
else
engine.loadContent(blurbInfo.getHtml());
buttonBar.setId("buttonBar");
buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
buttonBar.getButtons().add(okButton);
if (blurbInfo.isCancelNeeded()) {
buttonBar.getButtons().add(cancelButton);
}
okButton.setOnAction((e) -> onOk());
cancelButton.setOnAction((e) -> onCancel());
}
示例13: TabView
import javafx.scene.layout.Region; //导入依赖的package包/类
public TabView() {
anchorPane.getChildren().addAll(txtDirPath, scrollPane);
anchorPane.setTopAnchor(txtDirPath, 0.0);
anchorPane.setLeftAnchor(txtDirPath, 0.0);
anchorPane.setRightAnchor(txtDirPath, 0.0);
anchorPane.setTopAnchor(scrollPane, 30.0);
anchorPane.setLeftAnchor(scrollPane, 0.0);
anchorPane.setRightAnchor(scrollPane, 0.0);
anchorPane.setBottomAnchor(scrollPane, 0.0);
scrollPane.setFitToWidth(true);
scrollPane.setContent(tilePane);
txtDirPath.setText(homeDir);
txtDirPath.getStyleClass().add("fileURLField");
tilePane.getStyleClass().add("tile-pane");
tilePane.setMaxWidth(Region.USE_PREF_SIZE);
}
示例14: initialize
import javafx.scene.layout.Region; //导入依赖的package包/类
@Override
public void initialize() {
VersionReader versionReader = new VersionReader();
versionReader.readInfo("jwk-util");
Text version = new Text(String.format("Version %s (%s)", versionReader.getReleaseVersion(), versionReader.getBuildTime()));
version.setFont(versionFont);
HBox bottom = new HBox();
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
bottom.getChildren().addAll(spacer, version);
bottom.setPadding(new Insets(10, 10, 5, 0));
rootPane.setBottom(bottom);
}
示例15: makeScalable
import javafx.scene.layout.Region; //导入依赖的package包/类
private static void makeScalable(Scene scene, Region region) {
double regionWidth = region.getPrefWidth();
double sceneWidth = scene.getWidth();
double regionHeight = region.getPrefHeight();
double sceneHeight = scene.getHeight();
if (regionWidth != -1.0) {
ChangeListener<Number> widthResizer = (arg0, oldValue, newValue) -> region.setPrefWidth(regionWidth / sceneWidth * newValue.doubleValue());
scene.widthProperty().addListener(widthResizer);
}
if (regionHeight != -1.0) {
ChangeListener<Number> heightResizer = (arg0, oldValue, newValue) -> region.setPrefHeight(regionHeight / sceneHeight * newValue.doubleValue());
scene.heightProperty().addListener(heightResizer);
}
}