本文整理汇总了Java中javafx.scene.layout.Priority类的典型用法代码示例。如果您正苦于以下问题:Java Priority类的具体用法?Java Priority怎么用?Java Priority使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Priority类属于javafx.scene.layout包,在下文中一共展示了Priority类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTextArea
import javafx.scene.layout.Priority; //导入依赖的package包/类
private Node createTextArea(boolean selectable, boolean editable) {
textArea = new TextArea();
textArea.setPrefRowCount(4);
textArea.setEditable(editable);
textArea.textProperty().addListener((observable, oldValue, newValue) -> {
text = textArea.getText();
});
textArea.setText(text);
ScrollPane scrollPane = new ScrollPane(textArea);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
HBox.setHgrow(scrollPane, Priority.ALWAYS);
return scrollPane;
}
示例2: EventLogger
import javafx.scene.layout.Priority; //导入依赖的package包/类
public EventLogger() {
setVisible(false);
setPrefHeight(30);
setPrefWidth(612);
ColumnConstraints column1 = new ColumnConstraints();
column1.setPercentWidth(85);
column1.setHgrow(Priority.SOMETIMES);
ColumnConstraints column2 = new ColumnConstraints();
column2.setPercentWidth(15);
column2.setHgrow(Priority.SOMETIMES);
getColumnConstraints().clear();
getColumnConstraints().addAll(column1, column2);
RowConstraints row = new RowConstraints(10, 40, 40);
row.setVgrow(Priority.SOMETIMES);
getRowConstraints().clear();
getRowConstraints().add(row);
eventLabel = buildEventLabel();
setConstraints(eventLabel, 0, 0);
GridPane.setMargin(eventLabel, new Insets(0, 10, 0, 10));
serverLabel = new Label();
setConstraints(serverLabel, 1, 0);
GridPane.setMargin(serverLabel, new Insets(0, 10, 0, 10));
getChildren().addAll(eventLabel, serverLabel);
}
示例3: createExpandableContent
import javafx.scene.layout.Priority; //导入依赖的package包/类
private static GridPane createExpandableContent(String content) {
Label label = new Label("Exception stacktrace");
TextArea textArea = new TextArea(content);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
return expContent;
}
示例4: createBody
import javafx.scene.layout.Priority; //导入依赖的package包/类
/**
* Creates the node used for the body part of each cell.
*
* In this default implementation the body consists of a grid pane with
* three columns. The middle column is used for showing the title of
* calendar entries. This column will get whatever space is left after
* the icon and the time column have used what they need. This means
* that a very long title will automatically be truncated.
*
* @return the body node
*/
protected Node createBody() {
// icon column
ColumnConstraints iconColumn = new ColumnConstraints();
// title column
ColumnConstraints descriptionColumn = new ColumnConstraints();
descriptionColumn.setFillWidth(true);
descriptionColumn.setHgrow(Priority.SOMETIMES);
descriptionColumn.setMinWidth(0);
descriptionColumn.setPrefWidth(0);
// time column
ColumnConstraints timeColumn = new ColumnConstraints();
timeColumn.setHalignment(HPos.RIGHT);
gridPane = new GridPane();
gridPane.setGridLinesVisible(true);
gridPane.setMinWidth(0);
gridPane.setPrefWidth(0);
gridPane.getStyleClass().add(AGENDA_VIEW_BODY);
gridPane.getColumnConstraints().addAll(iconColumn, descriptionColumn, timeColumn);
return gridPane;
}
示例5: launchRatiosManager
import javafx.scene.layout.Priority; //导入依赖的package包/类
private void launchRatiosManager() {
try {
mainPane.getChildren().remove(ratiosManagerUI);
// critical for puplating table
squidProject.getTask().buildSquidSpeciesModelList();
ratiosManagerUI = FXMLLoader.load(getClass().getResource("RatiosManager.fxml"));
ratiosManagerUI.setId("RatiosManager");
VBox.setVgrow(ratiosManagerUI, Priority.ALWAYS);
HBox.setHgrow(ratiosManagerUI, Priority.ALWAYS);
mainPane.getChildren().add(ratiosManagerUI);
ratiosManagerUI.setVisible(false);
showUI(ratiosManagerUI);
} catch (IOException | RuntimeException iOException) {
System.out.println("RatioManager >>>> " + iOException.getMessage());
}
}
示例6: start
import javafx.scene.layout.Priority; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
ImageView demo1Button = new ImageView();
ImageView demo2Button = new ImageView();
demo1Button.setFitWidth(200);
demo2Button.setFitWidth(200);
demo1Button.setPreserveRatio(true);
demo2Button.setPreserveRatio(true);
HBox.setHgrow(demo1Button, Priority.ALWAYS);
HBox.setHgrow(demo2Button, Priority.ALWAYS);
demo1Button.getStyleClass().add("demo1");
demo2Button.getStyleClass().add("demo2");
demo1Button.setOnMouseClicked(evt -> showDemo1());
demo2Button.setOnMouseClicked(evt -> showDemo2());
HBox container = new HBox(demo1Button, demo2Button);
Scene scene = new Scene(container);
scene.getStylesheets().add(MovieApp.class.getResource("/chooser.css").toExternalForm());
scene.getStylesheets().add(MovieApp.class.getResource("/fonts.css").toExternalForm());
primaryStage.setResizable(false);
primaryStage.setTitle("Extreme GUI Makeover");
primaryStage.setScene(scene);
primaryStage.sizeToScene();
primaryStage.setX(50);
primaryStage.setY(100);
primaryStage.show();
}
示例7: build
import javafx.scene.layout.Priority; //导入依赖的package包/类
@Override
public AlertDialog build() {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
TextArea textArea = new TextArea();
GridPane expContent = new GridPane();
Label label = new Label("Stacktrace:");
label.setTextFill(Utils.getDefaultTextColor());
initOwner(ownerStage);
setTitle(title);
setHeaderText(header);
setContentText(message);
exception.printStackTrace(pw);
String exceptionText = sw.toString();
textArea.setText(exceptionText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
getDialogPane().setExpandableContent(expContent);
return this;
}
示例8: getMessageBar
import javafx.scene.layout.Priority; //导入依赖的package包/类
private Node getMessageBar(VBox vbox) {
HBox hb = new HBox(10);
hb.setPrefHeight(32);
hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";");
CheckBox cb = new CheckBox("Do Not Show Again");
cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _message_fg + ";");
Text b = FXUIUtils.getIconAsText("close");
b.setOnMouseClicked((e) -> {
JSONObject preferences = Preferences.instance().getSection("display");
preferences.put("_doNotShowMessage", cb.isSelected());
Preferences.instance().save("display");
vbox.getChildren().remove(0);
});
Text t = new Text(_message);
hb.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(t, Priority.ALWAYS);
t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
b.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold;");
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
hb.getChildren().addAll(t, spacer, b);
return hb;
}
示例9: updateRowConstraints
import javafx.scene.layout.Priority; //导入依赖的package包/类
private void updateRowConstraints() {
int rowCount = 32; // header + 31 days
if (getSkinnable().getWeekDayLayout() == WeekDayLayoutStrategy.ALIGNED) {
rowCount += 6; // 6 = max number of empty slots / cells at the top
}
List<RowConstraints> rowConstraints = new ArrayList<>();
for (int i = 0; i <= rowCount; i++) {
RowConstraints con = new RowConstraints();
con.setFillHeight(true);
con.setPrefHeight(Region.USE_COMPUTED_SIZE);
con.setMinHeight(Region.USE_PREF_SIZE);
con.setMaxHeight(Double.MAX_VALUE);
con.setVgrow(i == 0 ? Priority.NEVER : Priority.ALWAYS);
rowConstraints.add(con);
}
grid.getRowConstraints().setAll(rowConstraints);
}
示例10: FileSelection
import javafx.scene.layout.Priority; //导入依赖的package包/类
public FileSelection(File parent) {
DialogPane dialogPane = this.getDialogPane();
dialogPane.setMaxWidth(1.7976931348623157E308D);
this.directoryView = new CheckTreeView<>();
this.directoryView.setMaxWidth(1.7976931348623157E308D);
CheckBoxTreeItem<File> root = createTree(new CheckBoxTreeItem<>(parent));
root.setExpanded(true);
directoryView.setRoot(root);
GridPane.setHgrow(this.directoryView, Priority.ALWAYS);
GridPane.setFillWidth(this.directoryView, true);
this.grid = new GridPane();
this.grid.setHgap(10.0D);
this.grid.setMaxWidth(1.7976931348623157E308D);
this.grid.setAlignment(Pos.CENTER_LEFT);
dialogPane.contentTextProperty().addListener((o) -> this.updateGrid());
this.setTitle(ControlResources.getString("Dialog.confirm.title"));
dialogPane.setHeaderText(ControlResources.getString("Dialog.confirm.header"));
dialogPane.getStyleClass().add("text-input-dialog");
dialogPane.getButtonTypes().addAll(new ButtonType[] { ButtonType.APPLY, ButtonType.CANCEL });
this.updateGrid();
this.setResultConverter((dialogButton) -> {
ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
return data == ButtonData.APPLY ? this.getValues() : null;
});
}
示例11: setupView
import javafx.scene.layout.Priority; //导入依赖的package包/类
private void setupView() {
ImageView weatherIcon = new ImageView();
weatherIcon.setImage(weatherEvent.getForecast().getWeather().getIcon());
weatherIcon.fitWidthProperty().bind(stage.widthProperty().divide(3));
weatherIcon.fitHeightProperty().bind(stage.heightProperty().multiply(1));
GridPane.setHgrow(weatherIcon, Priority.ALWAYS);
GridPane.setVgrow(weatherIcon, Priority.ALWAYS);
GridPane.setHalignment(weatherIcon, HPos.CENTER);
GridPane.setValignment(weatherIcon, VPos.CENTER);
add(weatherIcon, 0, 0);
Text txt_weather_event = new Text();
txt_weather_event.setText(controller.getWeatherEventText());
GridPane.setHgrow(txt_weather_event, Priority.ALWAYS);
GridPane.setVgrow(txt_weather_event, Priority.ALWAYS);
GridPane.setValignment(txt_weather_event, VPos.CENTER);
add(txt_weather_event, 1, 0);
}
示例12: SplitDockingContainer
import javafx.scene.layout.Priority; //导入依赖的package包/类
public SplitDockingContainer(DockingDesktop desktop, IDockingContainer parent, Node base, Dockable dockable, Split position,
double proportion) {
setMaxHeight(Double.MAX_VALUE);
setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(this, Priority.ALWAYS);
VBox.setVgrow(this, Priority.ALWAYS);
getProperties().put(DockingDesktop.DOCKING_CONTAINER, parent);
base.getProperties().put(DockingDesktop.DOCKING_CONTAINER, this);
setOrientation(position.getOrientation());
ObservableList<Node> items = getItems();
if (position == Split.LEFT || position == Split.TOP) {
items.add(new TabDockingContainer(desktop, this, dockable));
items.add(base);
} else {
items.add(base);
items.add(new TabDockingContainer(desktop, this, dockable));
}
setDividerPositions(proportion);
}
示例13: TabDockingContainer
import javafx.scene.layout.Priority; //导入依赖的package包/类
public TabDockingContainer(DockingDesktop desktop, IDockingContainer parent, Dockable base, Dockable dockable, int order,
boolean select) {
this.desktop = desktop;
dockables.add(dockable);
dockables.add(base);
setMaxHeight(Double.MAX_VALUE);
setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(this, Priority.ALWAYS);
VBox.setVgrow(this, Priority.ALWAYS);
getProperties().put(DockingDesktop.DOCKING_CONTAINER, parent);
base.setContainer(this);
dockable.setContainer(this);
getTabs().add(newTab(base));
getTabs().add(newTab(dockable));
if (select) {
getSelectionModel().select(1);
}
getSelectionModel().selectedItemProperty().addListener(listener);
setTabClosingPolicy(TabClosingPolicy.ALL_TABS);
setSide(base.getDockKey().getSide());
}
示例14: createAndShowTableWindow
import javafx.scene.layout.Priority; //导入依赖的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();
}
示例15: GoogleEntryAttendeeItem
import javafx.scene.layout.Priority; //导入依赖的package包/类
public GoogleEntryAttendeeItem(EventAttendee attendee) {
this.attendee = Objects.requireNonNull(attendee);
optionalIcon = new Label();
optionalIcon.setOnMouseClicked(evt -> setOptional(!isOptional()));
optionalIcon.getStyleClass().add("button-icon");
optionalIcon.setTooltip(new Tooltip());
statusIcon = new Label();
name = new Label();
name.setMaxWidth(Double.MAX_VALUE);
setOptional(Boolean.TRUE.equals(attendee.getOptional()));
optionalProperty().addListener(obs -> updateIcon());
updateIcon();
removeButton = new Label();
removeButton.setGraphic(new FontAwesome().create(FontAwesome.Glyph.TRASH_ALT));
removeButton.getStyleClass().add("button-icon");
removeButton.setOnMouseClicked(evt -> removeAttendee(attendee));
HBox.setHgrow(optionalIcon, Priority.NEVER);
HBox.setHgrow(name, Priority.ALWAYS);
HBox.setHgrow(removeButton, Priority.NEVER);
getStyleClass().add("attendee-item");
getChildren().addAll(optionalIcon, statusIcon, name, removeButton);
ContextMenu menu = new ContextMenu();
MenuItem optionalItem = new MenuItem("Mark as optional");
optionalItem.setOnAction(evt -> setOptional(true));
MenuItem requiredItem = new MenuItem("Mark as required");
requiredItem.setOnAction(evt -> setOptional(false));
MenuItem removeItem = new MenuItem("Remove attendee");
removeItem.setOnAction(evt -> removeAttendee(attendee));
menu.getItems().addAll(optionalItem, requiredItem, new SeparatorMenuItem(), removeItem);
addEventHandler(CONTEXT_MENU_REQUESTED, evt -> menu.show(this, evt.getScreenX(), evt.getScreenY()));
}