NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Right Margin red line

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
SquidWeed



Joined: 03 May 2009
Posts: 4

PostPosted: Sun May 03, 2009 1:12 am    Post subject: Right Margin red line Reply with quote

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

PostPosted: Sun May 03, 2009 8:59 am    Post subject: Reply with 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 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

PostPosted: Sun May 03, 2009 10:09 pm    Post subject: Reply with quote

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.





PostPosted: Mon May 04, 2009 1:12 am    Post subject: Right Margin red line Reply with quote

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

PostPosted: Mon May 04, 2009 2:08 am    Post subject: Reply with 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
WholeBean



Joined: 01 May 2009
Posts: 3

PostPosted: Mon May 04, 2009 6:52 am    Post subject: Reply with quote

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

PostPosted: Mon May 04, 2009 12:36 pm    Post subject: Reply with quote

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.





PostPosted: Mon May 04, 2009 1:48 pm    Post subject: Right Margin red line Reply with quote

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
rascal



Joined: 04 Jun 2013
Posts: 1

PostPosted: Tue Jun 04, 2013 6:50 pm    Post subject: Reply with quote

Isn't the 80 character limit a holdover from the days of punched cards??

Dave
Back to top
Flanker



Joined: 25 Jun 2013
Posts: 1

PostPosted: Tue Jun 25, 2013 9:00 am    Post subject: Reply with quote

Yes, 80 is for punched cards legacy (?). But we are in 2013 and you can set Rigth Margin to 0.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo