Skip to content

Commit 44385fa

Browse files
committed
Fix antialiasing on linux
1 parent 5fe9797 commit 44385fa

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/main/java/club/bytecode/the/jda/JDA.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import club.bytecode.the.jda.gui.fileviewer.ViewerFile;
1111
import club.bytecode.the.jda.gui.navigation.FileNavigationPane;
1212
import club.bytecode.the.jda.settings.Settings;
13+
import club.bytecode.the.jda.util.GuiUtils;
14+
import club.bytecode.the.jda.util.MiscUtils;
1315
import org.apache.commons.io.FileUtils;
1416
import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory;
1517
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory;
@@ -59,6 +61,10 @@ public class JDA {
5961
*/
6062
public static void main(String[] args) {
6163
try {
64+
// Fix antialiasing
65+
System.setProperty("awt.useSystemAAFontSettings", "lcd");
66+
System.setProperty("swing.aatext", "true");
67+
GuiUtils.setWmClassName("JDA");
6268
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
6369
} catch (Exception e) {
6470
new ExceptionUI(e);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package club.bytecode.the.jda.util;
2+
3+
import java.awt.*;
4+
5+
public class GuiUtils {
6+
public static void setWmClassName(String className) throws NoSuchFieldException, IllegalAccessException {
7+
Toolkit xToolkit = Toolkit.getDefaultToolkit();
8+
java.lang.reflect.Field awtAppClassNameField = xToolkit.getClass().getDeclaredField("awtAppClassName");
9+
awtAppClassNameField.setAccessible(true);
10+
awtAppClassNameField.set(xToolkit, className);
11+
}
12+
}

src/main/java/club/bytecode/the/jda/MiscUtils.java renamed to src/main/java/club/bytecode/the/jda/util/MiscUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package club.bytecode.the.jda;
1+
package club.bytecode.the.jda.util;
22

33
import java.io.BufferedReader;
44
import java.io.File;

0 commit comments

Comments
 (0)