mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Make ability menu items consistent regardless of containing mana symbol icons and make them respect menu item height
This commit is contained in:
@@ -109,6 +109,9 @@ public final class GuiUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JMenuItem createMenuItem(String label, KeyStroke accelerator, final Runnable onClick, boolean enabled, boolean bold) {
|
public static JMenuItem createMenuItem(String label, KeyStroke accelerator, final Runnable onClick, boolean enabled, boolean bold) {
|
||||||
|
if (label.startsWith("<html>")) { //adjust label if HTML
|
||||||
|
label = "<html>" + "<div style='height: " + itemHeight + "px; margin-top: 6px;'>" + label.substring(6, label.length() - 7) + "</div></html>";
|
||||||
|
}
|
||||||
JMenuItem item = new JMenuItem(label);
|
JMenuItem item = new JMenuItem(label);
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1657,15 +1657,11 @@ public enum FSkin {
|
|||||||
String replacement;
|
String replacement;
|
||||||
try {
|
try {
|
||||||
replacement = "<img src='" + new File(NewConstants.CACHE_SYMBOLS_DIR + "/$1$2$3.png").toURI().toURL().toString() + "'>";
|
replacement = "<img src='" + new File(NewConstants.CACHE_SYMBOLS_DIR + "/$1$2$3.png").toURI().toURL().toString() + "'>";
|
||||||
|
str = str.replaceAll(pattern, replacement);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
String encodedStr = str.replaceAll(pattern, replacement);
|
return "<html>" + str + "</html>"; //must wrap in <html> tag for images to appear
|
||||||
if (encodedStr.length() != str.length()) {
|
|
||||||
encodedStr = "<html>" + encodedStr + "</html>"; //need to wrap in HTML tags to ensure text rendered as HTML so symbols appear
|
|
||||||
}
|
|
||||||
return encodedStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String
|
private static final String
|
||||||
|
|||||||
Reference in New Issue
Block a user