Word Wrap in Net Beans
Asked Answered
S

17

23

Netbeans is great but there's no way to wrap text in it (or hopefully I haven't found it yet). Is there any way to do this, and if not, is there any similarly good IDE for Java with this functionality (hopefully free as well).

Sybilla answered 1/11, 2008 at 17:56 Comment(2)
I dont think I would even want wordwrap in my IDE. Never even thought of that. Wouldnt it just be confusing?Coryden
Word Wrap is useful when dealing with HTML or long PHP strings.Glutelin
D
48

You can use word wrap in Netbeans.

Add the following to netbeans.conf (netbeans_installation_path/etc/netbeans.conf, by default /etc/netbeans.conf under linux):

-J-Dorg.netbeans.editor.linewrap=true

to the sixth line so it looks like this:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.editor.linewrap=true"

and restart Netbeans.

Set the Line Wrap option in Tools->Options->Editor->Formating.

Works fine for me in Netbeans 6.9 and 7

Disenchant answered 30/10, 2010 at 14:25 Comment(6)
the line wrap option on mine continues to be grey-ed out. am i missing a step? running 6.9.1 on windowsEject
Grayed out for me too. NetBeans 6.9.1 on Windows XP as well.Antidromic
Worked for me on OSX 10.6 Netbeans 6.9.1. Thanks you, thank you, thank you!Category
Line wrap option is available but greyed out on mine as well. Netbeans 6.9.1 / OSX 10.6Brunobruns
Greyed out, Windows 7 64 bit. 6.9.1Demmer
This is now a mainline feature in Netbeans 7, found in the same place described above.Obligee
A
21

If you do web development you are going to understand why text wrapping is important.

A programmer who has never gotten their hands dirty with HTML has never seen the real web. You can insist on MVC all you want to but 99.9% of the world wide web since its inception wasn't built that way. Unless you're always developing from a clean slate and can use MVC to separate the HTML out AND assuming you have an on-staff web designer who does html/css/javascript or you have an interface developer who you can fob it off on you WILL have to deal with everything that has been developed/kludged/hacked together with what ever technologies were at hand or popular or affordable at the time and now more or less functions as a 'web application'. And 99.9% of the time what you will have to work with is a mix of some kind of a programming language, most likely an interpreted one, with html and javascript all mixed in the same page.

And this means no nice short lines of neat clean java code that oh so conveniently end before 80 characters.

And when you deal with this -- which, dear hearts, is most of the web -- you magically discover the crying need for text wrapping to keep the long lines from making you scroll waaaay to the right to get to the end of it.

Some people. Sheesh. They think the whole universe of development has always fit on 80 characters per line, and from some of these comments, they seem to think it always will.

Abduct answered 23/6, 2010 at 18:43 Comment(2)
I am a web developer and I know those long lines. Thats why there is the END button on the keyboard.Croydon
-1, the question isn't asking about text wrapping for web dev. If the answer was meant as a reply to other comments, it should be a comment on those answers, not a (seemingly useless) answer to the OPs questionVachil
A
4

Netbeans 7 is out and it supports word wrap out of the box!

Achievement answered 5/5, 2011 at 13:59 Comment(0)
C
1

There's word-wrap eclipse plugin: see http://ahtik.com/blog/eclipse-word-wrap/

Clintonclintonia answered 25/2, 2009 at 10:0 Comment(0)
D
1

Like Joseph said: why would you need this. Java is not white space sensitive and having very long statements does not make your code easy to read.

Derril answered 26/3, 2009 at 5:28 Comment(1)
Good point. Though the original poster specifically mentioned Java, NetBeans also has support for a number of very webcentric languages like php and ruby, which will all to often face massive lines of HTML. I would prefer having softwraping available as an option.Brunobruns
P
1

It always goes back to Ultraedit.

Why can't we as a human race figure this out? netbeans, eclipse, zend studio (eclipse), etc don't do something very simple for programming, that most programmers -need to have- to keep a sound coding convention. Sure, it's true that coding style contributes to length of lines (erm microsoft programmers, perk your ears), but sometimes one cannot avoid long string literals. This is insanity! And yet I can't be mad or ungrateful because it's open source. And i -am- grateful. Still, one has to wonder wtf programmers who make these editors are actually using themselves.

I want an editor to wrap at column 80 or 120, not at the window's edge like notepad++. The only tool I've found that does hard/soft wrapping is ultraedit, so maybe I should try to see if I can get it to run under wine, since UE is the only 'real' editor that does it's job other than something weird / ugly / takes forever to learn and configure like emacs. And I am not going down that road- it gives me migranes to look at it because it's 2009 and we have cleartext and guis.

Is it really that difficult a problem to solve? If you draw a line down from column x and your word crosses over it, then put the beginning of the word under the indention of the line from which it started and mark the spill over row as a wrap row. Done.

Pinguid answered 5/5, 2009 at 23:55 Comment(0)
D
1

Actually i heard netbeans is going to add word wrap feature in 6.7 release but then they decided to include this feature in 7.0 . hopefully we would see word wrap in the next release, according to few developers this isn't a necessary feature but for web developers this is totally needed.

Deliberative answered 15/8, 2010 at 5:22 Comment(0)
S
1

There is a great solution to this at this website blog.robbychen.com

The jist is to add the following line inside the quotes for netbeans_default_options inside the config file then restart netbeans:

-J-Dorg.netbeans.editor.linewrap=true
Stratfordonavon answered 12/2, 2011 at 2:0 Comment(0)
W
0

Except Eclipse does not support word wrap either, and they even don't have set up a target for this. Just like Netbeans, this has been asked by many users, but was never included. It appears it requires much change, and as well does not seem to be a high priority for devs. There was once a beginning of a plugin trying to word wrap in a limited way, but of course it does not work on recent versions.

Warta answered 9/2, 2009 at 9:5 Comment(0)
H
0

When you get to where you want the line to end, just start a new line without ending the statement. It may underline it in red until you end the statement, but it won't cause any exceptions.

I find that it is also a good way to organize long println() statements.

Hanging answered 26/3, 2009 at 1:57 Comment(0)
C
0

Komodo Edit. In addition to its many other marvelous features, it actually wraps lines.

Concubine answered 11/10, 2009 at 15:33 Comment(0)
I
0

2 points:

  • Just found that wrapping is really needed if one wants to look into those damn SVG sources auto-generated when putting components from SVG palette...

  • I'm going to solve my current problem with seeing full SVG source by copy-paste to jEdit which is as configurable as Ultraedit (in the aspect of wrapping) and FoC!

Iaea answered 10/3, 2010 at 23:37 Comment(0)
D
0

As many have already noted, the answer is "you can't." As someone who uses Visual Studio and Eclipse-based products every day, when I am using Eclipse, I am constantly missing Visual Studio's line wrapping features, which I can turn on and off with a keystroke.

To the many people who have responded "you don't need this," stop being so condescending. Simply because you don't need a feature doesn't mean nobody else in the world does. Even if one were to religiously follow the advice "never have a line over 80 characters," you're going to need to edit code that others have composed and goes over 80 chars. And especially in the web-world, lines can get tremendously long. It's inevitable that you'll spend a lot of time looking at other people's code that goes way over 80 chars.

jEdit's line wrapping is very good. It preserves indentation and can be turned on an off very quickly. If I'm dealing with some very unwieldy long lines, I sometimes copy/paste in jEdit (which offers syntax highlighting for a myriad of languages) and use the line wrapping available there.

Dennard answered 1/10, 2010 at 13:39 Comment(0)
G
0

The new version of Netbeans supports it. See this post for instructions:

Word Wrap in Netbeans

Gaudette answered 12/1, 2012 at 20:35 Comment(0)
D
0

Of course word wrap is useful for coders - what about when you're writing README.txt files and you have to stick to coding standards like http://drupal.org/node/161085 where is says there needs to be an 80 character word wrap.

Doubtless answered 10/9, 2012 at 11:31 Comment(0)
S
0

In netbeans 7.3 you go to tools->options->editor->formatting, in the left menu area select the bottom most drop down that says line wrap, select your preference...done

Surber answered 12/5, 2013 at 17:59 Comment(0)
A
-7

Get a bigger monitor.

At 1920 x 1080 you don't need no steenkin word-wrap.

Update: Wow, still getting downvotes. Maybe it's just how I said it. At least it hasn't caught up to the Eclipse answer yet.

I really thought this was a legitimate suggestion. I never thought that having a bigger monitor would make as much of a difference to coding as it has for me. If you're using a small monitor to code please consider getting a nice big new one. It does eliminate the need for word wrap in a lot of cases.

Achievement answered 26/3, 2009 at 21:22 Comment(1)
It is the way you said it :) I've got a tv and a std 17", and you're right, word wrap isn't as necessary on the tv but suggesting to buy a TV :S That said, I dunno why this is exclusively getting so many downvotes - there's 2 or 3 answers upvoted asking the OP why he'd want to do this? they're comments, and shouldn't be cluttering the answer space :/Vachil

© 2022 - 2024 — McMap. All rights reserved.