Is there any naming convention for swing components such JButtons..? or does any body knows any good way for doing that?
Thanks
Is there any naming convention for swing components such JButtons..? or does any body knows any good way for doing that?
Thanks
Hungarian naming convention, though considered bad in general, suits very well for naming Swing UI components.
Examples:
JButton
for login
-> bLogin
, JTextField
for name
-> tfName
etc.
AFAIK, there is no special convention for swing elements.
The best thing you can do is using names as explicit as possible (as usual).
For my part I try to use the name of the wanted content followed by the type of the component.
For example for a textfield containing an age I would use ageTextField
.
For a button used to sumbit I would use submitButton
.
You should use common sense.
I prefer to add suffix to distinguish components, ie. passwordEdit
, sendButton
.
Somebody prefers hungarian notation, but anyway, you should be consistent and use same naming conventions through all the code of your project or module.