WritingCodeForMobility

Contributing for Mobility

This tutorial show in examples how to contribute some code not only related to mobility pack

Doing some UI stuff

If you are working on UI related part for NetBeans, please keep some rules:

  • Use Matisse designer, it helps in many cases. On the other hand, do not forget, there are also other, "legacy", layout managers, you might find quite useful in many cases. The sample bellow shows some panel, which includes several components and more panel, where the component can be changed by switching combobox. In this case, layout whole panel using FreeLayout (default), layout the same way panel which will be included inside the panel, but remember: FreeLayout is something more friendly for tools rather than code writer! Here you can simply use BorderLayout as layout for embeded panel and add changing components by add(component, BorderLayout.CENTER).
  • Localize your code. Please note, NetBeans are translated to many languages. To make it simpler for translators, it requires to keep some rules, please follow them, they are not difficult.
  • If the text is not to be localized, leave the text where it is and mark the line //NOI18N
  • If the text should be localized, use org.openide.util.NbBundle for localizing it, put the key and text to Bundle.properties TBD rules for key names. Mark the line after it is localized by //NOI18N again. You can also find helper scripts for checking non localized and not marked lines in nb_all\nbbuild\misc.
  • There is the exception, you can not localize guarded blocks directly, mainly the ones generated by Form Designer. But it simple anyway. Go to properties, go to text property and press .... Select Mode -> Resource Bundle, Format -> Choose org.openide.util.NbBundle.getBundle(...) or getMessage(...) format. You should also browse right bundle or create new one (should be in same package). Then set up key and value.
  • Basic acessibility in UI: Make sure, all labels where it applies have set labelFor property. Make sure, you have mnemonics set up for labels. It is again simple: Go to properties panel -> Code -> Generate Mnemonics Code -> true, then you can use texts for key in the way &Browse where B will be shortcut using Alt-B. Make sure, mnemonics are not in the conflict on one page.
  • Use other than default fonts only when necessary. Make sure, you are not using Italic it looks bad in all situations.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo