Reputation: 12003
By default, the line length in Netbeans is 80 characters. I increased it up to 120.
Then I see, Tools->Options->Editor->Formatting->[Language:Java, Category:Wrapping] :: almost all the values are set to : Never [ never to wrap ].
Then I tried to reformat the java code using the Format context menu of the Netbeans editor window. I expected Netbeans to reformat this piece of code
out.println( amount + " dollars are " + yenAmount.toPlainString() + " yen."); out.println( yenAmount.toPlainString() + " yen are " + euroAmount.toPlainString() + " Euro.");
into something like that:
out.println(amount + " dollars are " + yenAmount.toPlainString() + "yen."); out.println(yenAmount.toPlainString() + " yen are " + euroAmount.toPlainString() + " Euro.");
Yet it did not happen. It leaves the wrapped lines as they are. Eclipse in this case would unwrap those lines if you reformat the code.
Is there any way to format the code in Netbeans as Eclipse does, at least to unwrap all the wrapped lines into long ones in a few clicks ?
Upvotes: 2
Views: 1556
Reputation: 1007
I did a regex replace
"\,\n\s*" with ", " and "\n\s*." with "."
remove double quotes. I added them so space would be visible
Upvotes: 1