You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by vl...@apache.org on 2020/03/29 22:17:19 UTC

[jmeter] branch master updated: Avoid setting 0 values in singleLineRowHeight

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 aa3feba  Avoid setting 0 values in singleLineRowHeight
aa3feba is described below

commit aa3feba21907b50081fb800eaee154a4eeeefd55
Author: Vladimir Sitnikov <si...@gmail.com>
AuthorDate: Mon Mar 30 01:16:58 2020 +0300

    Avoid setting 0 values in singleLineRowHeight
    
    Technically speaking, JMeterUIDefaults ensure rowHeight is not 0,
    however, there are cases (e.g. unit tests) where defaults are not initialized.
---
 src/jorphan/src/main/java/org/apache/jorphan/gui/JFactory.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/jorphan/src/main/java/org/apache/jorphan/gui/JFactory.java b/src/jorphan/src/main/java/org/apache/jorphan/gui/JFactory.java
index 46d84cf..af5b9c1 100644
--- a/src/jorphan/src/main/java/org/apache/jorphan/gui/JFactory.java
+++ b/src/jorphan/src/main/java/org/apache/jorphan/gui/JFactory.java
@@ -17,7 +17,6 @@
 
 package org.apache.jorphan.gui;
 
-import java.awt.Font;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.util.function.Consumer;
@@ -138,7 +137,13 @@ public class JFactory {
     @API(since = "5.3", status = API.Status.EXPERIMENTAL)
     public static JTable singleLineRowHeight(JTable component) {
         return STYLE.withDynamic(component,
-                c -> c.setRowHeight(UIManager.getInt(JMeterUIDefaults.TABLE_ROW_HEIGHT)));
+                c -> {
+                    int rowHeight = UIManager.getInt(JMeterUIDefaults.TABLE_ROW_HEIGHT);
+                    // rowHeight is 0 when JMeterUIDefaults was not installed
+                    if (rowHeight != 0) {
+                        c.setRowHeight(rowHeight);
+                    }
+                });
     }
 
     /**