|
28 | 28 | */ |
29 | 29 | package org.mastodon.mamut.launcher; |
30 | 30 |
|
| 31 | +import java.awt.Font; |
31 | 32 | import java.awt.datatransfer.DataFlavor; |
32 | 33 | import java.awt.dnd.DnDConstants; |
33 | 34 | import java.awt.dnd.DropTarget; |
|
47 | 48 | import javax.swing.JFrame; |
48 | 49 | import javax.swing.JLabel; |
49 | 50 | import javax.swing.JOptionPane; |
| 51 | +import javax.swing.UIManager; |
50 | 52 |
|
51 | 53 | import org.jdom2.JDOMException; |
52 | 54 | import org.mastodon.app.MastodonIcons; |
@@ -94,6 +96,7 @@ public class MastodonLauncher extends JFrame |
94 | 96 | public MastodonLauncher( final Context context ) |
95 | 97 | { |
96 | 98 | super( "Mastodon launcher" ); |
| 99 | + setFont(); |
97 | 100 | this.context = Optional.ofNullable( context ).orElse( new Context() ); |
98 | 101 |
|
99 | 102 | System.setProperty( "apple.laf.useScreenMenuBar", "true" ); |
@@ -123,6 +126,27 @@ public MastodonLauncher( final Context context ) |
123 | 126 | setDropTarget( new LauncherDropTarget() ); |
124 | 127 | } |
125 | 128 |
|
| 129 | + private static void setFont() |
| 130 | + { |
| 131 | + // Determine the OS and set the font |
| 132 | + String os = System.getProperty( "os.name" ).toLowerCase(); |
| 133 | + |
| 134 | + if ( os.contains( "nix" ) || os.contains( "nux" ) ) |
| 135 | + { |
| 136 | + Font defaultFont = new Font( "Arial", Font.PLAIN, 12 ); |
| 137 | + // Set the font for UI components |
| 138 | + UIManager.put( "Label.font", defaultFont ); |
| 139 | + UIManager.put( "Button.font", defaultFont ); |
| 140 | + UIManager.put( "TextField.font", defaultFont ); |
| 141 | + UIManager.put( "TextArea.font", defaultFont ); |
| 142 | + UIManager.put( "ComboBox.font", defaultFont ); |
| 143 | + UIManager.put( "List.font", defaultFont ); |
| 144 | + UIManager.put( "Table.font", defaultFont ); |
| 145 | + UIManager.put( "Menu.font", defaultFont ); |
| 146 | + UIManager.put( "MenuItem.font", defaultFont ); |
| 147 | + } |
| 148 | + } |
| 149 | + |
126 | 150 | private void importSimi() |
127 | 151 | { |
128 | 152 | gui.clearLog(); |
|
0 commit comments