Add Antialiasing to blocky text
This commit is contained in:
parent
4229e71352
commit
770ee15650
1 changed files with 6 additions and 3 deletions
|
@ -43,17 +43,20 @@ public class ResourceTree extends JTree
|
||||||
StringMetricsUtil m = null;
|
StringMetricsUtil m = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paint(final Graphics g)
|
public void paint(final Graphics graphics)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Graphics2D g = (Graphics2D) graphics;
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
if (m == null)
|
if (m == null)
|
||||||
{
|
{
|
||||||
m = new StringMetricsUtil((Graphics2D) g);
|
m = new StringMetricsUtil(g);
|
||||||
}
|
}
|
||||||
if (treeRoot.getChildCount() < 1)
|
if (treeRoot.getChildCount() < 1)
|
||||||
{
|
{
|
||||||
|
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||||
|
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||||
g.setColor(new Color(0, 0, 0, 100));
|
g.setColor(new Color(0, 0, 0, 100));
|
||||||
g.fillRect(0, 0, getWidth(), getHeight());
|
g.fillRect(0, 0, getWidth(), getHeight());
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
|
@ -63,7 +66,7 @@ public class ResourceTree extends JTree
|
||||||
getHeight() / 2);
|
getHeight() / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InternalError | NullPointerException ignored)
|
catch (InternalError | NullPointerException | ClassCastException ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue