Autore: Fabio Di Matteo
Ultima revisione: 27/12/2017 - 15:41
Da inserire nel main, prima che vengano caricati i widget.
public static void main(String[] args) { //Forzare antialiasing del testo in applicazioni java con swing System.setProperty("awt.useSystemAAFontSettings","on"); System.setProperty("swing.aatext", "true"); //Dire a java di usare il look del sistema operativo per i widget try { String myOS = System.getProperty("os.name"); if (myOS.contains("Windows")) UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (myOS.contains("Linux")) UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); // oppure UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundException e) { // handle exception } catch (InstantiationException e) { // handle exception } catch (IllegalAccessException e) { // handle exception } } ...
Per forzare la suddetta preferenza di Netbeans in dividuare il file netbeans.conf (sulla mia Archlinux : /usr/share/netbeans/etc/netbeans.conf ) e aggiungere -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on opzioni a netbeans_default_options in modo tale che risulti così:
netbeans_default_options=" -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on -J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.g$