]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
1. Fix EDKT411: Need right and left scroll bar to display find results
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Tools.java
index e5cce71045b1e08c7eedd8d1b47edde075c5a25b..90c38fd8fe32c719184bb225a030a9283dccf619 100644 (file)
@@ -27,6 +27,7 @@ import javax.swing.DefaultListModel;
 import javax.swing.JComboBox;\r
 import javax.swing.JList;\r
 import javax.swing.JOptionPane;\r
+import javax.swing.JTable;\r
 \r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.MsaHeaderDocument.MsaHeader;\r
@@ -552,6 +553,22 @@ public class Tools {
         resizeComponentWidth(c, containerWidth, preferredWidth);\r
         resizeComponentHeight(c, containerHeight, preferredHeight);\r
     }\r
+    \r
+    /**\r
+     To adjust each column's width to meet the table's size\r
+     \r
+     @param t the table need to be adjusted\r
+     @param width the new width of the table\r
+    \r
+    **/\r
+    public static void resizeTableColumn(JTable t, int width) {\r
+        if (t != null) {\r
+            int columnCount = t.getColumnCount();\r
+            for (int index = 0; index < columnCount; index++) {\r
+                t.getColumn(t.getColumnName(index)).setPreferredWidth(width / columnCount);\r
+            }\r
+        }\r
+    }\r
 \r
     /**\r
      * To relocate the input component\r