本文整理匯總了Java中javafx.scene.layout.ColumnConstraints.setPercentWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java ColumnConstraints.setPercentWidth方法的具體用法?Java ColumnConstraints.setPercentWidth怎麽用?Java ColumnConstraints.setPercentWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.ColumnConstraints
的用法示例。
在下文中一共展示了ColumnConstraints.setPercentWidth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
public void start(Stage primaryStage) {
canvas = new GridPane();
canvas.setPrefSize(800,800);
canvas.setGridLinesVisible(true);
final int numCols = 9 ;
final int numRows = 8 ;
for (int i = 0; i < numCols; i++) {
ColumnConstraints colConst = new ColumnConstraints();
colConst.setPercentWidth(100.0 / numCols);
canvas.getColumnConstraints().add(colConst);
}
for (int i = 0; i < numRows; i++) {
RowConstraints rowConst = new RowConstraints();
rowConst.setPercentHeight(100.0 / numRows);
canvas.getRowConstraints().add(rowConst);
}
scene = new Scene(canvas, 800, 800);
primaryStage.setScene(scene);
bubble = new Bubble(scene);
primaryStage.show();
scene.setFill(createGridPattern());
}
示例2: EventLogger
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的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: CannotReadPrompt
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
public CannotReadPrompt(Consumer<String> directoryOpener, Runnable focusTrigger) {
super();
this.directoryOpener = directoryOpener;
this.focusTrigger = focusTrigger;
// if invisible, also remove from layout
this.managedProperty().bind(this.visibleProperty());
this.setVisible(false);
this.setVgap(SPACING / 2);
this.setHgap(SPACING / 2);
ColumnConstraints colConstraints = new ColumnConstraints();
colConstraints.setPercentWidth(50);
this.getColumnConstraints().addAll(colConstraints, colConstraints);
initUI();
}
示例4: createColumnGridControls
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
/**
* Create a GridPane containing columns that resize similarly to Swing's GridLayout(),
* where controls have their widths bound to their parent.
*
* @param nodes
* @return
*/
public static GridPane createColumnGridControls(final Node... nodes) {
GridPane pane = new GridPane();
int n = nodes.length;
double maxMinWidth = 0;
for (int i = 0; i < n; i++) {
ColumnConstraints col = new ColumnConstraints();
col.setPercentWidth(100.0/n);
pane.getColumnConstraints().add(col);
Node node = nodes[i];
pane.add(node, i, 0);
if (node instanceof Control) {
maxMinWidth = Math.max(maxMinWidth, ((Control)node).getPrefWidth());
((Control)node).prefWidthProperty().bind(pane.widthProperty().divide(n));
}
}
RowConstraints row = new RowConstraints();
row.setPercentHeight(100);
pane.getRowConstraints().add(row);
pane.setMinWidth(maxMinWidth * n);
pane.setPrefWidth(maxMinWidth * n);
return pane;
}
示例5: createRowGridControls
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
/**
* Create a GridPane containing columns that resize similarly to Swing's GridLayout(),
* while also resizing contained objects to have the corresponding widths.
*
* @param nodes
* @return
*/
public static GridPane createRowGridControls(final Node... nodes) {
GridPane pane = new GridPane();
int n = nodes.length;
for (int i = 0; i < n; i++) {
RowConstraints row = new RowConstraints();
row.setPercentHeight(100.0/n);
pane.getRowConstraints().add(row);
Node node = nodes[i];
pane.add(node, 0, i);
if (node instanceof Control) {
// ((Control)node).setMinSize(((Control) node).getPrefWidth(), ((Control) node).getPrefHeight());
((Control)node).prefWidthProperty().bind(pane.widthProperty());
}
}
ColumnConstraints col = new ColumnConstraints();
col.setPercentWidth(100);
pane.getColumnConstraints().add(col);
return pane;
}
示例6: createColumnGridControls
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
/**
* Binds the width properties to the GridPane width.
*
* @param controls
* @return
*/
public static GridPane createColumnGridControls(final Control... controls) {
GridPane pane = new GridPane();
int n = controls.length;
for (int i = 0; i < n; i++) {
ColumnConstraints col = new ColumnConstraints();
col.setPercentWidth(100.0/n);
pane.getColumnConstraints().add(col);
Control control = controls[i];
pane.add(control, i, 0);
control.prefWidthProperty().bind(pane.widthProperty().divide(n));
}
RowConstraints row = new RowConstraints();
row.setPercentHeight(100);
pane.getRowConstraints().add(row);
return pane;
}
示例7: BuildWallConfigurationPanelImpl
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
/**
* Constructs a new {@link BuildWallConfigurationPanelImpl}.
* @param configuration the {@link BuildWallConfiguration} to configure.
* @param title the title of the panel.
*/
public BuildWallConfigurationPanelImpl( String title, BuildWallConfiguration configuration ) {
this.configuration = configuration;
this.styling = new JavaFxStyle();
constructTitle( title );
constructDimensions();
constructJobPoliciesPane();
constructFontItemPane();
constructColourItemPane();
ColumnConstraints width = new ColumnConstraints();
width.setPercentWidth( 100 );
width.setHgrow( Priority.ALWAYS );
getColumnConstraints().addAll( width );
}
示例8: createMetadata
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
private void createMetadata() {
metadata = new VBox();
metadata.getStyleClass().add(Constants.CSS_INSPECTIONPART);
VBox.setVgrow(metadata, Priority.ALWAYS);
metadataGrid = new GridPane();
metadataGrid.setVgap(5);
metadataGrid.setPadding(new Insets(5, 5, 5, 5));
metadataGrid.setStyle(ConfigurationManager.getStyle(Constants.CSS_BACKGROUNDWHITE));
ColumnConstraints column1 = new ColumnConstraints();
column1.setPercentWidth(25);
ColumnConstraints column2 = new ColumnConstraints();
column2.setPercentWidth(75);
metadataGrid.getColumnConstraints().addAll(column1, column2);
metadataFormWrapper = new ScrollPane();
metadataFormWrapper.setContent(metadataGrid);
metadataFormWrapper.setFitToWidth(true);
createMetadataHelp();
createMetadataTop();
createMetadataTextBox();
metadata.getChildren().addAll(metadataTopBox, metaText);
}
示例9: createPane
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
@Override
public void createPane() {
this.setHgap(10);
this.setVgap(10);
ColumnConstraints firstColumnConstrains = new ColumnConstraints();
ColumnConstraints secondColumnConstrains = new ColumnConstraints();
firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setHgrow(Priority.ALWAYS);
this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains);
this.addRow(0, projectNameLabel, projectNameField);
this.addRow(1, projectPathLabel, new HBox(projectPathField, pathChooserButton));
this.addRow(2, startDateLabel, startDatePicker);
this.addRow(3, finishDateLabel, finishDatePicker);
this.addRow(4, descriptionLabel, descriptionTextArea);
HBox.setHgrow(projectPathField, Priority.ALWAYS);
GridPane.setMargin(descriptionTextArea, new Insets(0, 0, 10, 0));
GridPane.setValignment(descriptionLabel, VPos.TOP);
startDatePicker.setPrefWidth(350);
finishDatePicker.setPrefWidth(350);
descriptionTextArea.setPrefHeight(200);
}
示例10: createPane
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
@Override
public void createPane() {
ColumnConstraints firstColumnConstrains = new ColumnConstraints();
ColumnConstraints secondColumnConstrains = new ColumnConstraints();
firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setHgrow(Priority.ALWAYS);
this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains);
this.addRow(0, nameLabel, nameField);
this.addRow(1, startDateLabel, startDatePicker);
this.addRow(2, finishDateLabel, finishDatePicker);
this.addRow(3, donePercentLabel, donePercentSlider);
this.addRow(4, costLabel, costField);
this.addRow(5, descriptionLabel, descriptionTextArea);
this.setVgap(10);
this.setHgap(10);
this.setPadding(new Insets(10));
startDatePicker.setPrefWidth(350);
finishDatePicker.setPrefWidth(350);
GridPane.setValignment(descriptionLabel, VPos.TOP);
}
示例11: createPane
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
@Override
public void createPane() {
ColumnConstraints firstColumnConstrains = new ColumnConstraints();
ColumnConstraints secondColumnConstrains = new ColumnConstraints();
firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setHgrow(Priority.ALWAYS);
this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains);
this.addRow(0, nameLabel, nameField);
this.addRow(1, emailLabel, emailField);
this.addRow(2, resourceTypeLabel, resourceTypeComboBox);
this.addRow(3, descriptionLabel, descriptionTextArea);
this.setVgap(10);
this.setHgap(10);
this.setPadding(new Insets(10));
emailField.setPrefWidth(350);
resourceTypeComboBox.setPrefWidth(350);
GridPane.setValignment(descriptionLabel, VPos.TOP);
}
示例12: createPane
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
@Override
public void createPane() {
ColumnConstraints firstColumnConstrains = new ColumnConstraints();
ColumnConstraints secondColumnConstrains = new ColumnConstraints();
firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH);
secondColumnConstrains.setHgrow(Priority.ALWAYS);
this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains);
this.addRow(0, nameLabel, nameField);
this.addRow(1, startDateLabel, startDatePicker);
this.addRow(2, finishDateLabel, finishDatePicker);
this.addRow(3, descriptionLabel, descriptionTextArea);
this.setVgap(10);
this.setHgap(10);
this.setPadding(new Insets(10));
startDatePicker.setPrefWidth(350);
finishDatePicker.setPrefWidth(350);
GridPane.setValignment(descriptionLabel, VPos.TOP);
}
示例13: buildDoubleClickActionsOptionPane
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
private Node buildDoubleClickActionsOptionPane() {
final ColumnConstraints firstColumn = new ColumnConstraints();
firstColumn.setPercentWidth(40);
final GridPane doubleClickOptionsPane = new GridPane();
doubleClickOptionsPane.getColumnConstraints().addAll(firstColumn);
doubleClickOptionsPane.setVgap(10);
doubleClickOptionsPane.add(new Label("For seeding torrents: "), 0, 0);
doubleClickOptionsPane.add(seedingTorrentOptionsComboBox, 1, 0);
doubleClickOptionsPane.add(new Label("For downloading torrents: "), 0, 1);
doubleClickOptionsPane.add(downloadingTorrentOptionsComboBox, 1, 1);
seedingTorrentOptionsComboBox.setMaxWidth(Double.POSITIVE_INFINITY);
downloadingTorrentOptionsComboBox.setMaxWidth(Double.POSITIVE_INFINITY);
GridPane.setHgrow(seedingTorrentOptionsComboBox, Priority.ALWAYS);
GridPane.setHgrow(downloadingTorrentOptionsComboBox, Priority.ALWAYS);
return doubleClickOptionsPane;
}
示例14: buildBasicOptionsPane
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
private Node buildBasicOptionsPane() {
final ColumnConstraints firstColumn = new ColumnConstraints();
final ColumnConstraints secondColumn = new ColumnConstraints();
firstColumn.setPercentWidth(50);
secondColumn.setPercentWidth(50);
final GridPane basicOptionsPane = new GridPane();
basicOptionsPane.getColumnConstraints().addAll(firstColumn, secondColumn);
basicOptionsPane.setVgap(10);
basicOptionsPane.add(enableDhtNetworkCheck, 0, 0);
basicOptionsPane.add(enableDhtForNewTorrentsCheck, 1, 0);
basicOptionsPane.add(enablePexCheck, 0, 1);
basicOptionsPane.add(enableLocalPeerDiscoveryCheck, 1, 1);
basicOptionsPane.add(enableWebSeedsCheck, 0, 2, 2, 1);
return basicOptionsPane;
}
示例15: buildTrackerOptionsPane
import javafx.scene.layout.ColumnConstraints; //導入方法依賴的package包/類
private Node buildTrackerOptionsPane() {
final ColumnConstraints firstColumn = new ColumnConstraints();
final ColumnConstraints secondColumn = new ColumnConstraints();
firstColumn.setPercentWidth(50);
secondColumn.setPercentWidth(50);
final GridPane basicOptionsPane = new GridPane();
basicOptionsPane.getColumnConstraints().addAll(firstColumn, secondColumn);
basicOptionsPane.setVgap(10);
basicOptionsPane.add(scrapeTrackerCheck, 0, 0);
basicOptionsPane.add(enableUdpTrackerCheck, 1, 0);
basicOptionsPane.add(reportedTrackerIpCheck, 0, 1);
basicOptionsPane.add(reportedTrackerIpField, 1, 1);
return basicOptionsPane;
}