mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +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,7 +109,10 @@ public final class GuiUtils {
|
||||
}
|
||||
|
||||
public static JMenuItem createMenuItem(String label, KeyStroke accelerator, final Runnable onClick, boolean enabled, boolean bold) {
|
||||
JMenuItem item = new JMenuItem(label);
|
||||
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);
|
||||
item.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
|
||||
@@ -1657,15 +1657,11 @@ public enum FSkin {
|
||||
String replacement;
|
||||
try {
|
||||
replacement = "<img src='" + new File(NewConstants.CACHE_SYMBOLS_DIR + "/$1$2$3.png").toURI().toURL().toString() + "'>";
|
||||
str = str.replaceAll(pattern, replacement);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
return str;
|
||||
}
|
||||
String encodedStr = str.replaceAll(pattern, replacement);
|
||||
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;
|
||||
return "<html>" + str + "</html>"; //must wrap in <html> tag for images to appear
|
||||
}
|
||||
|
||||
private static final String
|
||||
|
||||
Reference in New Issue
Block a user