Alexander
Alexander

Reputation: 48272

How to configure Eclipse so it adds private fields at the bottom of a Java class?

How to configure Eclipse so it adds private fields at the bottom of a Java class?

By default when I select 'create a field..' the field gets added at the top of the class. Can I configure Eclipse so the fields are added at the bottom instead?

Upvotes: 6

Views: 940

Answers (1)

Adam Stelmaszczyk
Adam Stelmaszczyk

Reputation: 19857

Window > Preferences

On the left choose: Java > Appearance > Members Sort Order

On the right select Fields and check Sort members in same category by visibility.

After that right-click your project and choose Source > Sort members... to modify the source code. You can configure Eclipse to execute this action automatically on save: go once again to the preferences Window > Preferences and then Java > Editor > Save actions, and click on Configure for additional actions.

Upvotes: 9

Related Questions