Results 1 to 3 of 3
  1. #1
    javanewby is offline Member
    Join Date
    Sep 2010
    Posts
    1
    Rep Power
    0

    Default Positioning println codes to corners

    I'm new to java and i'm trying to allign my text to a specific corner

    My text shows:

    import acm.program.*;

    public class assgn1_1 extends ConsoleProgram {

    public void run() {
    println("Mac is the best");

    and when i compile it in cmd it show's up in the top left corner.
    How would i go about moving "Mac is the best" so that when i compile and run it, it's in the right corner?

    Thanks as i am completely new to JAVA

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Add some space to the front?

    Really, println is only a simple stream output. It, in itself, does not format anything. If you want a specially formatted output then you need to format it before giving it to println (although with printf you can do the formatting and printing at the same time, the principle is still the same).

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,812
    Rep Power
    25

    Default

    The way to position a String on the console is by printing spaces in front of it to move it to the right.

Similar Threads

  1. Println VS system.out.println
    By ccie007 in forum New To Java
    Replies: 2
    Last Post: 05-20-2010, 09:52 AM
  2. Positioning using setBounds
    By thayalan in forum AWT / Swing
    Replies: 4
    Last Post: 04-28-2009, 02:59 AM
  3. I obviously don't understand positioning panels
    By javatard in forum New To Java
    Replies: 2
    Last Post: 12-10-2008, 08:48 AM
  4. difference between system.out.println() & out.println()
    By wickedrahul9 in forum Advanced Java
    Replies: 5
    Last Post: 10-19-2008, 12:06 AM
  5. panel positioning
    By shwein in forum New To Java
    Replies: 4
    Last Post: 09-09-2008, 06:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •