Skip to content

Instantly share code, notes, and snippets.

@bogovicj
Last active October 27, 2020 17:33
Show Gist options
  • Save bogovicj/ab84eb0ef7f991463b1e8c90ddfb97f2 to your computer and use it in GitHub Desktop.
Save bogovicj/ab84eb0ef7f991463b1e8c90ddfb97f2 to your computer and use it in GitHub Desktop.
Testing how unicode is rendered in swing using fiji
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
String arrow = "→ ";
String ts = " ";
String times = "✕";
JFrame frame = new JFrame();
frame.setMinimumSize( new Dimension( 300, 400 ));
JPanel panel = new JPanel();
frame.add( panel );
JLabel label = new JLabel();
label.setText( "<html>text" + arrow + "<br>" +
"32 32<br>" +
"32"+ts + "32<br>" +
"32x32<br>" +
"32"+times+"32<br>" +
"32"+ts+times+ts+"32<br>" +
"</html>");
Font font = label.getFont().deriveFont( 22f );
label.setFont(font);
panel.add( label );
frame.setVisible( true );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment