88import javax .swing .SwingConstants ;
99import javax .swing .SwingUtilities ;
1010
11+ import de .visustruct .control .GlobalSettings ;
1112import de .visustruct .i18n .StructureElementI18n ;
1213
1314/** Klickbare Kachel zum Ziehen eines neuen Struktogramm-Elements (FlatLaf-Button-Look). */
@@ -27,7 +28,6 @@ public AuswahlPanelElement(int typ) {
2728 setIcon (null );
2829 setVerticalTextPosition (SwingConstants .CENTER );
2930 setHorizontalTextPosition (SwingConstants .CENTER );
30- setFont (new Font (Font .SANS_SERIF , Font .BOLD , 12 ));
3131 aktualisiereBeschriftung ();
3232 PaletteButtonStyle .apply (this );
3333 // Ohne released-Event (typisch nach DnD) bleibt das Button-Model „pressed“ → grauer Kasten
@@ -40,9 +40,9 @@ public void mouseReleased(MouseEvent e) {
4040 }
4141
4242 public void aktualisiereBeschriftung () {
43- setFont (new Font (Font .SANS_SERIF , Font .BOLD , 12 ));
44- // Immer UI-Sprache (I18n ); Standardtexte neuer Blöcke weiter über das Text-Preset (Java usw.) .
45- setText (StructureElementI18n . paletteShortLabel (typ ));
43+ setFont (new Font (Font .SANS_SERIF , Font .BOLD , textFontSizeFuerZeile ( GlobalSettings . gibElementBeschriftung ( typ )) ));
44+ // Kurztext = Vorgabe des gewählten Text-Presets (z. B. Java: Statement, condition, … ); Tooltip = didaktischer Name in der UI-Sprache .
45+ setText (GlobalSettings . gibElementBeschriftung (typ ));
4646 setToolTipText (StructureElementI18n .paletteTooltip (typ ));
4747 invalidate ();
4848 revalidate ();
@@ -52,4 +52,14 @@ public void aktualisiereBeschriftung() {
5252 public int gibTyp () {
5353 return typ ;
5454 }
55+
56+ private static int textFontSizeFuerZeile (String s ) {
57+ if (s == null || s .length () <= 12 ) {
58+ return 12 ;
59+ }
60+ if (s .length () <= 22 ) {
61+ return 11 ;
62+ }
63+ return 10 ;
64+ }
5565}
0 commit comments