1818import java .awt .BorderLayout ;
1919import java .awt .Font ;
2020import java .awt .font .TextAttribute ;
21+ import java .lang .reflect .InvocationTargetException ;
2122import java .util .Map ;
23+ import java .util .logging .Level ;
24+ import java .util .logging .Logger ;
2225import javax .annotation .Nonnull ;
2326import javax .annotation .ParametersAreNonnullByDefault ;
2427import javax .swing .JScrollPane ;
28+ import javax .swing .SwingUtilities ;
2529import org .exbin .bined .swing .section .SectCodeArea ;
30+ import org .exbin .framework .App ;
2631import org .exbin .framework .bined .gui .BinEdComponentPanel ;
2732import org .exbin .framework .bined .inspector .gui .BasicValuesPanel ;
2833import org .exbin .framework .bined .inspector .preferences .DataInspectorPreferences ;
@@ -46,8 +51,23 @@ public class BinEdComponentInspector implements BinEdComponentPanel.BinEdCompone
4651 @ Override
4752 public void onCreate (BinEdComponentPanel componentPanel ) {
4853 this .componentPanel = componentPanel ;
49- SectCodeArea codeArea = componentPanel .getCodeArea ();
5054
55+ if (SwingUtilities .isEventDispatchThread ()) {
56+ onCreateInt ();
57+ } else {
58+ try {
59+ SwingUtilities .invokeAndWait (() -> {
60+ onCreateInt ();
61+ });
62+ } catch (InterruptedException | InvocationTargetException ex ) {
63+ Logger .getLogger (BinEdComponentInspector .class .getName ()).log (Level .SEVERE , null , ex );
64+ }
65+ }
66+ setShowParsingPanel (true );
67+ }
68+
69+ private void onCreateInt () {
70+ SectCodeArea codeArea = componentPanel .getCodeArea ();
5171 valuesPanel = new BasicValuesPanel ();
5272 valuesPanel .setCodeArea (codeArea , null );
5373 if (basicValuesColorModifier != null ) {
@@ -56,7 +76,6 @@ public void onCreate(BinEdComponentPanel componentPanel) {
5676
5777 valuesPanelScrollPane = new JScrollPane (valuesPanel );
5878 valuesPanelScrollPane .setBorder (null );
59- setShowParsingPanel (true );
6079 }
6180
6281 @ Override
@@ -75,7 +94,9 @@ public void onInitFromPreferences(BinaryEditorPreferences preferences) {
7594 DataInspectorPreferences dataInspectorPreferences = new DataInspectorPreferences (preferences .getPreferences ());
7695 setShowParsingPanel (dataInspectorPreferences .isShowParsingPanel ());
7796 boolean useDefaultFont = dataInspectorPreferences .isUseDefaultFont ();
78- if (!useDefaultFont ) {
97+ if (useDefaultFont ) {
98+ setInputFieldsFont (new Font (Font .SANS_SERIF , Font .PLAIN , 13 ));
99+ } else {
79100 Map <TextAttribute , Object > fontAttributes = dataInspectorPreferences .getFontAttributes ();
80101 setInputFieldsFont (new Font (fontAttributes ));
81102 }
0 commit comments