feat: help i'm struggling

This commit is contained in:
Emi Boucly 2025-03-18 20:28:21 +01:00
parent 041f721ed5
commit a8b2a0ced6
4 changed files with 25 additions and 23 deletions

View file

@ -11,7 +11,7 @@ public class HelloApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
Scene scene = new Scene(fxmlLoader.load(), 1280, 720);
stage.setTitle("PixelWriter");
stage.setScene(scene);
stage.show();

View file

@ -50,7 +50,7 @@ public class HelloController implements Initializable {
loadButton.setOnAction(this::onActionLoad);
newCanvasButton.setOnAction(this::onActionCreateCanvas);
scrollPane.setOnScroll(this::onScrollZoom);
scrollPane.getParent().setOnKeyPressed(this::onActionKeyPressed);
scrollPane.setOnKeyPressed(this::onActionKeyPressed);
brushSizeLabel.textProperty().bind(brushSizeSlider.valueProperty().asString());
setupCanvas();
scrollPane.prefViewportHeightProperty().bind(pane.layoutYProperty());

View file

@ -27,11 +27,11 @@ public class NewCanvasController implements Initializable {
createButton.setOnAction(this::create);
createButton.disableProperty().bind(validator.containsErrorsProperty());
cancelButton.setOnAction(this::close);
widthTextField.setOnAction(this::create);
validator.createCheck()
.decorates(createButton)
.dependsOn("width", heightTextField.textProperty())
.dependsOn("height", widthTextField.textProperty())
.dependsOn("width", widthTextField.textProperty())
.dependsOn("height", heightTextField.textProperty())
.withMethod(this::checkWidthHeight)
.immediate();
}

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
@ -70,28 +71,29 @@
<Slider fx:id="brushSizeSlider" blockIncrement="1.0" majorTickUnit="5.0" max="10.0" minorTickCount="9" showTickLabels="true" showTickMarks="true" snapToTicks="true" GridPane.rowIndex="1" />
</children>
</GridPane>
</children></VBox>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding></VBox>
<ScrollPane fx:id="scrollPane" cache="true" cacheHint="QUALITY" depthTest="ENABLE" hbarPolicy="ALWAYS" style="-fx-background-color: #666666; -fx-background: #666666;" vbarPolicy="ALWAYS">
<content>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" />
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="ALWAYS" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" valignment="CENTER" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ScrollPane fx:id="scrollPane" cache="true" cacheHint="QUALITY" depthTest="ENABLE" hbarPolicy="ALWAYS" style="-fx-background-color: #666666; -fx-background: #666666;" vbarPolicy="ALWAYS" GridPane.hgrow="ALWAYS" GridPane.vgrow="ALWAYS">
<content>
<Pane fx:id="pane">
<children>
<Canvas fx:id="drawingCanvas" height="600.0" nodeOrientation="INHERIT" width="800.0" />
<Canvas fx:id="drawingCanvas" height="600.0" nodeOrientation="INHERIT" translateX="10.0" translateY="10.0" width="800.0" />
</children>
</Pane>
</content>
</ScrollPane>
</children>
</GridPane>
</content>
</ScrollPane>
</items>
</SplitPane>
</children>