| View previous topic :: View next topic |
| Author |
Message |
SquidWeed
Joined: 03 May 2009 Posts: 4
|
Posted: Sun May 03, 2009 1:12 am Post subject: Right Margin red line |
|
|
Hi, I'm new to netBeans.
I'm trying to find an answer for couple of hours,
I don't undestand what is the use of the right margin red line.
The only thing I could think of is how annoying it is
What is the use of it?
Is it removable?
tnx in advanced ! |
|
| Back to top |
|
 |
WholeBean
Joined: 01 May 2009 Posts: 3
|
Posted: Sun May 03, 2009 8:59 am Post subject: |
|
|
It's there as a guide to line length.
Good style generally avoids lines longer than 80 characters,
and only 70 characters for examples intended to be used in
documentation.
The red line simply marks 80 characters wide (by default) and is a
visual guide to break long expressions over multiple lines.
You can adjust the placement of the red line in (Netbeans 6.7):
Tools > Options > Editor > Formatting.
On the left you'll see Right Margin, with a default value of 80.
If you want to remove the red line all together, you can either:
1. Increase the margin value to 160 or more; or goto
2. Tools > Options > Fonts and Colors, change the color of the Text Limit Line to white
There may be other ways, but these are the easiest ways I know of.
The Java Code Conventions can be found here
(and clause 4.1 is on page 9 of the pdf):
http://java.sun.com/docs/codeconv/CodeConventions.pdf
Hope that helps.
Regards,
Peter |
|
| Back to top |
|
 |
SquidWeed
Joined: 03 May 2009 Posts: 4
|
Posted: Sun May 03, 2009 10:09 pm Post subject: |
|
|
Making it 200 still won't make it disappear, just moving it a little bit to the right..
I still don't understand, how can I write a program with only 80 charactars per line? it's not even enough for the import statements
Thanks for replying peter! |
|
| Back to top |
|
 |
Peter B. West Posted via mailing list.
|
Posted: Mon May 04, 2009 1:12 am Post subject: Right Margin red line |
|
|
Alternatively, merge it into the background.
Tools->Options->Fonts&Colors->Highlighting->Text Limit Line
Set the foreground color to be the same as the background.
WholeBean wrote:
| Quote: | It's there as a guide to line length.
Good style generally avoids lines longer than 80 characters,
and only 70 characters for examples intended to be used in
documentation.
The red line simply marks the 80 characters point and is a
visual guide to break long declarations over multiple lines.
You can adjust the placement of the red line in Tools > Options > Formatting.
On the left you'll see "Right Margin", with a default value of 80.
If you want to remove the red line all together,
just increase the margin value to something large like 150.
The Java Code Conventions can be found here (and clause 4.1 is on page 9 of the pdf):
http://java.sun.com/docs/codeconv/CodeConventions.pdf
Hope that helps.
Regards,
Peter
|
--
Peter B. West <http://cv.pbw.id.au/>
Folio <http://defoe.sourceforge.net/folio/folio.html> |
|
| Back to top |
|
 |
SquidWeed
Joined: 03 May 2009 Posts: 4
|
Posted: Mon May 04, 2009 2:08 am Post subject: |
|
|
Please explain this to me,
It is better to write :
| Code: |
public static void main(String[]
args) {
// TODO code application logic
here
}
|
rather then :
| Code: |
public static void main(String[] args) {
// TODO code application logic here
}
|
It just doesn't make sense.. and it's not convenient to program like this |
|
| Back to top |
|
 |
WholeBean
Joined: 01 May 2009 Posts: 3
|
Posted: Mon May 04, 2009 6:52 am Post subject: |
|
|
The psvm statement is only 40 characters wide, so it shouldn't be up against the line limit indicator unless you are already starting it 40 characters in from the left margin, or the line limit is set to 40 characters or less.
Forty characters in is a long way to be starting your main method and would definitely make your code look strange if you then also tried to stick to the 80 character length convention.
If you have a genuine reason for starting your statements so far in from the left then I would suggest you move the line or change its color, but also look at why you are so far into the document as well.
At most you should reach 4-5 tabs in, which is only 16-20 characters from the left, leaving you plenty of room for your statements.
Especially for something like a main method, that's mostly managed at just one tab in (4 characters).
Additionally, if you also can't fit your import statements into 80 characters then there is something else going wrong.
Regards,
Peter
Regards,
Peter |
|
| Back to top |
|
 |
SquidWeed
Joined: 03 May 2009 Posts: 4
|
Posted: Mon May 04, 2009 12:36 pm Post subject: |
|
|
You right, I just noticed that the line is drawing at char 38, even though it's set to 80.
You have any idea what can cause this?
I'm using the latest netbeans on windows vista x64. |
|
| Back to top |
|
 |
Thomas Wolf Posted via mailing list.
|
Posted: Mon May 04, 2009 1:48 pm Post subject: Right Margin red line |
|
|
I think the red line is a holdover from the days of the 80-character
terminal. If you don't like it, you can set it to the background color
as Peter suggested or simply make it much larger - I set it to 160
characters. Keeps it off my screen unless I scroll horizontally.
tom
On 05/03/2009 10:09 PM, SquidWeed wrote:
| Quote: | Please explain this to me,
It is better to write :
Code:
public static void main(String[]
args) {
// TODO code application logic
here
}
rather then :
Code:
public static void main(String[] args) {
// TODO code application logic here
}
It just doesn't make sense.. and it's not convenient to program like this
|
|
|
| Back to top |
|
 |
|