本文整理匯總了Java中javafx.scene.layout.RowConstraints類的典型用法代碼示例。如果您正苦於以下問題:Java RowConstraints類的具體用法?Java RowConstraints怎麽用?Java RowConstraints使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RowConstraints類屬於javafx.scene.layout包,在下文中一共展示了RowConstraints類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import javafx.scene.layout.RowConstraints; //導入依賴的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.RowConstraints; //導入依賴的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: updateRowConstraints
import javafx.scene.layout.RowConstraints; //導入依賴的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);
}
示例4: initializeGrid
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
private void initializeGrid() {
grid = new GridPane();
//grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(25, 25, 25, 25));
grid.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
ColumnConstraints c1 = new ColumnConstraints();
c1.setFillWidth(true);
c1.setHgrow(Priority.ALWAYS);
grid.getColumnConstraints().addAll(new ColumnConstraints(), c1, new ColumnConstraints());
RowConstraints r2 = new RowConstraints();
r2.setFillHeight(true);
r2.setVgrow(Priority.ALWAYS);
}
示例5: getDemoPane
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
public GridPane getDemoPane() {
GridPane pane = new GridPane();
pane.add(framedGauge1, 0, 0);
pane.add(framedGauge2, 1, 0);
pane.add(gauge3, 2, 0);
pane.add(gauge4, 3, 0);
pane.add(gauge5, 4, 0);
pane.add(clock1, 5, 0);
pane.add(clock5, 6, 0);
pane.add(gauge22, 7, 0);
pane.add(gauge29, 8, 0);
pane.add(gauge6, 0, 1);
pane.add(gauge7, 1, 1);
pane.add(gauge8, 2, 1);
pane.add(gauge9, 3, 1);
pane.add(gauge10, 4, 1);
pane.add(clock2, 5, 1);
pane.add(gauge21, 6, 1);
pane.add(gauge23, 7, 1);
pane.add(gauge30, 8, 1);
pane.add(gauge11, 0, 2);
pane.add(gauge12, 1, 2);
pane.add(gauge13, 2, 2);
pane.add(gauge14, 3, 2);
pane.add(gauge15, 4, 2);
pane.add(clock3, 5, 2);
pane.add(clock6, 6, 2);
pane.add(clock8, 7, 2);
pane.add(gauge31, 8, 2);
pane.add(gauge16, 0, 3);
pane.add(gauge17, 1, 3);
pane.add(gauge18, 2, 3);
pane.add(gauge19, 3, 3);
pane.add(gauge20, 4, 3);
pane.add(clock4, 5, 3);
pane.add(clock7, 6, 3);
pane.add(gauge24, 7, 3);
pane.add(clock12, 8, 3);
pane.add(gauge25, 0, 4);
pane.add(gauge26, 1, 4);
pane.add(gauge27, 2, 4);
pane.add(gauge28, 4, 4);
pane.add(clock9, 5, 4);
pane.add(clock10, 6, 4);
pane.add(clock11, 7, 4);
pane.setHgap(10);
pane.setVgap(10);
pane.setPadding(new Insets(10));
for (int i = 0 ; i < 9 ; i++) {
pane.getColumnConstraints().add(new ColumnConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
}
for (int i = 0 ; i < 5 ; i++) {
pane.getRowConstraints().add(new RowConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
}
pane.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY)));
return pane;
}
示例6: makeGrid
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
private void makeGrid() {
myGrid = new GridPane();
myGrid.setMaxHeight(getScreenHeight());
myGrid.setMaxWidth(getScreenWidth());
for (int i = 0; i < getNumRows(); i++) {
RowConstraints row = new RowConstraints(getScreenHeight()/getNumRows());
myGrid.getRowConstraints().add(row);
}
for (int j = 0; j < getNumCols(); j++) {
ColumnConstraints col = new ColumnConstraints(getScreenWidth()/getNumCols());
myGrid.getColumnConstraints().add(col);
}
for (int i = 0; i < getNumRows(); i++) {
for (int j = 0; j < getNumCols(); j++) {
myGrid.add(new Rectangle(CELL_SIZE, CELL_SIZE, Color.WHITESMOKE), j, i);
}
}
this.getChildren().clear();
this.getChildren().add(myGrid);
}
示例7: sector
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
/**
* Sets constraints of the columns and rows of the grid pane.
*/
private void sector () {
gameDisplayProperties = VoogaBundles.GameDisplayProperties;
ColumnConstraints leftColumn = new ColumnConstraints();
leftColumn.setPercentWidth(getConstraint("leftColConstraints"));
ColumnConstraints rightColumn = new ColumnConstraints();
rightColumn.setPercentWidth(getConstraint("rightColConstraints"));
RowConstraints topRow = new RowConstraints();
topRow.setPercentHeight(getConstraint("topRowConstraints"));
RowConstraints middleRow = new RowConstraints();
middleRow.setPercentHeight(getConstraint("middleRowConstraints"));
RowConstraints bottomRow = new RowConstraints();
bottomRow.setPercentHeight(getConstraint("bottomRowConstraints"));
this.getColumnConstraints().addAll(leftColumn, rightColumn);
this.getRowConstraints().addAll(topRow, middleRow, bottomRow);
}
示例8: initGridPane
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
private void initGridPane() {
List<NodeDescriptor> nodes = puzzle.getNodeDescriptors();
int gridRows = nodes.stream()
.mapToInt(NodeDescriptor::getRow)
.max().getAsInt(),
gridCols = nodes.stream()
.mapToInt(NodeDescriptor::getColumn)
.max().getAsInt();
for (int i = 0; i < gridRows; ++i) {
sourceCodeGridPane.getRowConstraints().add(new RowConstraints(300));
}
for (int i = 0; i < gridCols; ++i) {
sourceCodeGridPane.getColumnConstraints().add(new ColumnConstraints(300));
}
}
示例9: applyRowConstraints
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
/**
* Method to apply the {@link RowConstraints} needed.
*/
private void applyRowConstraints() {
RowConstraints sinceFailureRow = new RowConstraints();
sinceFailureRow.setPercentHeight( SINCE_FAILURE_COMMITTERS_ROW_PERCENT );
sinceFailureRow.setMaxHeight( Double.MAX_VALUE );
RowConstraints newCommittersRow = new RowConstraints();
newCommittersRow.setPercentHeight( NEW_COMMITTERS_ROW_PERCENT );
newCommittersRow.setMaxHeight( Double.MAX_VALUE );
RowConstraints builtOnRow = new RowConstraints();
builtOnRow.setPercentHeight( BUILT_ON_ROW_PERCENT );
builtOnRow.setMaxHeight( Double.MAX_VALUE );
RowConstraints failuresRow = new RowConstraints();
failuresRow.setPercentHeight( FAILURES_ROW_PERCENT );
failuresRow.setMaxHeight( Double.MAX_VALUE );
getRowConstraints().addAll( sinceFailureRow, newCommittersRow, builtOnRow, failuresRow );
}
示例10: shouldRestrainRowToFitInPanel
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
@Test public void shouldRestrainRowToFitInPanel(){
assertThat( systemUnderTest.getRowConstraints(), hasSize( 4 ) );
RowConstraints constraint = systemUnderTest.getRowConstraints().get( 0 );
assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
assertThat( constraint.getPercentHeight(), is( FailureDetail.SINCE_FAILURE_COMMITTERS_ROW_PERCENT ) );
constraint = systemUnderTest.getRowConstraints().get( 1 );
assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
assertThat( constraint.getPercentHeight(), is( FailureDetail.NEW_COMMITTERS_ROW_PERCENT ) );
constraint = systemUnderTest.getRowConstraints().get( 2 );
assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
assertThat( constraint.getPercentHeight(), is( FailureDetail.BUILT_ON_ROW_PERCENT ) );
constraint = systemUnderTest.getRowConstraints().get( 3 );
assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
assertThat( constraint.getPercentHeight(), is( FailureDetail.FAILURES_ROW_PERCENT ) );
}
示例11: establishGridPane
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
/**
* Creates the 5 different panels that are used to hold different windows of
* the program
*/
private void establishGridPane() {
grid = new GridPane();
ColumnConstraints leftColumn = new ColumnConstraints();
leftColumn.setPercentWidth(COL70);
ColumnConstraints rightColumn = new ColumnConstraints();
rightColumn.setPercentWidth(COL30);
grid.getColumnConstraints().addAll(leftColumn, rightColumn);
for (int i = 0; i < 24; i++) {
RowConstraints row = new RowConstraints();
row.setPercentHeight(TWENTY_FOURTH);
grid.getRowConstraints().add(row);
}
List<Region> windows = Arrays.asList(variables, methods, history, console);
for (Region window : windows) {
windowsShowing.put(window.getClass().toString(), new Pair<Region, Boolean>(window, true));
}
setTopLeft(tabify(graphicsWindow, false));
setBottomLeft(tabify(displayedEditor, false));
setRightPanels(windowsShowing);
}
示例12: createColumnGridControls
import javafx.scene.layout.RowConstraints; //導入依賴的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;
}
示例13: createRowGridControls
import javafx.scene.layout.RowConstraints; //導入依賴的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;
}
示例14: createColumnGridControls
import javafx.scene.layout.RowConstraints; //導入依賴的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;
}
示例15: initLayout
import javafx.scene.layout.RowConstraints; //導入依賴的package包/類
@Override
public Parent initLayout()
{
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setHgap(10);
grid.setPadding(new Insets(10));
int row = 0;
grid.add(this.projectRepoLabel, 0, row); grid.add(this.projectRepoValue, 1, row); row++;
grid.add(this.versionLabel, 0, row); grid.add(this.versionValue, 1, row); row++;
grid.add(this.compatVersionLabel, 0, row); grid.add(this.compatVersionValue, 1, row); row++;
grid.add(this.gitCommitDateLabel, 0, row); grid.add(this.gitCommitDateValue, 1, row); row++;
grid.add(this.gitCommitHashLabel, 0, row); grid.add(this.gitCommitHashValue, 1, row); row++;
grid.add(this.buildDateLabel, 0, row); grid.add(this.buildDateValue, 1, row); row++;
for (int i = 0; i < row; i++)
{
RowConstraints rc = new RowConstraints();
rc.setPrefHeight(22);
grid.getRowConstraints().add(rc);
}
return grid;
}