aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Confused about a line wrap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Confused about a line wrap" Watch "Confused about a line wrap" New topic
Author

Confused about a line wrap

Greg Funston
Ranch Hand

Joined: Feb 09, 2011
Posts: 81

What would be the best way to wrap this line of code?


Thanks,
Greg Funston SCJP
Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

I'd do it like this:


Personal page, SCJP 6 with 91%, SCWCD 5 with 84%, OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4913
    
  10

I have told this already quiet a few times: line wrapping is all in the courtesy of my IDE (Eclipse). I use the default built-in formatter with a few small changes (chars per line = 80) and I format each source file with this formatter. How lines are wrapped is not my concern, but I'm guaranteed all lines are formatted in the same way


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2247

Howdy, Greg!

How about the following:



Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Greg Funston
Ranch Hand

Joined: Feb 09, 2011
Posts: 81

Thanks Roberto. I normally think of stuff like that. I must be getting burnt. LOL.

Also thanks Elchin. That is where I put the break. Seemed the right place, but I prefer Roberto's.
It is cleaner.

Scheduled exam for this week. Can't wait to be done.

Cheers,
Greg Funston SCJP
Greg Funston
Ranch Hand

Joined: Feb 09, 2011
Posts: 81

Roel said

line wrapping is all in the courtesy of my IDE (Eclipse).


Yes, I downloaded the Eclipse IDE and spent a few minutes with it but I stopped shortly afterwards. I was
worried the learning curve would slow my project time down. I need to start using it because a lot of firms
use Eclipse. Maybe it is time before I submit to get familiar just for the code formatting.

Thanks to All.
Greg Funston SCJP
Greg Funston
Ranch Hand

Joined: Feb 09, 2011
Posts: 81

Roel, What version of Eclipse do you use? Do the Eclipse versions change much? I seem to recall you mentioned in a previous post the version and it was not a freeware version. I think I looked it up and it was $30 approx. My memory could be wrong though and maybe it was someone else.

Cheers,
Greg Funston SCJP
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4913
    
  10

The Eclipse version is always for free! If you want to use MyEclipse you can choose between different versions depending on your needs, but you'll have to pay (compared with other tools it's still very cheap). But for OCMJD I just used the latest version of Eclipse for Java Developers. And I used MyEclipse at a former company, so could be me Now just using Eclipse (for RCP and RAP Developers, combined with the WTP).

And as a side note: not using an IDE at all for developing your assignment I guess you just used a text editor and java/javac commands I'm pretty sure you spend a bunch of unneeded hours. Investing 2-3 hours in basic use of Eclipse would have saved you days, maybe even weeks (generating getters/setters, javadoc generation, formatting, detecting compiler errors due to typos,... you get it all for free)
Greg Funston
Ranch Hand

Joined: Feb 09, 2011
Posts: 81

I've been using netbeans which is a good IDE and I am familiar with it. It has been extremely good.
If it has an auto_formatter I have not found it yet, but then again I was not really looking for it. If I had
an auto formatter it may have saved me a few hours at the most. I am in the process of going over
every line of code right now to make sure I have nothing I do not want in there as well as enough comments etc.

Manual formatting of the comments will cost me a little time but not a lot. It forces me to look at each line of code
in detail.

Cheers,
Greg Funston SCJP

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4913
    
  10

Glad to hear you didn't develop the assignment using a text editor and java/javac

If you use NetBeans you can continue with that one, it's indeed a good IDE and I guess they work almost the same (I used it in the end of last year during 2 courses and had no real difficulties). NetBeans certainly has a code formatter (a simple google lookup confirms). If this formatting can be automatically invoked by each save action (like in Eclipse) I do not know.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confused about a line wrap
 
Similar Threads
JTextarea go to line
Stop text from wrapping
icons are not displaying in JTable last column
Objects available for GC
Help!What is wrong with this program? (a simple bank account program)