Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: I need more if-statement help

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need more if-statement help

    I have this code right now. What I'm trying to do is slowly make the circle bigger until it fully covers the background. What I have so far:


    import hsa.Console;
    import java.awt.*;
    public class GamingProject
    {
    static Console c;
    public static void main (String[] args)
    {
    c = new Console ();

    //Beginning words to set background
    Font newFont = new Font("Times New Roman",1,20);
    c.setFont(newFont);

    c.drawString ("Before the quiz begin, we would just like to ask which one",0,15);
    c.drawString ("of these colors is your favorite color?",0,30);

    c.setColor (Color.blue);
    c.fillOval (50,50,50,50);

    c.setColor (Color.red);
    c.fillOval (125,50,50,50);

    c.setColor (Color.green);
    c.fillOval (200,50,50,50);

    c.setColor (Color.orange);
    c.fillOval (275,50,50,50);

    c.setColor (Color.black);
    c.fillOval (350,50,50,50);

    c.setColor (Color.magenta);
    c.fillOval (425,50,50,50);

    c.setColor (Color.black);
    c.drawString ("My favorite colour is: ",0,155);
    c.setCursor (8,24);
    String backgroundColor;
    backgroundColor = c.readLine();

    c.clear();

    int y = 150;
    int x = 215;

    if (backgroundColor.equalsIgnoreCase ("blue"))
    {
    c.setColor (Color.blue);
    c.fillOval (215,150,200,200);

    for (y = 150; y <=300; y++)
    {
    c.setColor (Color.blue);
    c.fillOval (215, y,20,20);
    for (int counter = 0; counter <2147000000; counter++)
    {}

    }

    (I have more code here but it's unnecessary)

    The problem is highlighted in red. It says " "}" is inserted to complete Statement No Short If"

    What does that mean?

    Are there other ways to make my circle grow bigger?


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: I need more if-statement help

    For future reference, please use the code tags (see my signature)

    Its best to have full disclosure, and not leave those trying to help with more questions than you have. For instance, what says the following?
    The problem is highlighted in red. It says " "}" is inserted to complete Statement No Short If"
    The compiler? The JRE? Is this something you post into a website to check correctness? What is hsa.Console? It is not part of J2SE.

Similar Threads

  1. [SOLVED] If statement help
    By DarkPrince in forum Loops & Control Statements
    Replies: 1
    Last Post: November 7th, 2012, 04:15 PM
  2. if....else statement
    By Appu14 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: September 2nd, 2012, 06:35 AM
  3. Need help with if statement.
    By dreamer in forum Loops & Control Statements
    Replies: 2
    Last Post: May 30th, 2012, 02:27 PM
  4. not a statement?
    By frozen java in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 23rd, 2011, 08:57 PM
  5. If statement help
    By Legion of Daughters in forum Loops & Control Statements
    Replies: 12
    Last Post: September 6th, 2011, 08:25 AM