39

I am using Eclipse. You see this ending curly bracket next to catch(FileNotFoundException fne) {:

enter image description here

How do I make it more noticeable when I select on starting curly brackets so I can clearly see where it ends?

pb2q
  • 58,613
  • 19
  • 146
  • 147
test
  • 17,706
  • 64
  • 171
  • 244

5 Answers5

65

From Window > Preferences, go to Java > Editor and Select Matching brackets highlight and pick a color that will stand out and also make sure Highlight matching brackets is checked :)

enter image description here

I changed mine to red and this is what it looks like now.(and I did not have to restart eclipse)

enter image description here

Bala R
  • 107,317
  • 23
  • 199
  • 210
  • I did not have to restart eclipse. Make sure Highlight matching brackets is checked :) – Bala R May 08 '11 at 03:52
  • @Jahkr : What else do you want ? I think BalaR has rightly provided with the solution. +1 from me. :) – Saurabh Gokhale May 08 '11 at 03:58
  • Yes it works... but I don't see the new color option. My only solution: Stop using Vista. :| Thanks. – test May 08 '11 at 04:02
  • For me, the highlight was checked by default when I installed eclipse. It was not highlighting for me though. When I changed the color to red and then restarted it started working. – grinch Jan 18 '13 at 18:35
  • 5
    uncheck the highlighting, apply, check it again, apply, worked for me – kiltek May 06 '13 at 19:05
  • Unchecking and rechecking works for me too, but any idea why this randomly turns off, and fairly frequently? I am using Eclipse EE for Web Developers, Juno Service Release 2. – WhyGeeEx Mar 28 '14 at 17:37
2

Many thanks for tips. Indeed these are helpful. I also find following a convenient way to see how brackets can be matched. if you just want to see where the matching bracket is, use ctrl+shift+p to navigate to the matching bracket. This is especially helpful for those who have used "vi" editor a lot and were used to "%" feature of "vi" to match brackets.

user245256
  • 21
  • 1
2

In newer versions (mine is 4.2.1 installed with ADT) you can also select the type of Bracket highlighting to:

  • Matching bracket - you must have cursor right next to the bracket and it will highlight only the corresponding bracket
  • Matching bracket and caret location - same as matching bracket, only it will highlight both brackets
  • Enclosing brackets - highlight both brackets that enclosing the place where your cursor is located

For my, I prefer Enclosing brackets for better orientation in general with red color as Bala R has shown.

arenaq
  • 2,304
  • 2
  • 24
  • 31
0

This worked for me . Go to Window>Preferences>General>Editors>Structured Text Editors . Select appropriate color and you are good to go.

enter image description here

A W
  • 1,041
  • 11
  • 18
0

For Eclipse IDE Version 2022-06.

  • Windows and Linux: Window > Preferences > Java > Editor
  • Mac: Eclipse > Preferences > Java > Editor

enter image description here

chikega
  • 135
  • 1
  • 6