Java 类javafx.scene.layout.GridPane 实例源码
项目:GazePlay
文件:Circles_handler2.java
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());
}
项目:GazePlay
文件:HeatMap.java
public void start(Stage primaryStage) {
canvas = new GridPane();
canvas.setPrefSize(1300,741);
canvas.setGridLinesVisible(false);
final int numCols = 13 ;
final int numRows = 13 ;
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);
primaryStage.setScene(scene);
//primaryStage.sizeToScene();
//primaryStage.setFullScreen(true);
primaryStage.show();
scene.setFill(createGridPattern());
}
项目:CalendarFX
文件:WeekFieldsViewSkin.java
public WeekFieldsViewSkin(final WeekFieldsView view) {
super(view);
dayOfWeekComboBox = new ComboBox<>();
dayOfWeekComboBox.getItems().addAll(DayOfWeek.values());
dayOfWeekComboBox.setValue(view.getFirstDayOfWeek());
minimalDaysInFirstWeekComboBox = new ComboBox<>();
minimalDaysInFirstWeekComboBox.getItems().addAll(1, 2, 3, 4, 5, 6, 7);
minimalDaysInFirstWeekComboBox.setValue(view.getMinimalDaysInFirstWeek());
GridPane pane = new GridPane();
pane.getStyleClass().add("content");
pane.add(new Label("First day:"), 0, 0);
pane.add(new Label("Minimum days:"), 0, 1);
pane.add(dayOfWeekComboBox, 1, 0);
pane.add(minimalDaysInFirstWeekComboBox, 1, 1);
getChildren().add(pane);
// listeners
InvalidationListener updateListener = it -> updateValues();
dayOfWeekComboBox.valueProperty().addListener(updateListener);
minimalDaysInFirstWeekComboBox.valueProperty().addListener(updateListener);
view.weekFieldsProperty().addListener(it -> {
WeekFields fields = view.getWeekFields();
dayOfWeekComboBox.setValue(fields.getFirstDayOfWeek());
minimalDaysInFirstWeekComboBox.setValue(fields.getMinimalDaysInFirstWeek());
});
}
项目:FEFEditor
文件:Terrain.java
private void setupGrid() {
tileLabels = new Label[32][32];
for (int y = 0; y < 32; y++) {
gridPane.getColumnConstraints().get(y).setFillWidth(true);
gridPane.getRowConstraints().get(y).setFillHeight(true);
for (int x = 0; x < 32; x++) {
Label label = new Label();
label.setMinSize(5.0, 5.0);
label.setText(file.getMap()[x][y] + "");
label.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
label.setId(label.getText().equals("0") ? "inactiveTile" : "activeTile");
tileLabels[x][y] = label;
gridPane.getChildren().add(label);
GridPane.setConstraints(label, x, y);
int coordX = x;
int coordY = y;
label.setOnMouseClicked(event -> setTile(coordX, coordY));
}
}
}
项目:FEFEditor
文件:Dispo.java
private void setupDispoGrid() {
dispoRegion = new Region[32][32];
for (int y = 0; y < 32; y++) {
dispoGrid.getColumnConstraints().get(y).setFillWidth(true);
dispoGrid.getRowConstraints().get(y).setFillHeight(true);
for (int x = 0; x < 32; x++) {
Region region = new Region();
region.setMinSize(5.0, 5.0);
region.setId("dispoGrid");
region.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
dispoRegion[x][y] = region;
dispoGrid.getChildren().add(region);
GridPane.setConstraints(region, x, y);
int yCoord = y;
int xCoord = x;
region.setOnMouseClicked(event -> moveBlock(xCoord, yCoord));
}
}
}
项目:ChessMaster
文件:RenderEngineSelector.java
@Override
public void start(Stage primaryStage) throws Exception {
GridPane pane = new GridPane();
pane.setAlignment(Pos.CENTER);
pane.setMaxSize(800, 600);
pane.setPrefSize(800, 600);
pane.setManaged(true);
pane.setVgap(3);
pane.setHgap(3);
pane.addRow(1, new Label("Chess Master"));
ComboBox<RenderWrapper> renderCombo = new ComboBox<>();
renderCombo.getItems().addAll(new RenderWrapper(new BGFXRenderer()), new RenderWrapper(new OpenGLRenderer()));
ChessMaster.getPluginManager().getExtensions(Renderer.class).stream().map(RenderWrapper::new).forEach(renderCombo.getItems()::add);
pane.addRow(2, new Label("Select a renderer:"), renderCombo);
Button button = new Button("Start!");
button.setOnAction(event -> {
ChessMaster.getLogger().info("Using renderer: {} ({})", renderCombo.getSelectionModel().getSelectedItem().renderer.getName(), renderCombo.getSelectionModel().getSelectedItem().renderer.getClass().getName());
renderCombo.getSelectionModel().getSelectedItem().renderer.render();
primaryStage.close();
});
pane.addRow(3, button);
primaryStage.setScene(new Scene(pane));
primaryStage.show();
}
项目:Matcher
文件:FieldInfoTab.java
private void init() {
GridPane grid = new GridPane();
grid.setPadding(new Insets(GuiConstants.padding));
grid.setHgap(GuiConstants.padding);
grid.setVgap(GuiConstants.padding);
int row = 0;
row = addRow("Owner", ownerLabel, grid, row);
row = addRow("Name", nameLabel, grid, row);
row = addRow("Type", typeLabel, grid, row);
row = addRow("Access", accessLabel, grid, row);
row = addRow("Signature", sigLabel, grid, row);
row = addRow("Parents", parentLabel, grid, row);
row = addRow("Children", childLabel, grid, row);
row = addRow("Read refs", readRefLabel, grid, row);
row = addRow("Write refs", writeRefLabel, grid, row);
row = addRow("Comment", mapCommentLabel, grid, row);
setContent(grid);
}
项目:smoothcharts
文件:Demo.java
@Override public void start(Stage stage) {
GridPane pane = new GridPane();
pane.setBackground(new Background(new BackgroundFill(Color.DARKGRAY, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setPadding(new Insets(10));
pane.setHgap(10);
pane.setVgap(10);
pane.add(lineChartNotSmoothed, 0, 0);
pane.add(lineChartSmoothed, 1, 0);
pane.add(areaChartNotSmoothed, 0, 1);
pane.add(areaChartSmoothed, 1, 1);
pane.add(tweakedChart, 0, 2);
pane.add(tweaked2Chart, 1, 2);
Scene scene = new Scene(pane);
stage.setTitle("Smooth Charts");
stage.setScene(scene);
stage.show();
}
项目:charts
文件:ChartTest.java
@Override public void start(Stage stage) {
GridPane gridPane = new GridPane();
gridPane.setPadding(new Insets(10));
gridPane.setHgap(10);
gridPane.setVgap(10);
gridPane.add(lineChart, 0, 0);
gridPane.add(areaChart, 1, 0);
gridPane.add(smoothLineChart, 0, 1);
gridPane.add(smoothAreaChart, 1, 1);
gridPane.add(scatterChart, 0, 2);
gridPane.add(donutChart, 1, 2);
Scene scene = new Scene(new StackPane(gridPane));
stage.setTitle("Charts");
stage.setScene(scene);
stage.show();
timer.start();
modificationThread.start();
}
项目:Conan
文件:InstructionsView.java
/**
* Sets the layout of the component
*/
private GridPane constructGridPane() {
GridPane gridPane = new GridPane();
gridPane.setVgap(20.0);
gridPane.setPadding(new Insets(20.0, 20.0, 20.0, 20.0));
Label heading = constructHeading();
Node instructions = constructInstructions();
Button closeButton = constructCloseButton();
addChildren(gridPane, heading, instructions, closeButton);
setAlignments(heading, instructions, closeButton);
return gridPane;
}
项目:Planchester
文件:DutyRosterController.java
private GridPane removeRowFromGridPane(int row, GridPane gridPane ) {
Set<Node> deleteNodes = new HashSet<>();
for (Node child : gridPane.getChildren()) {
// get index from child
Integer rowIndex = GridPane.getRowIndex(child);
// handle null values for index=0
int r = rowIndex == null ? 0 : rowIndex;
if (r == row) {
// collect matching rows for deletion
deleteNodes.add(child);
}
}
gridPane.getChildren().removeAll(deleteNodes);
return gridPane;
}
项目:shuffleboard
文件:TilePane.java
/**
* Checks if a tile with the given width and height would overlap a pre-existing tile at the point {@code (col, row)},
* ignoring some nodes when calculating collisions. Note that this method does <i>not</i> perform bounds checking;
* use {@link #isOpen(int, int, int, int, Predicate) isOpen} to check if a widget can be placed at that point.
*
* @param col the column index of the point to check
* @param row the row index of the point to check
* @param tileWidth the width of the tile
* @param tileHeight the height of the tile
* @param ignore a predicate to use to ignore nodes when calculating collisions
*/
public boolean isOverlapping(int col, int row, int tileWidth, int tileHeight, Predicate<Node> ignore) {
for (Node child : getChildren()) {
if (ignore.test(child)) {
continue;
}
// All "real" children have a column index, row index, and column and row spans
// Other children (like the grid lines) don't have these properties and will throw null pointers
// when trying to access these properties
if (GridPane.getColumnIndex(child) != null) {
int x = GridPane.getColumnIndex(child);
int y = GridPane.getRowIndex(child);
int width = GridPane.getColumnSpan(child);
int height = GridPane.getRowSpan(child);
if (x + width > col && y + height > row
&& x - tileWidth < col && y - tileHeight < row) {
// There's an intersection
return true;
}
}
}
return false;
}
项目:GameAuthoringEnvironment
文件:SceneCreator.java
/**
* Creates the level view using an authoring renderer to
* keep track of the sprites on screen
*
* @return
*/
private Node createLevelView () {
Pane pane = new Pane();
Pane levelPane = new Pane();
myGrid = new GridPane();
myButton = placeableButton();
disableGrid();
myLevel.setBackgroundImageSize(Double.parseDouble(myBundle.getString("Width")),
Double.parseDouble(myBundle.getString("Height")));
myRenderer = new AuthoringRenderer(myLevel, levelPane, myGrid, myScale);
myRenderer.render();
levelPane.setOnMouseClicked(e -> handleMouseClick(e));
pane.getChildren().addAll(levelPane, myGrid, myButton);
return pane;
}
项目:Luna-Exam-Builder
文件:MainApp.java
public static boolean showEditQuestionDialog(Stage ps,Question question,String title){
try {
// Load the fxml file and create a new stage for the popup dialog.
FXMLLoader loader = new FXMLLoader();
loader.setLocation(MainApp.class.getResource("view_controller/EditQuestion.fxml"));
GridPane page = loader.load();
// Create the dialog Stage.
Stage dialogStage = new Stage();
dialogStage.setTitle(title);
dialogStage.getIcons().add(new Image(MainApp.class.getResourceAsStream("resources/icon.png")));
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(ps);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
dialogStage.setWidth(450);
dialogStage.setHeight(700);
dialogStage.setResizable(false);
// Set the question into the controller.
EditQuestionCtrl controller = loader.getController();
controller.dialogStage = dialogStage;
controller.setQuestion(question);
// Show the dialog and wait until the user closes it
dialogStage.showAndWait();
return controller.okClicked;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
项目:MineIDE
文件:WizardStepBuilder.java
/**
* Add a yes/no choice to a wizard step.
*
* @param fieldName
* @param defaultValue
* of the choice.
* @param prompt
* the tooltip to show
* @return
*/
@SuppressWarnings("unchecked")
public WizardStepBuilder addBoolean(final String fieldName, final boolean defaultValue, final String prompt)
{
final JFXCheckBox box = new JFXCheckBox();
box.setTooltip(new Tooltip(prompt));
box.setSelected(defaultValue);
this.current.getData().put(fieldName, new SimpleBooleanProperty());
this.current.getData().get(fieldName).bind(box.selectedProperty());
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(box, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
this.current.add(box, 1, this.current.getData().size() - 1);
return this;
}
项目:FastisFX
文件:DayChooser.java
/**
* Creates and positions every node onto the GridPane for the given month and year.
* Uses 7 (weekdays) columns and (max.) 6 rows (weeks). The rows and columns are created on fly or
* are reused.
*
* @param monthPane The GradPane that is used for populating the DayNodes.
* @param month The month that should be displayed.
* @param year The year that should be displayed.
*/
private void populateMonthPane(GridPane monthPane, Month month, int year) {
monthPane.getChildren().clear();
int currentRow = 0;
for(LocalDate d = LocalDate.of(year, month, 1);
d.getMonthValue() == month.getValue();
d = d.plusDays(1)) {
Node dayNode = renderDayItem(d);
final LocalDate currentDate = d;
dayNode.setOnMouseClicked(event -> selectedDateProperty.set(currentDate));
int column = d.getDayOfWeek().getValue();
monthPane.add(dayNode, column, currentRow);
if(column == 7) {
currentRow++;
}
}
}
项目:MineIDE
文件:WizardStepBuilder.java
/**
* Add a large String to a wizard step. A TextArea will be used to represent
* it.
*
* @param fieldName
* @param defaultValue
* the default String the textfield will contains.
* @param prompt
* the text to show on the textfield prompt String.
* @return
*/
@SuppressWarnings("unchecked")
public WizardStepBuilder addBigString(final String fieldName, final String defaultValue, final String prompt)
{
final JFXTextArea text = new JFXTextArea();
text.setPromptText(prompt);
text.setText(defaultValue);
this.current.getData().put(fieldName, new SimpleStringProperty());
this.current.getData().get(fieldName).bind(text.textProperty());
text.setMaxWidth(400);
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(text, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
this.current.add(text, 1, this.current.getData().size() - 1);
return this;
}
项目:CalendarFX
文件:WeekDayHeaderViewSkin.java
public WeekDayHeaderViewSkin(WeekDayHeaderView view) {
super(view);
pane = new GridPane();
pane.getStyleClass().add("container");
getChildren().add(pane);
final InvalidationListener updateListener = it -> updateControl();
view.numberOfDaysProperty().addListener(updateListener);
view.showTodayProperty().addListener(updateListener);
view.weekFieldsProperty().addListener(updateListener);
view.enableHyperlinksProperty().addListener(updateListener);
view.adjustToFirstDayOfWeekProperty().addListener(updateListener);
updateControl();
}
项目:shuffleboard
文件:WidgetPaneSaver.java
@Override
public JsonElement serialize(WidgetPane src, JsonSerializationContext context) {
JsonObject object = new JsonObject();
object.addProperty("gridSize", src.getTileSize());
object.addProperty("hgap", src.getHgap());
object.addProperty("vgap", src.getVgap());
JsonObject tiles = new JsonObject();
for (Tile<?> tile : src.getTiles()) {
String x = GridPane.getColumnIndex(tile).toString();
String y = GridPane.getRowIndex(tile).toString();
String coordinate = String.join(",", x, y);
JsonObject tileObject = new JsonObject();
tileObject.add("size", context.serialize(tile.getSize(), TileSize.class));
tileObject.add("content", context.serialize(tile.getContent(), tile.getContent().getClass()));
tiles.add(coordinate, tileObject);
}
object.add("tiles", tiles);
return object;
}
项目:fxutils
文件:FXDialog.java
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;
}
项目:titanium
文件:WSPServerTab.java
@Override
protected Node getTitleNodde() {
GridPane result = new GridPane();
result.setHgap(5);
result.addRow(0, AssetsLoader.getIcon("wsp_icon.png"), getConnectionStatusIcon(),
new Label(wspServer.getName()));
return result;
}
项目:CalendarFX
文件:DayPageSkin.java
@Override
protected Node createContent() {
leftSide = createLeftHandSide();
rightSide = createRightHandSide();
leftColumn = new ColumnConstraints();
leftColumn.setPercentWidth(50);
leftColumn.setMinWidth(Region.USE_COMPUTED_SIZE);
leftColumn.setPrefWidth(Region.USE_COMPUTED_SIZE);
leftColumn.setMaxWidth(Double.MAX_VALUE);
leftColumn.setFillWidth(true);
rightColumn = new ColumnConstraints();
rightColumn.setPercentWidth(50);
rightColumn.setMinWidth(Region.USE_COMPUTED_SIZE);
rightColumn.setPrefWidth(Region.USE_COMPUTED_SIZE);
rightColumn.setMaxWidth(Double.MAX_VALUE);
rightColumn.setFillWidth(true);
RowConstraints rowConstraints = new RowConstraints();
rowConstraints.setPercentHeight(100);
rowConstraints.setFillHeight(true);
// no need to assign a style class, will be auto-assigned by superclass ("content")
gridPane = new GridPane();
gridPane.setHgap(20);
gridPane.getColumnConstraints().addAll(leftColumn, rightColumn);
gridPane.getRowConstraints().addAll(rowConstraints);
gridPane.add(leftSide, 0, 0);
gridPane.add(rightSide, 1, 0);
getSkinnable().widthProperty().addListener(it -> updateLayout());
return gridPane;
}
项目:vars-annotation
文件:Alerts.java
private void buildExeptionAlert(ShowExceptionAlert msg, Alert alert) {
alert.setTitle(msg.getTitle());
alert.setHeaderText(msg.getHeaderText());
alert.setContentText(msg.getContentText());
// Create expandable Exception.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
msg.getException().printStackTrace(pw);
String exceptionText = sw.toString();
Label label = new Label("The exception stacktrace was:");
TextArea textArea = new TextArea(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);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
// Set expandable Exception into the dialog pane.
alert.getDialogPane()
.setExpandableContent(expContent);
alert.getDialogPane()
.getStylesheets()
.addAll(toolBox.getStylesheets());
alert.showAndWait();
}
项目:ModLoaderInstaller
文件:MainPanel.java
private static void error(String title, String header, String text, Throwable cause) {
StringWriter stringWriter = new StringWriter(); // Doesn't need to be closed & is unbuffered
try (PrintWriter writer = new PrintWriter(stringWriter)) {
cause.printStackTrace(writer);
}
Alert alert = new Alert(AlertType.ERROR);
setIcon(alert);
alert.setTitle(title);
alert.setHeaderText(header);
String actualText = text + "\n\nPlease append this exception stacktrace when reporting this error:";
Label textLabel = new Label(actualText);
textLabel.setPadding(new Insets(0, 0, 10, 0));
TextArea exceptionText = new TextArea(stringWriter.toString());
exceptionText.setEditable(false);
exceptionText.setMaxHeight(Double.MAX_VALUE);
exceptionText.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(exceptionText, Priority.ALWAYS);
GridPane.setVgrow(exceptionText, Priority.ALWAYS);
GridPane alertContent = new GridPane();
alertContent.setMaxWidth(Double.MAX_VALUE);
alertContent.add(textLabel, 0, 0);
alertContent.add(exceptionText, 0, 1);
alert.getDialogPane().setContent(alertContent);
alert.showAndWait();
}
项目:OneClient
文件:TableDialog.java
@SuppressWarnings("unchecked")
public TableDialog(Collection<T> files) {
dialogPane = getDialogPane();
setResizable(true);
this.table = new TableView<>(FXCollections.observableArrayList(files));
this.table.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(table, Priority.ALWAYS);
GridPane.setFillWidth(table, true);
label = createContentLabel(dialogPane.getContentText());
label.setPrefWidth(Region.USE_COMPUTED_SIZE);
label.textProperty().bind(dialogPane.contentTextProperty());
this.grid = new GridPane();
this.grid.setHgap(10);
this.grid.setMaxWidth(Double.MAX_VALUE);
this.grid.setAlignment(Pos.CENTER_LEFT);
dialogPane.contentTextProperty().addListener(o -> updateGrid());
updateGrid();
setResultConverter((dialogButton) -> {
ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
return data == ButtonBar.ButtonData.OK_DONE ? table.getSelectionModel().getSelectedItem() : null;
});
}
项目:Automekanik
文件:RregulloPunen.java
public RregulloPunen(int id, boolean kryer, TeDhenat td){
stage.initModality(Modality.APPLICATION_MODAL);
stage.setResizable(false);
stage.setTitle("Rregullo");
HBox btn = new HBox(5);
btn.getChildren().addAll(btnOk, btnAnulo);
btn.setAlignment(Pos.CENTER_RIGHT);
GridPane grid = new GridPane();
grid.add(cbKryer, 0, 0);
grid.add(btn, 0, 1);
grid.setVgap(10);
grid.setAlignment(Pos.CENTER);
cbKryer.setSelected(kryer);
btnOk.setOnAction(e -> {
azhurno(id);
new Thread(new Runnable() {
@Override
public void run() {
td.mbush();
}
}).start();
});
btnAnulo.setOnAction(e -> stage.close());
Scene scene = new Scene(grid, 230, 100);
scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
stage.setScene(scene);
stage.show();
}
项目:GazePlay
文件:ConfigurationContext.java
private static ChoiceBox<Languages> buildLanguageChooser(Configuration configuration,
ConfigurationContext configurationContext) {
Languages currentLanguage = null;
if (configuration.getLanguage() != null) {
currentLanguage = Languages.valueOf(configuration.getLanguage());
}
ChoiceBox<Languages> choiceBox = new ChoiceBox<>();
choiceBox.getItems().addAll(Languages.values());
choiceBox.getSelectionModel().select(currentLanguage);
choiceBox.setPrefWidth(prefWidth);
choiceBox.setPrefHeight(prefHeight);
choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Languages>() {
@Override
public void changed(ObservableValue<? extends Languages> observable, Languages oldValue,
Languages newValue) {
ConfigurationBuilder.createFromPropertiesResource().withLanguage(newValue.name())
.saveConfigIgnoringExceptions();
configurationContext.getGazePlay().getHomeMenuScreen().onLanguageChanged();
GridPane gridPane = buildConfigGridPane(configurationContext);
configurationContext.getRoot().setCenter(null);
configurationContext.getRoot().setCenter(gridPane);
}
});
return choiceBox;
}
项目:uPMT
文件:MainViewTransformations.java
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);
}
}
}
项目:dialog-tool
文件:JavaFXUtils.java
public static void showExceptionDialog (String title, String content, Throwable e) {
//Source: http://code.makery.ch/blog/javafx-dialogs-official/
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(content);
// Create expandable Exception.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String exceptionText = sw.toString();
Label label = new Label("The exception stacktrace was:");
TextArea textArea = new TextArea(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);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
//set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
}
项目:jmonkeybuilder
文件:ParticlesAssetEditorDialog.java
@Override
protected @NotNull Region buildSecondPart(@NotNull final HBox container) {
final Region preview = super.buildSecondPart(container);
textureParamNameLabel = new Label(Messages.PARTICLE_ASSET_EDITOR_DIALOG_TEXTURE_PARAM_LABEL + ":");
textureParamNameLabel.prefWidthProperty().bind(container.widthProperty().multiply(0.25));
applyLightingTransformLabel = new Label(Messages.PARTICLE_ASSET_EDITOR_DIALOG_LIGHTING_TRANSFORM_LABEL + ":");
applyLightingTransformLabel.prefWidthProperty().bind(container.widthProperty().multiply(0.25));
textureParamNameComboBox = new ComboBox<>();
textureParamNameComboBox.prefWidthProperty().bind(container.widthProperty().multiply(0.25));
applyLightingTransformCheckBox = new CheckBox();
applyLightingTransformCheckBox.prefWidthProperty().bind(container.widthProperty().multiply(0.25));
final GridPane settingsContainer = new GridPane();
settingsContainer.add(textureParamNameLabel, 0, 0);
settingsContainer.add(textureParamNameComboBox, 1, 0);
settingsContainer.add(applyLightingTransformLabel, 0, 1);
settingsContainer.add(applyLightingTransformCheckBox, 1, 1);
settingsContainer.add(preview, 0, 2, 2, 1);
FXUtils.addClassTo(settingsContainer, CSSClasses.DEF_GRID_PANE);
return settingsContainer;
}
项目:wall-t
文件:WallView.java
private void updateLayout( ) {
getChildren( ).clear( );
final Collection<TileViewModel> builds = _model.getDisplayedBuilds( );
final Collection<ProjectTileViewModel> projects = _model.getDisplayedProjects( );
final int totalTilesCount = builds.size( ) + projects.size( );
final int maxTilesByColumn = _model.getMaxTilesByColumnProperty( ).get( );
final int maxTilesByRow = _model.getMaxTilesByRowProperty( ).get( );
final int maxByScreens = max( 1, maxTilesByColumn * maxTilesByRow );
final int nbScreen = max( 1, totalTilesCount / maxByScreens + ( ( totalTilesCount % maxByScreens > 0 ? 1 : 0 ) ) );
int byScreen = max( 1, totalTilesCount / nbScreen + ( ( totalTilesCount % nbScreen > 0 ? 1 : 0 ) ) );
// We search to complete columns of screen with tiles, not to have empty blanks (ie having a number of column which are all completed)
while ( byScreen % maxTilesByColumn != 0 )
byScreen++;
final int nbColums = max( 1, byScreen / maxTilesByColumn + ( ( byScreen % maxTilesByColumn > 0 ? 1 : 0 ) ) );
final int byColums = max( 1, byScreen / nbColums + ( ( byScreen % nbColums > 0 ? 1 : 0 ) ) );
final Iterable<List<Object>> screenPartition = Iterables.partition( Iterables.concat( builds, projects ), byScreen );
for ( final List<Object> buildsInScreen : screenPartition ) {
final GridPane screenPane = buildScreenPane( buildsInScreen, nbColums, byColums );
screenPane.setVisible( false );
getChildren( ).add( screenPane );
}
displayNextScreen( );
}
项目:Conan
文件:InstructionsView.java
/**
* Enables scrolling in the view.
*/
private ScrollPane constructScrollPane() {
GridPane gridPane = constructGridPane();
ScrollPane scrollPane = new ScrollPane(gridPane);
scrollPane.setFitToWidth(true);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
return scrollPane;
}
项目:dialog-tool
文件:JavaFXUtils.java
public static void showExceptionDialog (String title, String headerText, String content, Throwable e) {
//Source: http://code.makery.ch/blog/javafx-dialogs-official/
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(title);
alert.setHeaderText(headerText);
alert.setContentText(content);
// Create expandable Exception.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String exceptionText = sw.toString();
Label label = new Label("The exception stacktrace was:");
TextArea textArea = new TextArea(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);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
//set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
}
项目:textmd
文件:ExceptionAlertDialog.java
@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;
}
项目:WeatherWatch
文件:ForecastsPane.java
private void setupView() {
setHgap(10);
setVgap(10);
forecastOnePane = new ForecastDisplayPane(stage, forecastOne);
GridPane.setHalignment(forecastOnePane, HPos.CENTER);
GridPane.setHgrow(forecastOnePane, Priority.ALWAYS);
GridPane.setVgrow(forecastOnePane, Priority.ALWAYS);
forecastTwoPane = new ForecastDisplayPane(stage, forecastTwo);
GridPane.setHalignment(forecastTwoPane, HPos.CENTER);
GridPane.setHgrow(forecastTwoPane, Priority.ALWAYS);
GridPane.setVgrow(forecastTwoPane, Priority.ALWAYS);
forecastThreePane = new ForecastDisplayPane(stage, forecastThree);
GridPane.setHalignment(forecastThreePane, HPos.CENTER);
GridPane.setHgrow(forecastThreePane, Priority.ALWAYS);
GridPane.setVgrow(forecastThreePane, Priority.ALWAYS);
Platform.runLater(new Runnable() {
@Override
public void run() {
getChildren().clear();
add(forecastOnePane, 0, 0);
add(forecastTwoPane, 1, 0);
add(forecastThreePane, 2, 0);
}
});
}
项目:marathonv5
文件:ProxyDialog.java
public ProxyPanel() {
setPadding(new Insets(8));
setHgap(5.0F);
setVgap(5.0F);
int rowIndex = 0;
Label label2 = new Label("Host Name");
label2.setId("proxy-dialog-label");
GridPane.setConstraints(label2, 0, rowIndex);
Label label3 = new Label("Port");
label3.setId("proxy-dialog-label");
GridPane.setConstraints(label3, 1, rowIndex);
getChildren().addAll(label2, label3);
rowIndex++;
hostNameBox = new TextField();
hostNameBox.setPromptText("proxy.mycompany.com");
hostNameBox.setPrefColumnCount(20);
GridPane.setConstraints(hostNameBox, 0, rowIndex);
portBox = new TextField();
portBox.setPromptText("8080");
portBox.setPrefColumnCount(10);
GridPane.setConstraints(portBox, 1, rowIndex);
ChangeListener<String> textListener = new ChangeListener<String>() {
public void changed(ObservableValue<? extends String> ov, String t, String t1) {
okBtn.setDisable(
hostNameBox.getText() == null || hostNameBox.getText().isEmpty()
|| portBox.getText() == null || portBox.getText().isEmpty());
}
};
hostNameBox.textProperty().addListener(textListener);
portBox.textProperty().addListener(textListener);
getChildren().addAll(hostNameBox, portBox);
}
项目:HTTP-Load-Generator
文件:ScriptTestWindow.java
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);
}
项目:jmonkeybuilder
文件:ImageChannelPreview.java
@Override
@FXThread
protected @NotNull GridPane createRoot() {
final GridPane gridPane = new GridPane();
FXUtils.addClassesTo(gridPane, CSSClasses.DEF_GRID_PANE, CSSClasses.IMAGE_CHANNEL_PREVIEW);
return gridPane;
}
项目:voogasalad-ltub
文件:GridPaneManager.java
@Override
public Node getNode() {
// TODO Auto-generated method stub
GridPane grid = new GridPane();
grid.setMinSize(30, 500);
grid.setHgap(5);
//TODO: add a small map
//grid.add(getSmallMap(), 0, 0);
grid.add(getSelectedSpriteButton(), 1, 0);
grid.add(getAllSpritesButton(), 2, 0);
grid.add(getSkillsButton(), 3, 0);
return grid;
}
项目:primitivefxmvc
文件:ExceptionAlert.java
public ExceptionAlert(T throwable) {
super(AlertType.ERROR);
this.throwable = throwable;
this.setTitle(throwable.getClass().getSimpleName());
this.setHeaderText(throwable.getMessage());
// Content Setter
// REF http://code.makery.ch/blog/javafx-dialogs-official/
Label label = new Label("Error details:");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
this.stackTraceString = sw.toString();
TextArea exceptionTextArea = new TextArea(this.stackTraceString);
exceptionTextArea.setEditable(false);
exceptionTextArea.setWrapText(true);
exceptionTextArea.setPrefSize(this.getDialogPane().getWidth()-20, this.getDialogPane().getHeight());
GridPane.setVgrow(exceptionTextArea, Priority.ALWAYS);
GridPane.setHgrow(exceptionTextArea, Priority.ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(exceptionTextArea, 0, 1);
this.getDialogPane().setExpandableContent(expContent);
this.getDialogPane().setMinHeight(300);
}