Skip to content
Snippets Groups Projects
Commit 7995b049 authored by Simon Barner's avatar Simon Barner
Browse files

FontMetrics.getAverageCharWidth() -> getAverageCharacterWidth()

* FontMetrics.getAverageCharWidth() has been deprecated

Issue-Ref: 3539
Issue-Url: https://af3-developer.fortiss.org/issues/3539



Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent 63372ad7
No related branches found
No related tags found
1 merge request!273539
......@@ -10,4 +10,4 @@ PropertiesConstantUtils.java 59b1a1e4d594bb98db3aa396f2ff6474ba405920 GREEN
SelectionUtils.java 3d20f87eaaee04173686ef62b09ca6971702cd00 GREEN
TutorialUIServiceUtils.java 093a8a3549c6952d44ea508e66691434b17a95b5 GREEN
UndoRedoImpl.java f218500875bda0ef52f4cc2ccdf452825e6751f7 GREEN
WidgetsFactory.java ef048953bf7629341786e1b4ab451053f3a9aa94 GREEN
WidgetsFactory.java 5be121cc81e93731f4d0ab11e7707417fa950c2c YELLOW
......@@ -74,7 +74,9 @@ public class WidgetsFactory {
text.setText(initialText);
GC gc = new GC(text);
FontMetrics fm = gc.getFontMetrics();
int width = charsNumber * fm.getAverageCharWidth();
// Cast double -> int is safe because FontMetrics.getAverageCharacterWidth() is implemented
// by calling "int FontMetrics.getAverageCharWidth()"
int width = charsNumber * (int)fm.getAverageCharacterWidth();
int height = fm.getHeight();
gc.dispose();
text.setLayoutData(new GridData(width, height));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment