• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing NetBeans Style

 
Farid Abdi
Greenhorn
Posts: 12
Java Java ME Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I learned Java alittle with JDK tools...Now I want to start programming with NetBeans...But there is a little problem :
The book that taught me Java used a convention like this :
ClassName
{
....
}

But my NetBeans uses this convention :
ClassName{
...
}

How I could change the setting and preferences in my NetBeans so that its convention and appearance of source code changes to my style
Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our IDEs forum.

I rarely use NetBeans myself, so I don't know. Remember it is a convention not a rule.
 
Farid Abdi
Greenhorn
Posts: 12
Java Java ME Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What IDE you suggest ?
What IDE follows my convention ?
Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually use Eclipse. You can set preferences as properties of the current project, and “export” them as a configuration file.
Maybe somebody will know how to do it in NetBeans. I found a few possible links by Googling: maybe this will help, or this. The process seems quite simple, and similar to what I am used to doing with Eclipse.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is configurable in NetBeans. I'm using NetBeans 7.2.1, but I think the process will be very similar in other versions:

1) Chose Tools/Options from the menu
2) In the Options form, click the Editor button and choose Formatting tab
3) Choose Java in the Language combo box. Now browse individual categories in the Category combo box, there is a lot of options. The position of the braces can be configured in the Braces category.
 
Farid Abdi
Greenhorn
Posts: 12
Java Java ME Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Now I installed Eclipse....How I can change that convention in Eclipse ??? ....Thanks
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse enables you to control all aspects of coding style. Look at Windows | Preferences | Java | Code Style | Formatter. There you can tweak the formatting to your hearts content. I recommend first making a copy of an existing profile and modifying the copy.

Also, while on the Preferences dialog, look at Java | Editor | Save Actions - one of the things you can do automatically when saving is reformatting.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic