From c777d1d406bc4c5394ef4e7e750a552c5bf6c8b3 Mon Sep 17 00:00:00 2001 From: jlin16 Date: Mon, 23 Oct 2006 08:46:53 +0000 Subject: [PATCH] Fix the problem of label, button text part-display on Linux and iMac. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1829 6f19259b-4bc3-4df7-8a09-765794883524 --- .../packaging/ui/SpdGuidDecls.java | 15 ++++--- .../packaging/ui/SpdLibClassDecls.java | 6 ++- .../packaging/ui/SpdPcdDefs.java | 45 ++++++++++++++----- .../ui/FpdDynamicPcdBuildDefinitions.java | 6 ++- .../platform/ui/FpdFrameworkModules.java | 5 ++- .../platform/ui/FpdModuleSA.java | 6 +-- 6 files changed, 60 insertions(+), 23 deletions(-) diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java index 8aaad5db45..2357df2b09 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. package org.tianocore.frameworkwizard.packaging.ui; import java.awt.Dimension; +import java.awt.FontMetrics; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; @@ -163,7 +164,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ protected JTextField getJTextFieldGuid() { if (jTextFieldGuid == null) { jTextFieldGuid = new JTextField(); - jTextFieldGuid.setBounds(new java.awt.Rectangle(137,60,435,20)); + jTextFieldGuid.setBounds(new java.awt.Rectangle(137,60,336,20)); jTextFieldGuid.setPreferredSize(new java.awt.Dimension(200,20)); } @@ -490,16 +491,20 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ jLabelGuidType.setText("GUID Type List"); jLabelGuidType.setEnabled(true); starLabel = new StarLabel(); - starLabel.setLocation(new Point(jLabelGuidType.getX() - 20, jLabelGuidType.getY())); + starLabel.setLocation(new Point(jLabelGuidType.getX() - 10, jLabelGuidType.getY())); starLabel.setVisible(true); jLabelSupArch = new JLabel(); jLabelSupArch.setBounds(new java.awt.Rectangle(197,122,108,16)); - jLabelSupArch.setText("Supported Arch"); + jLabelSupArch.setText("Supported Architectures"); jLabelSupArch.setEnabled(true); + FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont()); + jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20); jLabelSupMod = new JLabel(); jLabelSupMod.setBounds(new java.awt.Rectangle(14,120,110,16)); - jLabelSupMod.setText("Supported Module"); + jLabelSupMod.setText("Supported Module Types"); jLabelSupMod.setEnabled(true); + fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont()); + jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20); jLabelHelp = new JLabel(); jLabelHelp.setText("HelpText"); jLabelHelp.setSize(new java.awt.Dimension(109,20)); @@ -716,7 +721,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ protected JButton getJButtonGen() { if (jButtonGen == null) { jButtonGen = new JButton(); - jButtonGen.setBounds(new java.awt.Rectangle(379,58,92,21)); + jButtonGen.setBounds(new java.awt.Rectangle(485,58,92,21)); jButtonGen.setText("Gen GUID"); jButtonGen.setPreferredSize(new java.awt.Dimension(80,20)); jButtonGen.addActionListener(this); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java index a69a958871..a0882d2e77 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. package org.tianocore.frameworkwizard.packaging.ui; import java.awt.Dimension; +import java.awt.FontMetrics; import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; import java.io.File; @@ -423,8 +424,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen if (jButtonRemoveAll == null) { jButtonRemoveAll = new JButton(); jButtonRemoveAll.setText("Remove All"); - jButtonRemoveAll.setSize(new java.awt.Dimension(buttonWidth,20)); - jButtonRemoveAll.setBounds(new java.awt.Rectangle(removeAllButtonCol,rowSeven,buttonWidth,20)); + jButtonRemoveAll.setLocation(removeAllButtonCol,rowSeven); + FontMetrics fm = jButtonRemoveAll.getFontMetrics(jButtonRemoveAll.getFont()); + jButtonRemoveAll.setSize(fm.stringWidth(jButtonRemoveAll.getText()) + 50, 20); jButtonRemoveAll.addActionListener(this); } return jButtonRemoveAll; diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java index dade7ca3dc..7abf5c0f2e 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. package org.tianocore.frameworkwizard.packaging.ui; import java.awt.Dimension; +import java.awt.FontMetrics; import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; @@ -171,6 +172,15 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ this.setTitle("PCD Declarations"); this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + int xPos = jCheckBoxPatchInMod.getX() + jCheckBoxPatchInMod.getWidth(); + jCheckBoxFixedAtBuild.setLocation(xPos,133); + + xPos = jCheckBoxFeatureFlag.getX() + jCheckBoxFeatureFlag.getWidth(); + jCheckBoxDyn.setLocation(xPos,161); + + xPos = jCheckBoxDyn.getX() + jCheckBoxDyn.getWidth(); + jCheckBoxDynEx.setLocation(xPos,161); + } /** @@ -355,17 +365,23 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ jLabelSupArch.setBounds(new java.awt.Rectangle(241,192,89,16)); jLabelSupArch.setText("Supported Architectures"); jLabelSupArch.setEnabled(true); + FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont()); + jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20); jLabelSupMod = new JLabel(); jLabelSupMod.setBounds(new java.awt.Rectangle(15,193,103,16)); - jLabelSupMod.setText("Supported Module type"); + jLabelSupMod.setText("Supported Module types"); jLabelSupMod.setEnabled(true); + fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont()); + jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20); starLabel = new StarLabel(); starLabel.setBounds(new java.awt.Rectangle(2,134,10,20)); jLabelDefVal = new JLabel(); jLabelDefVal.setBounds(new java.awt.Rectangle(277,84,80,20)); jLabelDefVal.setText("Default Value"); + fm = jLabelDefVal.getFontMetrics(jLabelDefVal.getFont()); + jLabelDefVal.setSize(fm.stringWidth(jLabelDefVal.getText()) + 10, 20); jLabelVarVal = new JLabel(); - jLabelVarVal.setBounds(new java.awt.Rectangle(11,133,84,20)); + jLabelVarVal.setBounds(new java.awt.Rectangle(11,133,100,20)); jLabelVarVal.setText("Valid Usage"); jLabelC_Name = new JLabel(); jLabelC_Name.setText("C Name"); @@ -575,7 +591,8 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JTextField getJTextFieldDefaultValue() { if (jTextFieldDefaultValue == null) { jTextFieldDefaultValue = new JTextField(); - jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(368,84,105,20)); + int xPos = jLabelDefVal.getX() + jLabelDefVal.getWidth(); + jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(xPos,84,105,20)); jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(104,20)); } return jTextFieldDefaultValue; @@ -871,7 +888,8 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ jCheckBoxFeatureFlag = new JCheckBox(); jCheckBoxFeatureFlag.setBounds(new java.awt.Rectangle(156,161,100,21)); jCheckBoxFeatureFlag.setText("Feature Flag"); - jCheckBoxFeatureFlag.setPreferredSize(new java.awt.Dimension(21,20)); + FontMetrics fm = jCheckBoxFeatureFlag.getFontMetrics(jCheckBoxFeatureFlag.getFont()); + jCheckBoxFeatureFlag.setSize(fm.stringWidth(jCheckBoxFeatureFlag.getText()) + 30, 20); jCheckBoxFeatureFlag.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { if (jCheckBoxFeatureFlag.isSelected()) { @@ -894,9 +912,10 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JCheckBox getJCheckBoxFixedAtBuild() { if (jCheckBoxFixedAtBuild == null) { jCheckBoxFixedAtBuild = new JCheckBox(); - jCheckBoxFixedAtBuild.setBounds(new java.awt.Rectangle(312,133,108,20)); + jCheckBoxFixedAtBuild.setText("Fixed at Build"); - jCheckBoxFixedAtBuild.setPreferredSize(new java.awt.Dimension(21,20)); + FontMetrics fm = jCheckBoxFixedAtBuild.getFontMetrics(jCheckBoxFixedAtBuild.getFont()); + jCheckBoxFixedAtBuild.setSize(fm.stringWidth(jCheckBoxFixedAtBuild.getText()) + 30, 20); jCheckBoxFixedAtBuild.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { if (jCheckBoxFixedAtBuild.isSelected()) { @@ -916,9 +935,11 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JCheckBox getJCheckBoxPatchInMod() { if (jCheckBoxPatchInMod == null) { jCheckBoxPatchInMod = new JCheckBox(); + jCheckBoxPatchInMod.setBounds(new java.awt.Rectangle(156,133,154,20)); jCheckBoxPatchInMod.setText("Patchable in Module"); - jCheckBoxPatchInMod.setPreferredSize(new java.awt.Dimension(21,20)); + FontMetrics fm = jCheckBoxPatchInMod.getFontMetrics(jCheckBoxPatchInMod.getFont()); + jCheckBoxPatchInMod.setSize(fm.stringWidth(jCheckBoxPatchInMod.getText()) + 30, 20); jCheckBoxPatchInMod.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { if (jCheckBoxPatchInMod.isSelected()) { @@ -938,9 +959,10 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JCheckBox getJCheckBoxDyn() { if (jCheckBoxDyn == null) { jCheckBoxDyn = new JCheckBox(); - jCheckBoxDyn.setBounds(new java.awt.Rectangle(278,161,80,20)); + jCheckBoxDyn.setText("Dynamic"); - jCheckBoxDyn.setPreferredSize(new java.awt.Dimension(21,20)); + FontMetrics fm = jCheckBoxDyn.getFontMetrics(jCheckBoxDyn.getFont()); + jCheckBoxDyn.setSize(fm.stringWidth(jCheckBoxDyn.getText()) + 30, 20); jCheckBoxDyn.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { if (jCheckBoxDyn.isSelected()) { @@ -960,9 +982,10 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JCheckBox getJCheckBoxDynEx() { if (jCheckBoxDynEx == null) { jCheckBoxDynEx = new JCheckBox(); - jCheckBoxDynEx.setBounds(new java.awt.Rectangle(371,161,99,20)); + jCheckBoxDynEx.setText("DynamicEx"); - jCheckBoxDynEx.setPreferredSize(new java.awt.Dimension(21,20)); + FontMetrics fm = jCheckBoxDynEx.getFontMetrics(jCheckBoxDynEx.getFont()); + jCheckBoxDynEx.setSize(fm.stringWidth(jCheckBoxDynEx.getText()) + 30, 20); jCheckBoxDynEx.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { if (jCheckBoxDynEx.isSelected()) { diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java index 2dd39b459c..04fc791c48 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java @@ -1,6 +1,8 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FontMetrics; import javax.swing.ButtonGroup; import javax.swing.JOptionPane; @@ -487,7 +489,9 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { if (jButtonSkuInfoUpdate == null) { jButtonSkuInfoUpdate = new JButton(); jButtonSkuInfoUpdate.setPreferredSize(new java.awt.Dimension(180,20)); - jButtonSkuInfoUpdate.setText(" Update SKU Information"); + jButtonSkuInfoUpdate.setText("Update SKU Value"); + FontMetrics fm = jButtonSkuInfoUpdate.getFontMetrics(jButtonSkuInfoUpdate.getFont()); + jButtonSkuInfoUpdate.setPreferredSize(new Dimension (fm.stringWidth(jButtonSkuInfoUpdate.getText()) + 40, 20)); jButtonSkuInfoUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { int pcdSelected = jTableDynPcd.getSelectedRow(); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 2d1142301c..78ea7d641a 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -15,6 +15,8 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FontMetrics; import javax.swing.JFrame; import javax.swing.JOptionPane; @@ -719,8 +721,9 @@ public class FpdFrameworkModules extends IInternalFrame { private JButton getJButtonRemoveModule() { if (jButtonRemoveModule == null) { jButtonRemoveModule = new JButton(); - jButtonRemoveModule.setPreferredSize(new java.awt.Dimension(130, 20)); jButtonRemoveModule.setText("Remove Module"); + FontMetrics fm = jButtonRemoveModule.getFontMetrics(jButtonRemoveModule.getFont()); + jButtonRemoveModule.setPreferredSize(new Dimension (fm.stringWidth(jButtonRemoveModule.getText()) + 40, 20)); jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { int selectedRow = jTableFpdModules.getSelectedRow(); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index 18cb1603b9..917585908c 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -199,7 +199,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { // resolveLibraryInstances(moduleKey); } catch (Exception e) { - JOptionPane.showMessageDialog(frame, e.getMessage()); + JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage()); } // // display lib instances already selected for key @@ -225,7 +225,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { try { resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]); } catch (Exception e) { - JOptionPane.showMessageDialog(frame, e.getMessage()); + JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage()); } selectedInstancesTableModel.addRow(saa[i]); } @@ -1905,7 +1905,7 @@ class MultipleInstanceException extends Exception { @Override public String getMessage() { // TODO Auto-generated method stub - return "Library Class " + className + "is Produced by Two Instances: " + return " Library Class " + className + "is Produced by Two Instances: " + libInstance1 + " and " + libInstance2 + ". Platform Build will Fail."; }