jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimirsitni...@apache.org
Subject [jmeter] branch master updated: Avoid use of sun.* imports
Date Sun, 05 Apr 2020 11:20:41 GMT
This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 45b4b44  Avoid use of sun.* imports
45b4b44 is described below

commit 45b4b44da627026caff036cd49ce9af2053a1723
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
AuthorDate: Sun Apr 5 14:19:49 2020 +0300

    Avoid use of sun.* imports
---
 .../main/java/org/apache/jorphan/gui/JMeterUIDefaults.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/jorphan/src/main/java/org/apache/jorphan/gui/JMeterUIDefaults.java b/src/jorphan/src/main/java/org/apache/jorphan/gui/JMeterUIDefaults.java
index 93c634c..94e51af 100644
--- a/src/jorphan/src/main/java/org/apache/jorphan/gui/JMeterUIDefaults.java
+++ b/src/jorphan/src/main/java/org/apache/jorphan/gui/JMeterUIDefaults.java
@@ -17,6 +17,7 @@
 
 package org.apache.jorphan.gui;
 
+import java.awt.Canvas;
 import java.awt.Color;
 import java.awt.Font;
 import java.util.Collections;
@@ -36,8 +37,6 @@ import org.apiguardian.api.API;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import sun.font.FontDesignMetrics;
-
 /**
  * Configures JMeter-specific properties as {@link UIDefaults} properties for on-the-fly
LaF updates.
  * <p>The workflow is as follows:</p>
@@ -175,7 +174,13 @@ public class JMeterUIDefaults {
         }
         defaults.put(rowHeight, (UIDefaults.LazyValue) d -> {
             Font f = d.getFont(font);
-            float height = f == null ? 16 * scale : FontDesignMetrics.getMetrics(f).getHeight();
+            float height;
+            if (f == null) {
+                height = 16 * scale;
+            } else {
+                Canvas c = new Canvas();
+                height = c.getFontMetrics(f).getHeight();
+            }
             // Set line height to be 1.3 of the font size. The number of completely made
up,
             // 1.2 seems to be the minimal usable scale. 1.3 looks good.
             int round = (int) Math.floor(height * 1.3f);


Mime
View raw message