|
|
@ -8,6 +8,7 @@ import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.fun.DesignerEnvProcessor; |
|
|
|
import com.fr.design.fun.DesignerEnvProcessor; |
|
|
|
import com.fr.design.gui.UILookAndFeel; |
|
|
|
import com.fr.design.gui.UILookAndFeel; |
|
|
|
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.exit.DesignerExiter; |
|
|
|
import com.fr.exit.DesignerExiter; |
|
|
|
import com.fr.file.FileFILE; |
|
|
|
import com.fr.file.FileFILE; |
|
|
@ -21,7 +22,9 @@ import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.os.OperatingSystem; |
|
|
|
import com.fr.stable.os.OperatingSystem; |
|
|
|
import com.fr.start.ServerStarter; |
|
|
|
import com.fr.start.ServerStarter; |
|
|
|
|
|
|
|
import com.fr.value.NotNullLazyValue; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.UIManager; |
|
|
|
import javax.swing.UIManager; |
|
|
@ -248,6 +251,7 @@ public class DesignUtils { |
|
|
|
// 刷新DesignerFrame里面的面板
|
|
|
|
// 刷新DesignerFrame里面的面板
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
if (DesignerContext.getDesignerFrame() == null) { |
|
|
|
if (DesignerContext.getDesignerFrame() == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -269,7 +273,7 @@ public class DesignUtils { |
|
|
|
FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize"); |
|
|
|
FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize"); |
|
|
|
} |
|
|
|
} |
|
|
|
//获取当前系统语言下设计器用的默认字体
|
|
|
|
//获取当前系统语言下设计器用的默认字体
|
|
|
|
FRFont guiFRFont = getCurrentLocaleFont(); |
|
|
|
FRFont guiFRFont = getDefaultGUIFont(); |
|
|
|
//指定UIManager中字体
|
|
|
|
//指定UIManager中字体
|
|
|
|
Enumeration keys = UIManager.getDefaults().keys(); |
|
|
|
Enumeration keys = UIManager.getDefaults().keys(); |
|
|
|
while (keys.hasMoreElements()) { |
|
|
|
while (keys.hasMoreElements()) { |
|
|
@ -286,11 +290,21 @@ public class DesignUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当前系统语言下设计器用的默认字体 |
|
|
|
* 获取当前系统语言下设计器界面使用的默认字体 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 默认字体 |
|
|
|
* @return 默认字体 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static FRFont getCurrentLocaleFont() { |
|
|
|
public static FRFont getDefaultGUIFont() { |
|
|
|
|
|
|
|
return CURRENT_LOCALE_FONT.getValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取当前系统语言下设计器用的默认字体 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static final NotNullLazyValue<FRFont> CURRENT_LOCALE_FONT = new NotNullLazyValue<FRFont>() { |
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected FRFont compute() { |
|
|
|
FRFont guiFRFont; |
|
|
|
FRFont guiFRFont; |
|
|
|
Locale defaultLocale = Locale.getDefault(); |
|
|
|
Locale defaultLocale = Locale.getDefault(); |
|
|
|
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
|
|
|
|
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
|
|
|
@ -302,9 +316,7 @@ public class DesignUtils { |
|
|
|
guiFRFont = getNamedFont("Dialog"); |
|
|
|
guiFRFont = getNamedFont("Dialog"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整.
|
|
|
|
String file = Toolkit.i18nText("Fine-Design_Basic_File"); |
|
|
|
Locale designerLocale = GeneralContext.getLocale(); |
|
|
|
|
|
|
|
String file = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"); |
|
|
|
|
|
|
|
char displayChar = file.charAt(0); |
|
|
|
char displayChar = file.charAt(0); |
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
|
|
|
|
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
|
|
|
@ -314,13 +326,14 @@ public class DesignUtils { |
|
|
|
//比如想在中文或英文系统里用韩文设计器
|
|
|
|
//比如想在中文或英文系统里用韩文设计器
|
|
|
|
guiFRFont = getNamedFont("Dialog"); |
|
|
|
guiFRFont = getNamedFont("Dialog"); |
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
if (!guiFRFont.canDisplay(displayChar)) { |
|
|
|
FineLoggerFactory.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); |
|
|
|
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return guiFRFont; |
|
|
|
return guiFRFont; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private static FRFont getNamedFont(String name) { |
|
|
|
private static FRFont getNamedFont(String name) { |
|
|
|
return FRFont.getInstance(name, Font.PLAIN, 12); |
|
|
|
return FRFont.getInstance(name, Font.PLAIN, 12); |
|
|
|