Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to adjust the println?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ashan




PostPosted: Sat Feb 19, 2005 3:30 pm   Post subject: How to adjust the println?

Hi,

does anyone know how to give two coordinates for a "println" function and get an answer from it?

for eg -
code:

c.println ("Please enter your guess on one line (eg:-RGBY) - ");
                answer = c.readLine ();

I want the "Please enter...." line in the location (100,100) pixels. How can I move it with out typing 100 spaces?
I tried using drawString but didn't work for the user input (cursor kept blinking at the top even though the question was below!)

please help..
Thanks

Ashan
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Sat Feb 19, 2005 3:56 pm   Post subject: (No subject)

you can't.
ashan




PostPosted: Sat Feb 19, 2005 5:45 pm   Post subject: (No subject)

then wht do I do??
(I thought java was better than Turing, turing had a locate(x,y)..)

pls help...
wtd




PostPosted: Sat Feb 19, 2005 6:40 pm   Post subject: (No subject)

Your problem is that you're approaching the problem all wrong (unless the assignment requires it).

You're trying to simulate some kind of psuedo-GUI console-ish Frankensteinian thing.

If you're writing a console app, just have your prompt, then, either on the same line or on a new line, get input.

You're in a real programming language now. There are deeper issues to understand than how to make a prompt appear in the middle of the screen.
rizzix




PostPosted: Sat Feb 19, 2005 7:32 pm   Post subject: (No subject)

ashan wrote:
I thought java was better than Turing, turing had a locate(x,y)..


turing couldn't read/write to console/terminal

if u want turing-like functionality dont use the console.. use SWING.
Hikaru79




PostPosted: Sat Feb 19, 2005 8:17 pm   Post subject: (No subject)

ashan wrote:
then wht do I do??
(I thought java was better than Turing, turing had a locate(x,y)..)

pls help...


See, this is where people get confused. Because Turing's execution screen looks a lot like the execution screen of Holt's Ready to Program java editor, you think they're the same thing.

THEY ARE NOT

Turing's execution screen is an object that only exists within Turing and that the editor lets you put stuff on. JAVA'S execution screen is an actual CONSOLE. Think DOS, or bash. This has nothing to do with Java, it has to do with the fact that consoles themselves are not being to be used to make pretty ascii interfaces or whatever. If you want to be able to position text, use a Graphics object. it is NOT what System.out.println is meant for. System.out.println will print things to the console (if you were running your Java program outside of Holt's editor, it would send it to your MS_DOS window).

Java *is* better than Turing. Infinitely better. You're just not using the right tool for the right job Razz
wtd




PostPosted: Sat Feb 19, 2005 8:34 pm   Post subject: (No subject)

Hikaru79 wrote:
Java *is* better than Turing. Infinitely better.


Nawww. If it were infinitely better, then nothing could be better than Java. Smile
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: