Skip to content

Commit 80b325f

Browse files
author
Stefan Hahmann
committed
Set the smaller font for Buttons and Labels as default on Linux/Unix systems and make MainWindow a bit smaller again
1 parent f39685a commit 80b325f

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/main/java/org/mastodon/mamut/MainWindow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public MainWindow( final ProjectModel appModel )
111111

112112
// Main Panel
113113
final JPanel buttonsPanel = new JPanel();
114-
buttonsPanel.setLayout( new MigLayout( "wrap 2", "[190px!]10[190px!]" ) );
114+
buttonsPanel.setLayout( new MigLayout( "wrap 2", "[170px!]10[170px!]" ) );
115115

116116
// Project:
117117
final JPanel titlePanel = new JPanel();

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)