Skip to content

Commit

Permalink
improve UI for snippet dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mindolph committed Dec 19, 2024
1 parent 6d243f1 commit 89e2494
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ else if (t1 == rdTypeImage) {
log.debug("Load image");
File defaultDir = SystemUtils.getUserHome();
File file = DialogFactory.openFileDialog(DialogFactory.DEFAULT_WINDOW, defaultDir,
new FileChooser.ExtensionFilter("Icon/Image", "*.png"));
new FileChooser.ExtensionFilter("Image", "*.png", "*.jpg"));
if (file != null && file.exists()) {
log.debug(file.getAbsolutePath());
updateSnippet(this.loadImage(file));
14 changes: 8 additions & 6 deletions code/mindolph-base/src/main/resources/control/snippet_item.fxml
Original file line number Diff line number Diff line change
@@ -5,14 +5,16 @@
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<fx:root type="AnchorPane" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<fx:root type="AnchorPane" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1">
<HBox spacing="4.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0"/>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<ImageView fx:id="icon" pickOnBounds="true" preserveRatio="true"/>
<Label fx:id="title" HBox.hgrow="ALWAYS"/>
<ImageView fx:id="icon" pickOnBounds="true" preserveRatio="true" />
<VBox alignment="CENTER_LEFT">
<Label fx:id="title" text="Label" HBox.hgrow="ALWAYS" />
</VBox>
</HBox>
</fx:root>
Original file line number Diff line number Diff line change
@@ -15,10 +15,10 @@
<PreferenceItem name="Title: " labelPrefWidth="150">
<TextField fx:id="tfTitle" promptText="Input title for this snippet" prefWidth="240.0"/>
</PreferenceItem>
<PreferenceItem fx:id="itemCode" name="Code Text: " labelPrefWidth="150" prefHeight="160">
<TextArea fx:id="taCode" prefHeight="240" prefWidth="300.0" promptText="Input code for this snippet"/>
<PreferenceItem fx:id="itemCode" name="Code Text: " labelPrefWidth="150" prefHeight="240">
<TextArea fx:id="taCode" prefHeight="240" prefWidth="280.0" promptText="Input code for this snippet"/>
</PreferenceItem>
<PreferenceItem fx:id="itemImage" name="Icon/Image: " labelPrefWidth="150" prefHeight="240">
<PreferenceItem fx:id="itemImage" name="Image: " labelPrefWidth="150" prefHeight="240">
<HBox prefWidth="240" maxWidth="240" prefHeight="240" maxHeight="240" spacing="4"
style="-fx-border-width: 1; -fx-border-color: lightgray;">
<Button fx:id="btnIconImage" prefWidth="240" maxWidth="240" prefHeight="240" maxHeight="240"

0 comments on commit 89e2494

Please sign in to comment.