本文整理汇总了Java中javafx.scene.layout.ColumnConstraints类的典型用法代码示例。如果您正苦于以下问题:Java ColumnConstraints类的具体用法?Java ColumnConstraints怎么用?Java ColumnConstraints使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnConstraints类属于javafx.scene.layout包,在下文中一共展示了ColumnConstraints类的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: loadGridData
import javafx.scene.layout.ColumnConstraints; //导入依赖的package包/类
public static void loadGridData(GridPane grid,Main main, DescriptionEntretien d){
// Grid initialisation ( reset )
grid.getColumnConstraints().clear();
// Grid Creation
// for each moment of the interview we add a collumn
for (int j = 0; j < d.getNumberCols(); j++) {
ColumnConstraints c = new ColumnConstraints();
c.setMinWidth(180);
c.setPrefWidth(Control.USE_COMPUTED_SIZE);
c.setMaxWidth(Control.USE_COMPUTED_SIZE);
grid.getColumnConstraints().add(c);
}
for (int i = 0; i < 1; i++) {
for (int j = 0; j < d.getNumberCols(); j++) {
// Creation of the Moment box
MomentExpVBox mp = new MomentExpVBox(main);
addMomentExpBorderPaneListener(mp, main);
MomentExperience mom;
boolean hasMoment = false;
if (main.getCurrentDescription() != null) {
for (MomentExperience m : d.getMoments()) {
if(m.getGridCol() == j){
mom = m;
mp.setMoment(mom);
hasMoment = true;
}
}
}
if (hasMoment) {
mp.showMoment();
mp.LoadMomentData();
loadTypes(mp, main);
loadSousMoment(mp,main);
}
grid.add(mp,j,i);
}
}
}
示例3: 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);
}
示例4: WebViewPane
import javafx.scene.layout.ColumnConstraints; //导入依赖的package包/类
public WebViewPane() {
VBox.setVgrow(this, Priority.ALWAYS);
setMaxWidth(Double.MAX_VALUE);
setMaxHeight(Double.MAX_VALUE);
WebView view = new WebView();
view.setMinSize(500, 400);
view.setPrefSize(500, 400);
final WebEngine eng = view.getEngine();
eng.load("http://www.oracle.com/us/index.html");
final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
locationField.setMaxHeight(Double.MAX_VALUE);
Button goButton = new Button("Go");
goButton.setDefaultButton(true);
EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
"http://" + locationField.getText());
}
};
goButton.setOnAction(goAction);
locationField.setOnAction(goAction);
eng.locationProperty().addListener(new ChangeListener<String>() {
@Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
locationField.setText(newValue);
}
});
GridPane grid = new GridPane();
grid.setVgap(5);
grid.setHgap(5);
GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
GridPane.setConstraints(goButton,1,0);
GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
grid.getColumnConstraints().addAll(
new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
);
grid.getChildren().addAll(locationField, goButton, view);
getChildren().add(grid);
}
示例5: createGrid
import javafx.scene.layout.ColumnConstraints; //导入依赖的package包/类
private GridPane createGrid() {
//-------------------------------------------------------------------- Grid
GRID.setHgap(GRID_GAP);
GRID.setVgap(GRID_GAP);
GRID.setPadding(new Insets(GRID_GAP));
GRID.setGridLinesVisible(false);
//-------------------------------------------------------------------- Constraints
for (int i = 0; i < 2; i++) {
final ColumnConstraints column = new ColumnConstraints();
column.setFillWidth(true);
column.setHgrow(Priority.NEVER);
GRID.getColumnConstraints().add(column);
}
GRID.getColumnConstraints().get(1).setHgrow(Priority.SOMETIMES);
//-------------------------------------------------------------------- End
return GRID;
}
示例6: loadSousMoment
import javafx.scene.layout.ColumnConstraints; //导入依赖的package包/类
public static void loadSousMoment(MomentExpVBox mev,Main main){
if(mev.getChildren().size() == 1){
mev.getChildren().add(mev.getSousMomentPane());
}
for (MomentExperience m: mev.getMoment().getSousMoments()) {
MomentExpVBox tmp = new MomentExpVBox(main);
tmp.setMoment(m);
tmp.showMoment();
tmp.LoadMomentData();
ColumnConstraints c = new ColumnConstraints();
mev.getSousMomentPane().getColumnConstraints().add(c);
mev.getSousMomentPane().add(tmp,mev.getSousMomentPane().getColumnConstraints().size()-1,0);
MainViewTransformations.addMomentExpBorderPaneListener(tmp, main);
loadTypes(tmp,main);
loadSousMoment(tmp, main);
}
}
示例7: execute
import javafx.scene.layout.ColumnConstraints; //导入依赖的package包/类
@Override
public void execute() {
momentExpPane.showMoment();
main.getCurrentDescription().addMomentExp(momentExpPane.getMoment());
if(momentExpPane.getCol() == main.getCurrentDescription().getNumberCols()-1){
MomentExpVBox mb = new MomentExpVBox(main, true);
MainViewTransformations.addMomentExpBorderPaneListener(mb, main);
ColumnConstraints c = new ColumnConstraints();
c.setMinWidth(180);
c.setPrefWidth(Control.USE_COMPUTED_SIZE);
c.setMaxWidth(Control.USE_COMPUTED_SIZE);
// add a new col and the borderPane
main.getGrid().getColumnConstraints().add(c);
main.getGrid().add(mb,main.getCurrentDescription().getNumberCols(), 0);
// increase the number of col by one
main.getCurrentDescription().setNumberCols(main.getCurrentDescription().getNumberCols()+1);
}
main.needToSave();
}
示例8: createBody
import javafx.scene.layout.ColumnConstraints; //导入依赖的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;
}
示例9: initializeGrid
import javafx.scene.layout.ColumnConstraints; //导入依赖的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);
}
示例10: getDemoPane
import javafx.scene.layout.ColumnConstraints; //导入依赖的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;
}
示例11: makeGrid
import javafx.scene.layout.ColumnConstraints; //导入依赖的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);
}
示例12: 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();
}
示例13: sector
import javafx.scene.layout.ColumnConstraints; //导入依赖的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);
}
示例14: initGridPane
import javafx.scene.layout.ColumnConstraints; //导入依赖的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));
}
}
示例15: 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 );
}