Author: penyaskito
Date: 2008-08-29 04:13:41-0700
New Revision: 15648
Modified:
trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java
Log:
Fix for Issue 5320: Use i18n for labels tooltip.
Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java?view=diff&rev=15648&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java&r1=15647&r2=15648
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java 2008-08-29 04:13:41-0700
@@ -285,11 +285,8 @@
* @return the label added
*/
public JLabel addField(String label, Component component) {
- JLabel jlabel = new JLabel(Translator.localize(label));
- jlabel.setToolTipText(label);
- jlabel.setFont(stdFont);
+ JLabel jlabel = createLabelFor(label, component);
component.setFont(stdFont);
- jlabel.setLabelFor(component);
add(jlabel);
add(component);
if (component instanceof UMLLinkedList) {
@@ -304,6 +301,19 @@
return jlabel;
}
+ /**
+ * @param label The text of the label (the method cares about i18n)
+ * @param comp The component that this label is for
+ * @return a new JLabel
+ */
+ private JLabel createLabelFor(String label, Component comp) {
+ JLabel jlabel = new JLabel(Translator.localize(label));
+ jlabel.setToolTipText(Translator.localize(label));
+ jlabel.setFont(stdFont);
+ jlabel.setLabelFor(comp);
+ return jlabel;
+ }
+
/**
* Add a component with the specified label positioned after another
* component.
@@ -321,10 +331,8 @@
int nComponent = getComponentCount();
for (int i = 0; i < nComponent; ++i) {
if (getComponent(i) == afterComponent) {
- JLabel jlabel = new JLabel(Translator.localize(label));
- jlabel.setFont(stdFont);
+ JLabel jlabel = createLabelFor(label, component);
component.setFont(stdFont);
- jlabel.setLabelFor(component);
add(jlabel, ++i);
add(component, ++i);
return jlabel;
@@ -350,10 +358,8 @@
int nComponent = getComponentCount();
for (int i = 0; i < nComponent; ++i) {
if (getComponent(i) == beforeComponent) {
- JLabel jlabel = new JLabel(Translator.localize(label));
- jlabel.setFont(stdFont);
+ JLabel jlabel = createLabelFor(label, component);
component.setFont(stdFont);
- jlabel.setLabelFor(component);
add(jlabel, i - 1);
add(component, i++);
return jlabel;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.