mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 07:28:20 -04:00
fixed some mac issues
This commit is contained in:
parent
097e48faf1
commit
8932e8597e
@ -11,7 +11,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import static de.neemann.digital.gui.Settings.isLinux;
|
import static de.neemann.gui.Screen.isLinux;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a fitter to create a JEDEC file.
|
* Starts a fitter to create a JEDEC file.
|
||||||
|
@ -104,13 +104,5 @@ public final class Settings implements AttributeListener {
|
|||||||
return settingsKeys;
|
return settingsKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if running on a windows system
|
|
||||||
*/
|
|
||||||
public static boolean isLinux() {
|
|
||||||
String name = System.getProperty("os.name").toLowerCase();
|
|
||||||
return name.contains("linux");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ import java.awt.geom.AffineTransform;
|
|||||||
* Created by hneemann on 09.05.17.
|
* Created by hneemann on 09.05.17.
|
||||||
*/
|
*/
|
||||||
public final class Screen {
|
public final class Screen {
|
||||||
|
private static final String OS = System.getProperty("os.name").toLowerCase();
|
||||||
|
private static final boolean IS_LINUX = OS.contains("linux");
|
||||||
|
private static final boolean IS_MAC = OS.contains("mac");
|
||||||
|
|
||||||
private static final class InstanceHolder {
|
private static final class InstanceHolder {
|
||||||
private static Screen instance = new Screen();
|
private static Screen instance = new Screen();
|
||||||
@ -58,6 +61,9 @@ public final class Screen {
|
|||||||
* @return the default font scaling in percent
|
* @return the default font scaling in percent
|
||||||
*/
|
*/
|
||||||
public static int getDefaultFontScaling() {
|
public static int getDefaultFontScaling() {
|
||||||
|
if (IS_MAC) // macOS has its own retina handling
|
||||||
|
return 100;
|
||||||
|
|
||||||
int dpi = getDefaultScreenResolution();
|
int dpi = getDefaultScreenResolution();
|
||||||
int s = (dpi * 100) / 96;
|
int s = (dpi * 100) / 96;
|
||||||
if (s > 95 && s < 105)
|
if (s > 95 && s < 105)
|
||||||
@ -78,10 +84,13 @@ public final class Screen {
|
|||||||
for (Object key : javax.swing.UIManager.getLookAndFeel().getDefaults().keySet()) {
|
for (Object key : javax.swing.UIManager.getLookAndFeel().getDefaults().keySet()) {
|
||||||
if (key.toString().endsWith(".font"))
|
if (key.toString().endsWith(".font"))
|
||||||
javax.swing.UIManager.put(key, font);
|
javax.swing.UIManager.put(key, font);
|
||||||
if (key.toString().endsWith(".icon") || key.toString().endsWith("Icon")) {
|
|
||||||
Icon icon = UIManager.getIcon(key);
|
if (!IS_MAC) { // macOS has its own icon handling
|
||||||
if (icon != null)
|
if (key.toString().endsWith(".icon") || key.toString().endsWith("Icon")) {
|
||||||
javax.swing.UIManager.put(key, new ScaleIcon(icon, scaling));
|
Icon icon = UIManager.getIcon(key);
|
||||||
|
if (icon != null)
|
||||||
|
javax.swing.UIManager.put(key, new ScaleIcon(icon, scaling));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIManager.put("ScrollBar.width", size * 17 / 12);
|
UIManager.put("ScrollBar.width", size * 17 / 12);
|
||||||
@ -169,4 +178,12 @@ public final class Screen {
|
|||||||
else
|
else
|
||||||
return new Dimension((int) (dimension.width * scaling), (int) (dimension.height * scaling));
|
return new Dimension((int) (dimension.width * scaling), (int) (dimension.height * scaling));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if running on a windows system
|
||||||
|
*/
|
||||||
|
public static boolean isLinux() {
|
||||||
|
return IS_LINUX;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user