Skip to content

Commit 770ee15

Browse files
committed
Add Antialiasing to blocky text
1 parent 4229e71 commit 770ee15

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,20 @@ public ResourceTree(final DefaultMutableTreeNode treeRoot)
4343
StringMetricsUtil m = null;
4444

4545
@Override
46-
public void paint(final Graphics g)
46+
public void paint(final Graphics graphics)
4747
{
4848
try
4949
{
50+
Graphics2D g = (Graphics2D) graphics;
5051
super.paint(g);
5152
if (m == null)
5253
{
53-
m = new StringMetricsUtil((Graphics2D) g);
54+
m = new StringMetricsUtil(g);
5455
}
5556
if (treeRoot.getChildCount() < 1)
5657
{
58+
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
59+
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
5760
g.setColor(new Color(0, 0, 0, 100));
5861
g.fillRect(0, 0, getWidth(), getHeight());
5962
g.setColor(Color.white);
@@ -63,7 +66,7 @@ public void paint(final Graphics g)
6366
getHeight() / 2);
6467
}
6568
}
66-
catch (InternalError | NullPointerException ignored)
69+
catch (InternalError | NullPointerException | ClassCastException ignored)
6770
{
6871
}
6972
}

0 commit comments

Comments
 (0)