Skip to content

Commit

Permalink
Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent committed Sep 7, 2023
1 parent 86dd56a commit 276b3e0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public VassalFont(String fontFileName) {
URL url = null;
try {
final String fileName = "/fonts/JetBrainsMono.ttf";
logger.warn("Build URL for mono");
logger.warn("Build URL for mono, classloader = " + getClass().getClassLoader());
url = getClass().getResource(fileName);
logger.warn("URL built");
Font.createFont(Font.TRUETYPE_FONT, url.openStream());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import bsh.BeanShellExpressionValidator;

import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
Expand All @@ -54,13 +56,16 @@
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.net.URL;
import java.util.List;

/**
* A Configurer for Java Expressions
*/
public class BeanShellExpressionConfigurer extends StringConfigurer {

private static final Logger logger = LoggerFactory.getLogger(BeanShellExpressionConfigurer.class);

/**
* enum describing any special processing that needs to be done for particular expression types
*
Expand Down Expand Up @@ -220,6 +225,22 @@ public Component getControls() {
nameField.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);

nameField.setText(getValueString());


try {
final String fileName = "/fonts/JetBrainsMono.ttf";

logger.warn("Build URL for mono, classloader = " + getClass().getClassLoader());
final URL url = getClass().getResource(fileName);
logger.warn("URL built");
final Font ms = Font.createFont(Font.TRUETYPE_FONT, url.openStream());
logger.warn("Font built");
nameField.setFont(ms.deriveFont(Font.PLAIN, 14));
}
catch (Exception e) {
logger.warn("Mono load exception: " + e.getMessage());
}

panel.add(nameField, "grow"); //NON-NLS
nameField.addKeyListener(new KeyAdapter() {
@Override
Expand Down

0 comments on commit 276b3e0

Please sign in to comment.