Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

carriage return in netbeans 5.0

Thread view: 
Lara - 12 Mar 2007 14:56 GMT
In netbeans 5.0, carriage return results e.g:

System.ou.print("Welcome \rto java");

Welcome
to java

Why???
DJAnonimo - 12 Mar 2007 15:37 GMT
Maybe you want ?

System.out.println("Welcome \nto java");

> In netbeans 5.0, carriage return results e.g:
>
[quoted text clipped - 4 lines]
>
> Why???
Mark Space - 12 Mar 2007 17:05 GMT
> In netbeans 5.0, carriage return results e.g:
>
[quoted text clipped - 4 lines]
>
> Why???

Looks ok to me.  What were you expecting?
Lara - 13 Mar 2007 15:51 GMT
Mark Space أرسلت:
> > In netbeans 5.0, carriage return results e.g:
> >
[quoted text clipped - 6 lines]
>
> Looks ok to me.  What were you expecting?

\r means carriage return not new line
so, the result must be

to java

the cursor will return to the start of current line

another e.g:

System.out.print("Welcome \rjava");

the output:

javaome

but in netbeans 5.0 the output is:

Welcome
java

????
like \n?

????
Oliver Wong - 13 Mar 2007 20:16 GMT
>Mark Space ÃÑÓáÊ:
>> > In netbeans 5.0, carriage return results e.g:
[quoted text clipped - 32 lines]
>
>????

   I suspect the issue is not with NetBeans, but rather with whatever
program (probably some sort of shell, like cmd or bash, or perhaps
NetBean's integrated console) is interpreting the data sent via standard
out.

   I'm surprised you know enough to know the "original" meaning of \r,
and yet never experienced the behaviour of treating \n and \r as both a
carriage return followed by a newline until now. Have you been
cryogenically frozen or something?

   - Oliver
Andreas Leitgeb - 13 Mar 2007 20:48 GMT
> System.out.print("Welcome \rjava");
> the output:
> javaome
> but in netbeans 5.0 the output is:
> Welcome
> java

The problem is not, what gets written out to System.out,
but rather how much effort netbeans does to emulate a
real terminal. Obviously this effort does not go far
enough to distinguish between \r and \n.

I just tried with netbeans 5.5: same result.
Then I run the same .jar file from a real
terminal, and I see the expected "javaome".

If you replace the \r with a few \b's, you'll see
that netbeans doesn't even handle backspaces as
such, but instead writes them as white rectangles.
Lara - 14 Mar 2007 18:19 GMT
I tried netbeans 3.5
the result : javaome
so , it's ok with netbeans 3.5

but netbeans 5.0 , \r dose not do its work...????!!!!!
Karl Uppiano - 15 Mar 2007 03:04 GMT
>> System.out.print("Welcome \rjava");
>> the output:
[quoted text clipped - 7 lines]
> real terminal. Obviously this effort does not go far
> enough to distinguish between \r and \n.

I'm guessing NetBeans simply uses one of the Swing text controls for its
console output, and it does not emulate a real console at all. I have
noticed that it handles Unicode better than a "real" console, too. I don't
think they really intended it to be a high-fidelity console.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.