use of javafx.scene.layout.GridPane in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerDisplayTab method populate.
private void populate() {
final VBox displayPane = new VBox();
final Text title = new TextWithStyle(tr("Display settings"), TITLE_CSS_CLASS);
displayPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
displayPane.getChildren().add(title);
final GridPane displayContentPane = new GridPane();
displayContentPane.getStyleClass().add("grid");
final ComboBox<UseGLSL> glslComboBox = new ComboBox<>();
glslComboBox.setMaxWidth(Double.MAX_VALUE);
glslComboBox.setValue(container.getUseGlslValue());
glslComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(glslComboBox, UseGLSL.class);
displayContentPane.add(new TextWithStyle(tr("GLSL support"), CAPTION_TITLE_CSS_CLASS), 0, 0);
displayContentPane.add(glslComboBox, 1, 0);
final ComboBox<DirectDrawRenderer> directDrawRendererComboBox = new ComboBox<>();
directDrawRendererComboBox.setMaxWidth(Double.MAX_VALUE);
directDrawRendererComboBox.setValue(container.getDirectDrawRenderer());
directDrawRendererComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(directDrawRendererComboBox, DirectDrawRenderer.class);
displayContentPane.add(new TextWithStyle(tr("Direct Draw Renderer"), CAPTION_TITLE_CSS_CLASS), 0, 1);
displayContentPane.add(directDrawRendererComboBox, 1, 1);
final ComboBox<VideoMemorySize> videoMemorySizeComboBox = new ComboBox<>();
videoMemorySizeComboBox.setMaxWidth(Double.MAX_VALUE);
videoMemorySizeComboBox.setValue(container.getVideoMemorySize());
videoMemorySizeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItemsVideoMemorySize(videoMemorySizeComboBox);
displayContentPane.add(new TextWithStyle(tr("Video memory size"), CAPTION_TITLE_CSS_CLASS), 0, 2);
displayContentPane.add(videoMemorySizeComboBox, 1, 2);
final ComboBox<OffscreenRenderingMode> offscreenRenderingModeComboBox = new ComboBox<>();
offscreenRenderingModeComboBox.setMaxWidth(Double.MAX_VALUE);
offscreenRenderingModeComboBox.setValue(container.getOffscreenRenderingMode());
offscreenRenderingModeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(offscreenRenderingModeComboBox, OffscreenRenderingMode.class);
displayContentPane.add(new TextWithStyle(tr("Offscreen rendering mode"), CAPTION_TITLE_CSS_CLASS), 0, 3);
displayContentPane.add(offscreenRenderingModeComboBox, 1, 3);
final ComboBox<RenderTargetModeLock> renderTargetModeLockComboBox = new ComboBox<>();
renderTargetModeLockComboBox.setMaxWidth(Double.MAX_VALUE);
renderTargetModeLockComboBox.setValue(container.getRenderTargetModeLock());
renderTargetModeLockComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(renderTargetModeLockComboBox, RenderTargetModeLock.class);
displayContentPane.add(new TextWithStyle(tr("Render target lock mode"), CAPTION_TITLE_CSS_CLASS), 0, 4);
displayContentPane.add(renderTargetModeLockComboBox, 1, 4);
final ComboBox<Multisampling> multisamplingComboBox = new ComboBox<>();
multisamplingComboBox.setMaxWidth(Double.MAX_VALUE);
multisamplingComboBox.setValue(container.getMultisampling());
multisamplingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(multisamplingComboBox, Multisampling.class);
displayContentPane.add(new TextWithStyle(tr("Multisampling"), CAPTION_TITLE_CSS_CLASS), 0, 5);
displayContentPane.add(multisamplingComboBox, 1, 5);
final ComboBox<StrictDrawOrdering> strictDrawOrderingComboBox = new ComboBox<>();
strictDrawOrderingComboBox.setMaxWidth(Double.MAX_VALUE);
strictDrawOrderingComboBox.setValue(container.getStrictDrawOrdering());
strictDrawOrderingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(strictDrawOrderingComboBox, StrictDrawOrdering.class);
displayContentPane.add(new TextWithStyle(tr("Strict Draw Ordering"), CAPTION_TITLE_CSS_CLASS), 0, 6);
displayContentPane.add(strictDrawOrderingComboBox, 1, 6);
final ComboBox<AlwaysOffscreen> alwaysOffscreenComboBox = new ComboBox<>();
alwaysOffscreenComboBox.setMaxWidth(Double.MAX_VALUE);
alwaysOffscreenComboBox.setValue(container.getAlwaysOffscreen());
alwaysOffscreenComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(alwaysOffscreenComboBox, AlwaysOffscreen.class);
displayContentPane.add(new TextWithStyle(tr("Always Offscreen"), CAPTION_TITLE_CSS_CLASS), 0, 7);
displayContentPane.add(alwaysOffscreenComboBox, 1, 7);
Region spacer = new Region();
GridPane.setHgrow(spacer, Priority.ALWAYS);
displayContentPane.add(spacer, 2, 0);
displayPane.getChildren().addAll(displayContentPane);
this.setContent(displayPane);
lockableElements.addAll(Arrays.asList(glslComboBox, directDrawRendererComboBox, offscreenRenderingModeComboBox, renderTargetModeLockComboBox, multisamplingComboBox, strictDrawOrderingComboBox, alwaysOffscreenComboBox, videoMemorySizeComboBox));
}
use of javafx.scene.layout.GridPane in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerInformationTab method populate.
private void populate() {
final VBox informationPane = new VBox();
final Text title = new TextWithStyle(tr("Information"), TITLE_CSS_CLASS);
informationPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
informationPane.getChildren().add(title);
final GridPane informationContentPane = new GridPane();
informationContentPane.getStyleClass().add("grid");
informationContentPane.add(new TextWithStyle(tr("Name:"), CAPTION_TITLE_CSS_CLASS), 0, 0);
Label name = new Label(container.getName());
name.setWrapText(true);
informationContentPane.add(name, 1, 0);
informationContentPane.add(new TextWithStyle(tr("Path:"), CAPTION_TITLE_CSS_CLASS), 0, 1);
Label path = new Label(container.getPath());
path.setWrapText(true);
informationContentPane.add(path, 1, 1);
informationContentPane.add(new TextWithStyle(tr("Wine version:"), CAPTION_TITLE_CSS_CLASS), 0, 2);
Label version = new Label(container.getVersion());
version.setWrapText(true);
informationContentPane.add(version, 1, 2);
informationContentPane.add(new TextWithStyle(tr("Wine architecture:"), CAPTION_TITLE_CSS_CLASS), 0, 3);
Label architecture = new Label(container.getArchitecture());
architecture.setWrapText(true);
informationContentPane.add(architecture, 1, 3);
informationContentPane.add(new TextWithStyle(tr("Wine distribution:"), CAPTION_TITLE_CSS_CLASS), 0, 4);
Label distribution = new Label(container.getDistribution());
distribution.setWrapText(true);
informationContentPane.add(distribution, 1, 4);
Region spacer = new Region();
spacer.setPrefHeight(20);
VBox.setVgrow(spacer, Priority.NEVER);
ComboBox<EngineVersionDTO> changeEngineComboBox = new ComboBox<EngineVersionDTO>(FXCollections.observableList(engineVersions));
changeEngineComboBox.setConverter(new StringConverter<EngineVersionDTO>() {
@Override
public String toString(EngineVersionDTO object) {
return object.getVersion();
}
@Override
public EngineVersionDTO fromString(String string) {
return engineVersions.stream().filter(engineVersion -> engineVersion.getVersion().equals(string)).findFirst().get();
}
});
changeEngineComboBox.getSelectionModel().select(engineVersions.stream().filter(engineVersion -> engineVersion.getVersion().equals(container.getVersion())).findFirst().get());
Button deleteButton = new Button(tr("Delete container"));
deleteButton.setOnMouseClicked(event -> this.onDeletePrefix.accept(container));
informationPane.getChildren().addAll(informationContentPane, spacer, changeEngineComboBox, deleteButton);
this.setContent(informationPane);
}
use of javafx.scene.layout.GridPane in project POL-POM-5 by PlayOnLinux.
the class AboutPanel method populate.
private void populate() {
this.title = new TextWithStyle(tr("About"), "title");
this.aboutGrid = new GridPane();
this.aboutGrid.getStyleClass().add("grid");
this.aboutGrid.setHgap(20);
this.aboutGrid.setVgap(10);
this.nameDescription = new TextWithStyle(tr("Name:"), "captionTitle");
this.nameLabel = new Label(buildInformation.getApplicationName());
this.versionDescription = new TextWithStyle(tr("Version:"), "captionTitle");
this.versionLabel = new Label(buildInformation.getApplicationVersion());
this.gitRevisionDescription = new TextWithStyle(tr("Git Revision:"), "captionTitle");
this.gitRevisionHyperlink = new Hyperlink(buildInformation.getApplicationGitRevision());
this.gitRevisionHyperlink.setOnAction(event -> {
try {
URI uri = new URI("https://github.com/PlayOnLinux/POL-POM-5/commit/" + buildInformation.getApplicationGitRevision());
opener.open(uri);
} catch (URISyntaxException e) {
e.printStackTrace();
}
});
this.buildTimestampDescription = new TextWithStyle(tr("Build Timestamp:"), "captionTitle");
this.buildTimestampLabel = new Label(buildInformation.getApplicationBuildTimestamp());
this.aboutGrid.add(nameDescription, 0, 0);
this.aboutGrid.add(nameLabel, 1, 0);
this.aboutGrid.add(versionDescription, 0, 1);
this.aboutGrid.add(versionLabel, 1, 1);
this.aboutGrid.add(gitRevisionDescription, 0, 2);
this.aboutGrid.add(gitRevisionHyperlink, 1, 2);
this.aboutGrid.add(buildTimestampDescription, 0, 3);
this.aboutGrid.add(buildTimestampLabel, 1, 3);
}
use of javafx.scene.layout.GridPane in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerToolsTab method populate.
private void populate() {
final VBox toolsPane = new VBox();
final Text title = new TextWithStyle(tr("Tools"), TITLE_CSS_CLASS);
toolsPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
toolsPane.getChildren().add(title);
final GridPane toolsContentPane = new GridPane();
toolsContentPane.getStyleClass().add("grid");
Button openTerminal = new Button(tr("Open a terminal"));
openTerminal.getStyleClass().addAll("wineToolButton", "openTerminal");
openTerminal.setOnMouseClicked(e -> {
this.lockAll();
winePrefixContainerController.openTerminalInPrefix(container);
this.unlockAll();
});
GridPane.setHalignment(openTerminal, HPos.CENTER);
this.lockableElements.add(openTerminal);
toolsContentPane.add(openTerminal, 0, 0);
toolsContentPane.add(wineToolCaption(tr("Open a terminal")), 0, 1);
Button createShortcut = new Button();
createShortcut.getStyleClass().addAll("wineToolButton", "openTerminal");
createShortcut.setOnMouseClicked(event -> {
this.lockAll();
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(tr("Choose executable"));
File file = fileChooser.showOpenDialog(this.getContent().getScene().getWindow());
if (file != null) {
winePrefixContainerController.createShortcut(container, file.getName(), file.getName(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
}
this.unlockAll();
});
GridPane.setHalignment(createShortcut, HPos.CENTER);
this.lockableElements.add(createShortcut);
toolsContentPane.add(createShortcut, 1, 0);
toolsContentPane.add(wineToolCaption(tr("Create shortcut")), 1, 1);
Button runExecutable = new Button();
runExecutable.getStyleClass().addAll("wineToolButton", "runExecutable");
runExecutable.setOnMouseClicked(event -> {
this.lockAll();
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(tr("Choose executable"));
File file = fileChooser.showOpenDialog(this.getContent().getScene().getWindow());
if (file != null) {
winePrefixContainerController.runInPrefix(container, file.getAbsolutePath(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
}
});
GridPane.setHalignment(runExecutable, HPos.CENTER);
this.lockableElements.add(runExecutable);
toolsContentPane.add(runExecutable, 2, 0);
toolsContentPane.add(wineToolCaption(tr("Run executable")), 2, 1);
toolsPane.getChildren().addAll(toolsContentPane);
toolsContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25));
this.setContent(toolsPane);
}
use of javafx.scene.layout.GridPane in project aima-java by aimacode.
the class ConnectFourApp method createRootPane.
@Override
public Pane createRootPane() {
model = new ConnectFourModel();
BorderPane root = new BorderPane();
ToolBar toolBar = new ToolBar();
toolBar.setStyle("-fx-background-color: rgb(0, 0, 200)");
clearBtn = new Button("Clear");
clearBtn.setOnAction(ev -> model.initGame());
strategyCombo = new ComboBox<>();
strategyCombo.getItems().addAll("Iterative Deepening Alpha-Beta", "Advanced Alpha-Beta");
strategyCombo.getSelectionModel().select(0);
timeCombo = new ComboBox<>();
timeCombo.getItems().addAll("2sec", "4sec", "6sec", "8sec");
timeCombo.getSelectionModel().select(1);
proposeBtn = new Button("Propose Move");
proposeBtn.setOnAction(ev -> model.proposeMove((timeCombo.getSelectionModel().getSelectedIndex() + 1) * 2, strategyCombo.getSelectionModel().getSelectedIndex()));
toolBar.getItems().addAll(clearBtn, new Separator(), strategyCombo, timeCombo, proposeBtn);
root.setTop(toolBar);
final int rows = model.getRows();
final int cols = model.getCols();
BorderPane boardPane = new BorderPane();
ColumnConstraints colCons = new ColumnConstraints();
colCons.setPercentWidth(100.0 / cols);
GridPane btnPane = new GridPane();
GridPane diskPane = new GridPane();
btnPane.setHgap(10);
btnPane.setPadding(new Insets(10, 10, 0, 10));
btnPane.setStyle("-fx-background-color: rgb(0, 50, 255)");
diskPane.setPadding(new Insets(10, 10, 10, 10));
diskPane.setStyle("-fx-background-color: rgb(0, 50, 255)");
colBtns = new Button[cols];
for (int i = 0; i < cols; i++) {
Button colBtn = new Button("" + (i + 1));
colBtn.setId("" + (i + 1));
colBtn.setMaxWidth(Double.MAX_VALUE);
colBtn.setOnAction(ev -> {
String id = ((Button) ev.getSource()).getId();
int col = Integer.parseInt(id);
model.makeMove(col - 1);
});
colBtns[i] = colBtn;
btnPane.add(colBtn, i, 0);
GridPane.setHalignment(colBtn, HPos.CENTER);
btnPane.getColumnConstraints().add(colCons);
diskPane.getColumnConstraints().add(colCons);
}
boardPane.setTop(btnPane);
diskPane.setMinSize(0, 0);
diskPane.setPrefSize(cols * 100, rows * 100);
RowConstraints rowCons = new RowConstraints();
rowCons.setPercentHeight(100.0 / rows);
for (int i = 0; i < rows; i++) diskPane.getRowConstraints().add(rowCons);
disks = new Circle[rows * cols];
for (int i = 0; i < rows * cols; i++) {
Circle disk = new Circle(30);
disk.radiusProperty().bind(Bindings.min(Bindings.divide(diskPane.widthProperty(), cols * 3), Bindings.divide(diskPane.heightProperty(), rows * 3)));
disks[i] = disk;
diskPane.add(disk, i % cols, i / cols);
GridPane.setHalignment(disk, HPos.CENTER);
}
boardPane.setCenter(diskPane);
root.setCenter(boardPane);
statusBar = new Label();
statusBar.setMaxWidth(Double.MAX_VALUE);
statusBar.setStyle("-fx-background-color: rgb(0, 0, 200); -fx-font-size: 20");
root.setBottom(statusBar);
model.addObserver(this::update);
return root;
}
Aggregations