Lines 18-24
Link Here
|
18 |
|
18 |
|
19 |
package org.apache.jmeter.util; |
19 |
package org.apache.jmeter.util; |
20 |
|
20 |
|
|
|
21 |
import java.awt.Dialog; |
22 |
import java.awt.Font; |
23 |
import java.awt.Frame; |
21 |
import java.awt.HeadlessException; |
24 |
import java.awt.HeadlessException; |
|
|
25 |
import java.awt.Window; |
22 |
import java.io.BufferedReader; |
26 |
import java.io.BufferedReader; |
23 |
import java.io.File; |
27 |
import java.io.File; |
24 |
import java.io.FileInputStream; |
28 |
import java.io.FileInputStream; |
Lines 35-40
Link Here
|
35 |
import java.util.MissingResourceException; |
39 |
import java.util.MissingResourceException; |
36 |
import java.util.Properties; |
40 |
import java.util.Properties; |
37 |
import java.util.ResourceBundle; |
41 |
import java.util.ResourceBundle; |
|
|
42 |
import java.util.Set; |
38 |
import java.util.Vector; |
43 |
import java.util.Vector; |
39 |
import java.util.concurrent.ThreadLocalRandom; |
44 |
import java.util.concurrent.ThreadLocalRandom; |
40 |
|
45 |
|
Lines 42-47
Link Here
|
42 |
import javax.swing.JOptionPane; |
47 |
import javax.swing.JOptionPane; |
43 |
import javax.swing.JTable; |
48 |
import javax.swing.JTable; |
44 |
import javax.swing.SwingUtilities; |
49 |
import javax.swing.SwingUtilities; |
|
|
50 |
import javax.swing.UIManager; |
45 |
|
51 |
|
46 |
import org.apache.commons.io.IOUtils; |
52 |
import org.apache.commons.io.IOUtils; |
47 |
import org.apache.jmeter.gui.GuiPackage; |
53 |
import org.apache.jmeter.gui.GuiPackage; |
Lines 1144-1147
Link Here
|
1144 |
return delimiterValue; |
1150 |
return delimiterValue; |
1145 |
} |
1151 |
} |
1146 |
|
1152 |
|
|
|
1153 |
/** |
1154 |
* Apply HiDPI scale factor on font if HiDPI mode is enabled |
1155 |
*/ |
1156 |
public static void applyHiDPIOnFonts() { |
1157 |
if (!getHiDPIMode()) { |
1158 |
return; |
1159 |
} |
1160 |
applyScaleOnFonts((float) getHiDPIScaleFactor()); |
1161 |
} |
1162 |
|
1163 |
/** |
1164 |
* Apply HiDPI scale factor on fonts |
1165 |
* @param scale flot scale to apply |
1166 |
*/ |
1167 |
public static void applyScaleOnFonts(final float scale) { |
1168 |
SwingUtilities.invokeLater(() -> { |
1169 |
Set<Object> keySet = UIManager.getLookAndFeelDefaults().keySet(); |
1170 |
Object[] keys = keySet.toArray(new Object[keySet.size()]); |
1171 |
for (Object key : keys) { |
1172 |
if (key != null && key.toString().toLowerCase().contains("font")) { |
1173 |
Font font = UIManager.getDefaults().getFont(key); |
1174 |
if (font != null) { |
1175 |
font = font.deriveFont(font.getSize() * scale); |
1176 |
UIManager.put(key, font); |
1177 |
} |
1178 |
} |
1179 |
} |
1180 |
JMeterUtils.refreshUI(); |
1181 |
}); |
1182 |
} |
1183 |
|
1184 |
/** |
1185 |
* Refresh UI after LAF change or resizing |
1186 |
*/ |
1187 |
public static final void refreshUI() { |
1188 |
for (Window w : Window.getWindows()) { |
1189 |
SwingUtilities.updateComponentTreeUI(w); |
1190 |
if (w.isDisplayable() && |
1191 |
(w instanceof Frame ? !((Frame)w).isResizable() : |
1192 |
w instanceof Dialog ? !((Dialog)w).isResizable() : |
1193 |
true)) { |
1194 |
w.pack(); |
1195 |
} |
1196 |
} |
1197 |
} |
1147 |
} |
1198 |
} |