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: Make border for Comment to look exactly like borders around other text fields
Date Tue, 01 Oct 2019 20:21:48 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 9497afa  Make border for Comment to look exactly like borders around other text fields
9497afa is described below

commit 9497afa46288d9bd7a8475fc573ef4aa01ffeb5f
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
AuthorDate: Tue Oct 1 23:21:01 2019 +0300

    Make border for Comment to look exactly like borders around other text fields
    
    JTextArea does not have border by default (see https://bugs.openjdk.java.net/browse/JDK-4139076)
    It is probably intended to be wrapped into JScrollPane or something like that.
    
    However JMeter does not want to put scrolling there for now, so we want the border.
---
 src/core/src/main/java/org/apache/jmeter/gui/CommentPanel.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/gui/CommentPanel.java b/src/core/src/main/java/org/apache/jmeter/gui/CommentPanel.java
index f90fcf4..160abd1 100644
--- a/src/core/src/main/java/org/apache/jmeter/gui/CommentPanel.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/CommentPanel.java
@@ -20,10 +20,11 @@ package org.apache.jmeter.gui;
 
 import java.awt.BorderLayout;
 
-import javax.swing.BorderFactory;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.Border;
 
 import org.apache.jmeter.util.JMeterUtils;
 
@@ -52,7 +53,10 @@ public class CommentPanel extends JPanel {
         commentField = new JTextArea();
         JLabel commentLabel = new JLabel(JMeterUtils.getResString("testplan_comments"));
//$NON-NLS-1$
         commentLabel.setLabelFor(commentField);
-        commentField.setBorder(BorderFactory.createEtchedBorder());
+        // JTextArea does not have border by default (see https://bugs.openjdk.java.net/browse/JDK-4139076)
+        // However we want it to look like a text field. So we borrow a border from there
+        Border border = new JTextField().getBorder();
+        commentField.setBorder(border);
         commentLabel.setVerticalAlignment(JLabel.TOP);
         add(commentLabel, BorderLayout.WEST);
         add(commentField, BorderLayout.CENTER);


Mime
View raw message