Skip to content

Commit c854690

Browse files
author
Stefan Hahmann
committed
Set the smaller font for Buttons and Labels as default on Linux/Unix systems
1 parent f39685a commit c854690

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/main/java/org/mastodon/mamut/launcher/MastodonLauncher.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*/
2929
package org.mastodon.mamut.launcher;
3030

31+
import java.awt.Font;
3132
import java.awt.datatransfer.DataFlavor;
3233
import java.awt.dnd.DnDConstants;
3334
import java.awt.dnd.DropTarget;
@@ -47,6 +48,7 @@
4748
import javax.swing.JFrame;
4849
import javax.swing.JLabel;
4950
import javax.swing.JOptionPane;
51+
import javax.swing.UIManager;
5052

5153
import org.jdom2.JDOMException;
5254
import org.mastodon.app.MastodonIcons;
@@ -94,6 +96,7 @@ public class MastodonLauncher extends JFrame
9496
public MastodonLauncher( final Context context )
9597
{
9698
super( "Mastodon launcher" );
99+
setFont();
97100
this.context = Optional.ofNullable( context ).orElse( new Context() );
98101

99102
System.setProperty( "apple.laf.useScreenMenuBar", "true" );
@@ -123,6 +126,20 @@ public MastodonLauncher( final Context context )
123126
setDropTarget( new LauncherDropTarget() );
124127
}
125128

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+
}
141+
}
142+
126143
private void importSimi()
127144
{
128145
gui.clearLog();

0 commit comments

Comments
 (0)