-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add graphics to context menu items. (#169)
- Loading branch information
Showing
6 changed files
with
61 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/com/erikmafo/btviewer/ui/util/ContextMenuUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.erikmafo.btviewer.ui.util; | ||
|
||
import javafx.event.ActionEvent; | ||
import javafx.event.EventHandler; | ||
import javafx.scene.control.ContextMenu; | ||
import javafx.scene.control.MenuItem; | ||
import org.controlsfx.glyphfont.FontAwesome; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
|
||
public class ContextMenuUtil { | ||
|
||
@NotNull | ||
public static ContextMenu createContextMenu(MenuItem... items) { | ||
var contextMenu = new ContextMenu(); | ||
contextMenu.setStyle(""); | ||
contextMenu.setAutoHide(true); | ||
contextMenu.setHideOnEscape(true); | ||
contextMenu.getItems().addAll(items); | ||
return contextMenu; | ||
} | ||
|
||
@NotNull | ||
public static MenuItem createCutMenuItem(EventHandler<ActionEvent> handler) { | ||
var menuItem = new MenuItem("Cut"); | ||
menuItem.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.CUT)); | ||
menuItem.setOnAction(handler); | ||
return menuItem; | ||
} | ||
|
||
@NotNull | ||
public static MenuItem createCopyMenuItem(EventHandler<ActionEvent> handler) { | ||
var menuItem = new MenuItem("Copy"); | ||
menuItem.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.COPY)); | ||
menuItem.setOnAction(handler); | ||
return menuItem; | ||
} | ||
|
||
@NotNull | ||
public static MenuItem createPasteMenuItem(EventHandler<ActionEvent> handler) { | ||
var menuItem = new MenuItem("Paste"); | ||
menuItem.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.PASTE)); | ||
menuItem.setOnAction(handler); | ||
return menuItem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
.code-area { | ||
-fx-font-size: 14; | ||
-fx-font-weight: 690; | ||
} | ||
|
||
.keyword { | ||
|