Results 1 to 2 of 2
  1. #1
    beccalynn417 is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Question Need help with displaying println for Methods

    I'm doing a stub'd version of the Towers of Hanoi - quite new to this and my professor did not pick a good book to teach with so the assignments got a bit mixed up. I've got methods in place for every circle I need and then I've called each of the methods. I've labeled them by peg, green circle, yellow circle and blue circle.

    I've set their coordinates to be 100 px apart on the window. There is a peg, and all three disks for each set of coordinates so that they would be overlapping. There is no graphical circles, just a system.out.println("..."); that is supposed to display where each of the pegs and circles are supposed to be located. It's all technically valid, but nothing is appearing on my window. Here's part of what I've got:

    class Circle {
    int centerX, centerY, radius;
    Color fill;


    public Circle() {
    centerX = 0;
    centerY = 0;
    radius = 0;
    fill = null;
    }
    public int X(){return centerX;}
    public int Y(){return centerY;}
    public int Radius(){return radius;}
    public Color Fill(){return fill;}

    void pegCircle50(){
    System.out.println("Drawing circle at: (" +
    centerX + ", " + centerY + ") with radius: " +
    radius + " and color: " + fill);
    }
    }
    Circle pegCircle50(int centerX, int centerY, int radius, Color fill) {
    centerX = 50;
    centerY = 50;
    radius = 10;
    fill = Color.getHSBColor(20, 240, 60);


    return pegCircle50(centerX, centerY, radius, fill);

    }

  2. #2
    beccalynn417 is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default modified, but still not working

    I added: int centerX, int centerY, int radius, Color fill into the code that is supposed to print the method with the specific parameters:

    void pegCircle50(int centerX, int centerY, int radius, Color fill){
    System.out.println("Drawing circle at: (" +
    centerX + ", " + centerY + ") with radius: " +
    radius + " and color: " + fill);
    }

    still not working tho... I'll keep plugging away as this was due yesterday :confused:

Similar Threads

  1. Replies: 8
    Last Post: 04-17-2012, 12:00 AM
  2. Displaying println output on GUI
    By SCCY in forum AWT / Swing
    Replies: 1
    Last Post: 08-09-2010, 02:34 PM
  3. Println VS system.out.println
    By ccie007 in forum New To Java
    Replies: 2
    Last Post: 05-20-2010, 09:52 AM
  4. Need help with println
    By jhetfield18 in forum New To Java
    Replies: 8
    Last Post: 09-18-2009, 09:26 AM
  5. difference between system.out.println() & out.println()
    By wickedrahul9 in forum Advanced Java
    Replies: 5
    Last Post: 10-19-2008, 12:06 AM

Posting Permissions

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