jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1607188 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
Date Tue, 01 Jul 2014 21:18:02 GMT
Author: pmouawad
Date: Tue Jul  1 21:18:02 2014
New Revision: 1607188

URL: http://svn.apache.org/r1607188
Log:
Bug 56303 - The width of target controller's combo list should be set to the current panel
size, not on label size of the controllers
Bugzilla Id: 56303

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java?rev=1607188&r1=1607187&r2=1607188&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
Tue Jul  1 21:18:02 2014
@@ -19,6 +19,7 @@
 package org.apache.jmeter.protocol.http.proxy.gui;
 
 import java.awt.BorderLayout;
+import java.awt.Component;
 import java.awt.Cursor;
 import java.awt.Dimension;
 import java.awt.datatransfer.DataFlavor;
@@ -744,9 +745,11 @@ public class ProxyControlGui extends Log
         targetNodes = new JComboBox(targetNodesModel);
         targetNodes.setPrototypeDisplayValue(""); // $NON-NLS-1$ // Bug 56303 fixed the width
of combo list
         JPopupMenu popup = (JPopupMenu) targetNodes.getUI().getAccessibleChild(targetNodes,
0); // get popup element
-        JScrollPane scrollPane = (JScrollPane) popup.getComponent(0);
-        scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL)); // add
scroll pane if label element is too long
-        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+        JScrollPane scrollPane = findScrollPane(popup);
+        if(scrollPane != null) {
+            scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL)); //
add scroll pane if label element is too long
+            scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+        }
         targetNodes.setActionCommand(CHANGE_TARGET);
         // Action listener will be added later
 
@@ -760,6 +763,16 @@ public class ProxyControlGui extends Log
         return panel;
     }
 
+    private JScrollPane findScrollPane(JPopupMenu popup) {
+        Component[] components = popup.getComponents();
+        for (Component component : components) {
+            if(component instanceof JScrollPane) {
+                return (JScrollPane) component;
+            }
+        }
+        return null;
+    }
+
     private JPanel createGroupingPanel() {
         DefaultComboBoxModel m = new DefaultComboBoxModel();
         // Note: position of these elements in the menu *must* match the



Mime
View raw message