This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 27009
Collapse All | Expand All

(-)form/src/org/netbeans/modules/form/GandalfPersistenceManager.java (+40 lines)
Lines 17-22 Link Here
17
import java.io.*;
17
import java.io.*;
18
import java.util.*;
18
import java.util.*;
19
import java.lang.reflect.*;
19
import java.lang.reflect.*;
20
import javax.swing.AbstractButton;
21
import javax.swing.JLabel;
20
22
21
import org.openide.explorer.propertysheet.editors.XMLPropertyEditor;
23
import org.openide.explorer.propertysheet.editors.XMLPropertyEditor;
22
import org.openide.filesystems.FileLock;
24
import org.openide.filesystems.FileLock;
Lines 567-572 Link Here
567
                loadSyntheticProperties(childNode, component);
569
                loadSyntheticProperties(childNode, component);
568
            }
570
            }
569
            // ignore unknown elements?
571
            // ignore unknown elements?
572
        }
573
        
574
        // #27009 - if NetBeans development support is ON, then we append 
575
        // an AuxValue "Post-init" code to AbstractButton and JLabel
576
        // to add org.openide.awt.Mnemonics.setLocalizedText API call
577
        // in order to get nice-looking i18n:
578
        // text=Anythi&ng expands to 
579
        // setText("Anything"), setMnemonic("N"), setDisplayedMnemonicIndex(6)
580
        boolean support=true;
581
        if (support) {
582
            // if it's an AbstractButton or JLabel
583
            if (component instanceof RADVisualComponent
584
                && ( AbstractButton.class.isAssignableFrom(component.getBeanClass())
585
                    || JLabel.class.isAssignableFrom(component.getBeanClass()) ) )
586
            {
587
                // getting text property
588
                String text="";
589
                String post_init="";
590
                try {
591
                    FormProperty prop;
592
                    prop=component.getPropertyByName("text");
593
                    text=prop.getJavaInitializationString();
594
                //    post_init=prop.getPostCode();
595
                } catch (Exception e) {
596
                    ErrorManager.getDefault().annotate(e, "My hack's problem");
597
                    nonfatalErrors.add(e);
598
                }
599
                // getting aux-value "post-init code"
600
                //if (post_init==null)
601
                //    post_init="";
602
                // checking, if a call to org.openide.awt.Mnemonics.setLocalizedText
603
                // isn't already in post-init code
604
                //if (post_init.indexOf("org.openide.awt.Mnemonics.setLocalizedText")==-1) {
605
                String name=component.getName();
606
                String add="org.openide.awt.Mnemonics.setLocalizedText("+name+", "+text+");";
607
                component.setAuxValue("JavaCodeGenerator_InitCodePost",add);
608
                //}
609
            }
570
        }
610
        }
571
611
572
        // if the loaded component is a visual component in a visual contianer,
612
        // if the loaded component is a visual component in a visual contianer,

Return to bug 27009