Browse Source

implemented enhanced styling for MenuItems

Jan-Peter Klein 1 year ago
parent
commit
a038b34e29

+ 15 - 0
src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java

@@ -34,6 +34,7 @@ import javafx.scene.input.KeyEvent;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.input.TransferMode;
 import javafx.scene.layout.StackPane;
+import javafx.scene.text.TextAlignment;
 import javafx.stage.Stage;
 import java.io.File;
 import java.io.IOException;
@@ -144,15 +145,29 @@ public class VaultListController implements FxController {
 		root.setOnDragDropped(this::handleDragEvent);
 		root.setOnDragExited(this::handleDragEvent);
 
+		initAddVaultBtnContextMenu();
+	}
+
+	private void initAddVaultBtnContextMenu() {
 		ContextMenu contextMenu = new ContextMenu();
 		FontAwesome5IconView addIcon = new FontAwesome5IconView();
 		addIcon.setGlyph(FontAwesome5Icon.PLUS);
+		addIcon.setTextAlignment(TextAlignment.CENTER);
+		addIcon.setWrappingWidth(14);
+
 		MenuItem item1 = new MenuItem(resourceBundle.getString("addvaultwizard.welcome.newButton"), addIcon);
 		item1.setOnAction(event -> didClickAddNewVault());
+		item1.getStyleClass().add("add-vault-menu-item");
+
 		FontAwesome5IconView openIcon = new FontAwesome5IconView();
 		openIcon.setGlyph(FontAwesome5Icon.FOLDER_OPEN);
+		openIcon.setTextAlignment(TextAlignment.CENTER);
+		openIcon.setWrappingWidth(14);
+
 		MenuItem item2 = new MenuItem(resourceBundle.getString("addvaultwizard.welcome.existingButton"), openIcon);
 		item2.setOnAction(event -> didClickAddExistingVault());
+		item2.getStyleClass().add("add-vault-menu-item");
+
 		contextMenu.getItems().addAll(item1, item2);
 		addVaultBtn.setContextMenu(contextMenu);
 	}

+ 10 - 0
src/main/resources/css/dark_theme.css

@@ -795,6 +795,16 @@
 	-fx-scale-shape: false;
 }
 
+/*******************************************************************************
+ *                                                                             *
+ * Add Vault - MenuItem                                                                    *
+ *                                                                             *
+ ******************************************************************************/
+
+.add-vault-menu-item {
+    -fx-padding: 4px 8px;
+}
+
 /*******************************************************************************
  *                                                                             *
  * ProgressBar                                                                 *

+ 10 - 0
src/main/resources/css/light_theme.css

@@ -794,6 +794,16 @@
 	-fx-scale-shape: false;
 }
 
+/*******************************************************************************
+ *                                                                             *
+ * Add Vault - MenuItem                                                                    *
+ *                                                                             *
+ ******************************************************************************/
+
+.add-vault-menu-item {
+    -fx-padding: 4px 8px;
+}
+
 /*******************************************************************************
  *                                                                             *
  * ProgressBar                                                                 *