X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FJava%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fcommon%2FTools.java;h=90c38fd8fe32c719184bb225a030a9283dccf619;hp=e5cce71045b1e08c7eedd8d1b47edde075c5a25b;hb=350785ff491baca1aae325c5b4636cc998e2951e;hpb=20480ea13852606681e9ad34a0b2bfffcbd01ff2 diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java index e5cce71045..90c38fd8fe 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java @@ -27,6 +27,7 @@ import javax.swing.DefaultListModel; import javax.swing.JComboBox; import javax.swing.JList; import javax.swing.JOptionPane; +import javax.swing.JTable; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea; import org.tianocore.MsaHeaderDocument.MsaHeader; @@ -552,6 +553,22 @@ public class Tools { resizeComponentWidth(c, containerWidth, preferredWidth); resizeComponentHeight(c, containerHeight, preferredHeight); } + + /** + To adjust each column's width to meet the table's size + + @param t the table need to be adjusted + @param width the new width of the table + + **/ + public static void resizeTableColumn(JTable t, int width) { + if (t != null) { + int columnCount = t.getColumnCount(); + for (int index = 0; index < columnCount; index++) { + t.getColumn(t.getColumnName(index)).setPreferredWidth(width / columnCount); + } + } + } /** * To relocate the input component