Index: form/src/org/netbeans/modules/form/GandalfPersistenceManager.java =================================================================== RCS file: /cvs/form/src/org/netbeans/modules/form/GandalfPersistenceManager.java,v retrieving revision 1.113 diff -u -r1.113 GandalfPersistenceManager.java --- form/src/org/netbeans/modules/form/GandalfPersistenceManager.java 23 Jan 2003 15:45:08 -0000 1.113 +++ form/src/org/netbeans/modules/form/GandalfPersistenceManager.java 26 Feb 2003 18:43:53 -0000 @@ -17,6 +17,8 @@ import java.io.*; import java.util.*; import java.lang.reflect.*; +import javax.swing.AbstractButton; +import javax.swing.JLabel; import org.openide.explorer.propertysheet.editors.XMLPropertyEditor; import org.openide.filesystems.FileLock; @@ -567,6 +569,44 @@ loadSyntheticProperties(childNode, component); } // ignore unknown elements? + } + + // #27009 - if NetBeans development support is ON, then we append + // an AuxValue "Post-init" code to AbstractButton and JLabel + // to add org.openide.awt.Mnemonics.setLocalizedText API call + // in order to get nice-looking i18n: + // text=Anythi&ng expands to + // setText("Anything"), setMnemonic("N"), setDisplayedMnemonicIndex(6) + boolean support=true; + if (support) { + // if it's an AbstractButton or JLabel + if (component instanceof RADVisualComponent + && ( AbstractButton.class.isAssignableFrom(component.getBeanClass()) + || JLabel.class.isAssignableFrom(component.getBeanClass()) ) ) + { + // getting text property + String text=""; + String post_init=""; + try { + FormProperty prop; + prop=component.getPropertyByName("text"); + text=prop.getJavaInitializationString(); + // post_init=prop.getPostCode(); + } catch (Exception e) { + ErrorManager.getDefault().annotate(e, "My hack's problem"); + nonfatalErrors.add(e); + } + // getting aux-value "post-init code" + //if (post_init==null) + // post_init=""; + // checking, if a call to org.openide.awt.Mnemonics.setLocalizedText + // isn't already in post-init code + //if (post_init.indexOf("org.openide.awt.Mnemonics.setLocalizedText")==-1) { + String name=component.getName(); + String add="org.openide.awt.Mnemonics.setLocalizedText("+name+", "+text+");"; + component.setAuxValue("JavaCodeGenerator_InitCodePost",add); + //} + } } // if the loaded component is a visual component in a visual contianer,