Results 1 to 8 of 8
  1. #1
    terrytran is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default Hello, i am using Read to Program JAVA and i need some help!

    Hello, i am using Ready to Program with JAVA and i need some help!

    I was wondering if there was a command or statement that would switch back to a console.

    for example

    if i was at a menu, and chose an option, it then shows a bunch of effects and animations.
    At the end of the animations, i would liek to switch back to the console with the menu. how would i do this?

    thanks in advance!

  2. #2
    orangetj is offline what you hate of yourself
    Join Date
    Jun 2011
    Posts
    16
    Rep Power
    0

    Default

    do you mean an undo command?

  3. #3
    terrytran is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default

    Also, here is the section of my code that i would like for you guys to see


    Java Code:
    c = new Console ();
    
                //BACKGROUND
                c.setColor (Color.red);
                c.fillRect (0, 0, 640, 500);
    
                for (int count = 1 ; count <= 130 ; count++)  //startloop for flashing colors
                {
                    // RANDOM COLOR DECLARATION
                    re = (int) (Math.random () * 255 + 1);
                    gr = (int) (Math.random () * 255 + 1);
                    bl = (int) (Math.random () * 255 + 1);
                    r2 = (int) (Math.random () * 255 + 1);
                    g2 = (int) (Math.random () * 255 + 1);
                    b2 = (int) (Math.random () * 255 + 1);
                    Color randomcol = new Color (re, gr, bl);
                    Color randomcol2 = new Color (r2, g2, b2);
    
                    //MENU DISPLAY
                    c.setFont (f2);
                    c.setColor (randomcol);
                    c.drawString ("MENU", 170, 100);
                    Thread.sleep (5);
                    c.drawString ("MENU", 170, 100);
                    Thread.sleep (5);
    
    
    
    
                }
                c.setColor (Color.yellow);
    
                c.drawString ("___________", 0, 120);
                c.setFont (f3);
                c.drawString ("Type the number of your choice and press [ENTER].", 20, 170);
                Thread.sleep (100);
                c.drawString ("1 - Animation.", 20, 230);
                Thread.sleep (100);
                c.drawString ("2 - Games/User controllec.", 20, 250);
                Thread.sleep (100);
                c.drawString ("3 - Special Effects.", 20, 270);
                c.setCursor (15, 1);
                choice = c.readInt ();
    
                if (choice == 1)
                {
    
    
                    c.setColor (Color.black);
                    c.fillRect (0, 0, 640, 500);
                    c.setColor (Color.yellow);
                    c.setFont (f3);
                    c.drawString ("Please enter your Username and Password.", 15, 210);
                    c.drawString ("Username:", 15, 255);
                    c.setCursor (14, 2);
                    setusername = c.readString ();
                    c.drawString ("Password:", 15, 310);
                    c.setCursor (17, 2);
                    setpassword = c.readString ();
    
                    if (!setusername.equals (username) || !setpassword.equals (password))
    
                        {
                            int count = 1;
                            do
                            {
                                //-----------------------------WRONG USERNAME OR PASSWORD PAGE ----------------------------------
    
                                //BACKGROUND
                                c.setColor (Color.black);
    
                                c.fillRect (0, 0, 640, 500);
                                c.setFont (f1);
                                c.setColor (Color.red);
                                c.drawString ("Welcome to Terry's Page!", 55, 100);
                                c.setFont (f3);
    
                                c.setColor (Color.red);
                                c.fillOval (282, 130, 50, 50);
    
                                c.drawString ("Oops! There seems to be an error in the username ", 18, 210);
                                c.drawString (" or password that you've entered in! Retry? [y][n]", 18, 240);
                                c.setCursor (14, 1);
                                retry = c.readString ();
    
                                if (retry.equals ("y"))
                                {
                                    c.clear ();
                                    c.setColor (Color.black);
    
                                    c.fillRect (0, 0, 640, 500);
                                    c.setFont (f3);
    
                                    c.setColor (Color.red);
                                    c.drawString ("Please enter your Username and Password.", 15, 210);
                                    c.drawString ("Username:", 15, 255);
                                    c.setCursor (14, 2);
                                    setusername = c.readString ();
                                    c.drawString ("Password:", 15, 310);
                                    c.setCursor (17, 2);
                                    setpassword = c.readString ();
    
    
                                }
                                else if (!retry.equals ("y"))
                                {
                                    while (!setusername.equals (username) || !setpassword.equals (password))
                                        ;
                                }
    
    
    
    
                            }
                            while (!setusername.equals (username) || !setpassword.equals (password));
    
                        }
    
                    if (setusername.equals (username) && setpassword.equals (password))
                    {
                        g = new Console ();
                        g.setColor (Color.red);
                        g.fillRect (0, 0, 640, 500);
                        for (int count1 = 1 ; count1 <= 640 ; count1 = count1 + 30) //startloop for flashing colors
                        {
                            re = (int) (Math.random () * 255 + 1);
                            gr = (int) (Math.random () * 255 + 1);
                            bl = (int) (Math.random () * 255 + 1);
                            r2 = (int) (Math.random () * 255 + 1);
                            g2 = (int) (Math.random () * 255 + 1);
                            b2 = (int) (Math.random () * 255 + 1);
                            Color randomcol = new Color (re, gr, bl);
                            // LOADING SCREEN
                            g.setFont (f1);
                            g.setColor (randomcol);
                            g.drawString ("NOW LOADING", 115, 250);
                            Thread.sleep (200);
                            g.setColor (Color.blue);
                            g.fillRect (count1, 260, 30, 30);
                            Thread.sleep (1);
                            g.setColor (Color.yellow);
                            g.fillRect (count1, 260, 30, 30);
    
    
                        }
                        g.clear ();
                    }
    
    
    
    
                    for (int count1 = 1 ; count1 <= 640 ; count1 = count1 + 30) //startloop for flashing colors
                    {
                        re = (int) (Math.random () * 255 + 1);
                        gr = (int) (Math.random () * 255 + 1);
                        bl = (int) (Math.random () * 255 + 1);
                        r2 = (int) (Math.random () * 255 + 1);
                        g2 = (int) (Math.random () * 255 + 1);
                        b2 = (int) (Math.random () * 255 + 1);
                        Color randomcol = new Color (re, gr, bl);
                        // LOADING SCREEN
                        g.setFont (f1);
                        g.setColor (randomcol);
                        for (int count2 = 1 ; count2 <= 640 ; count2 = count2 + 30)
                        {
                            g.drawString ("GO!", 250, 300);
                            Thread.sleep (5);
    
                        }
    
                    }
                    g.clear ();
    
                    for (int count1 = 0 ; count1 <= 470 ; count1 = count1 + 100) //startloop
                    {
    
    
                        g.setFont (f1);
                        g.setColor (Color.red);
                        for (int count2 = 0 ; count2 <= 610 ; count2 = count2 + 30)
                        {
                            g.fillOval (count2, count1, 30, 30);
                            Thread.sleep (30);
    
                        }
                        g.setColor (Color.black);
                        for (int count2 = 30 ; count2 <= 610 ; count2 = count2 + 30)
                        {
                            g.fillOval (count2, count1, 30, 30);
                            Thread.sleep (30);
    
                        }
    
    
    
                    }
    
    
                    for (int count1 = 0 ; count1 <= 470 ; count1 = count1 + 100) //startloop
                    {
    
                        g.setFont (f1);
                        g.setColor (Color.red);
                        for (int count2 = 0 ; count2 <= 610 ; count2 = count2 + 30)
                        {
                            g.fillOval (count2, count1 + 30, 30, 30);
                            Thread.sleep (30);
    
                        }
                        g.setColor (Color.black);
                        for (int count2 = 30 ; count2 <= 610 ; count2 = count2 + 30)
                        {
                            g.fillOval (count2, count1 + 30, 30, 30);
                            Thread.sleep (30);
    
                        }
    
    
    
                    }
    
    
                    for (int count1 = 0 ; count1 <= 470 ; count1 = count1 + 100) //startloop
                    {
    
                        g.setFont (f1);
                        g.setColor (Color.red);
                        for (int count2 = 0 ; count2 <= 610 ; count2 = count2 + 30)
                        {
                            g.fillMapleLeaf (count2, count1 + 60, 30, 30);
                            Thread.sleep (30);
    
                        }
                        g.setColor (Color.black);
                        for (int count2 = 30 ; count2 <= 610 ; count2 = count2 + 30)
                        {
                            g.fillMapleLeaf (count2, count1 + 60, 30, 30);
                            Thread.sleep (30);
    
                        }
    
    
    
                    }
    
    
                    xval = 0;
                    yval = 0;
                    xval1 = 0;
                    yval1 = 0;
                    xval2 = 0;
                    yval2 = 0;
                    xval3 = 0;
                    yval3 = 0;
                    halfvalx = 320;
                    halfvaly = 250;
    
    
    
    
                    for (int count = 1 ; count <= 65 ; count++)
                    {
    
                        g.setColor (Color.red);
                        g.fillRect (0, 0, xval1, 500);
                        xval1 = xval1 + 10;
    
                        Thread.sleep (10);
    
                    }
    
                    for (int count = 1 ; count <= 53 ; count++)
                    {
    
                        g.setColor (Color.blue);
                        g.fillRect (0, 0, 640, yval1);
    
                        yval1 = yval1 + 10;
                        Thread.sleep (10);
    
                    }
    
    
                    for (int count = 65 ; count >= 1 ; count--)
                    {
    
                        g.setColor (Color.green);
                        g.fillRect (0, 0, xval2, 500);
                        xval2 = xval2 + 10;
    
                        Thread.sleep (10);
    
                    }
    
                    for (int count = 53 ; count >= 1 ; count--)
                    {
    
                        g.setColor (Color.yellow);
                        g.fillRect (0, 0, 640, yval2);
    
                        yval2 = yval2 + 10;
                        Thread.sleep (10);
    
                    }
    
    
    
                    for (int count = 53 ; count >= 1 ; count--)
                    {
    
                        g.setColor (Color.white);
                        g.fillRect (0, 0, 640, yval2);
    
                        yval2 = yval2 + 10;
                        Thread.sleep (10);
    
                    }
    
    
                    for (int count = 1 ; count <= 60 ; count++)
                    {
                        g.setColor (Color.red);
                        g.fillMapleLeaf (halfvalx, halfvaly, xval3, yval3);
                        halfvalx = halfvalx - 3;
                        halfvaly = halfvaly - 3;
                        xval3 = xval3 + 5;
                        yval3 = xval3 + 5;
                        Thread.sleep (50);
                    }
    
    
                    for (int count2 = 0 ; count2 <= 610 ; count2 = count2 + 30)
                    {
                        g.fillRect (0, yval, 140, 30);
                        g.fillRect (500, yval, 140, 30);
                        yval = yval + 30;
    
    
                        Thread.sleep (30);
    
                    }
    
    
                    g.setFont (f1);
                    g.setColor (Color.black);
    
                    g.drawString ("O", 100, 400);
                    Thread.sleep (40);
    
    
                    g.drawString ("H", 150, 400);
                    Thread.sleep (40);
    
    
                    g.drawString ("C", 250, 400);
                    Thread.sleep (40);
    
    
                    g.drawString ("A", 300, 400);
                    Thread.sleep (40);
    
    
                    g.drawString ("N", 350, 400);
                    Thread.sleep (40);
    
    
                    g.drawString ("A", 400, 400);
                    Thread.sleep (40);
    
                    g.drawString ("D", 450, 400);
                    Thread.sleep (40);
    
    
                    g.drawString ("A", 500, 400);
                    Thread.sleep (40);
    
    
                    g.drawString ("!", 550, 400);
                    Thread.sleep (40);
    
    
    
    
    
                } //this is where i'd like for it to go back to the menu up at top
    Last edited by terrytran; 06-12-2011 at 07:08 PM.

  4. #4
    orangetj is offline what you hate of yourself
    Join Date
    Jun 2011
    Posts
    16
    Rep Power
    0

    Default

    i would request for the sake of everyone to please use the code tags

  5. #5
    terrytran is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default

    sorry i do not know what is a code tag im very new

  6. #6
    orangetj is offline what you hate of yourself
    Join Date
    Jun 2011
    Posts
    16
    Rep Power
    0

    Default

    its the icon that looks like # incase you want to know. im not upset it just makes it harder to read the code. also is that the whole class minus the line declaring the class and type or only a small part of it?

  7. #7
    terrytran is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default

    it is only a small part of it, if it'd help i'll put up the whole code. It is also worth noting that all the declared variables are not in this because its in the full thing!

  8. #8
    orangetj is offline what you hate of yourself
    Join Date
    Jun 2011
    Posts
    16
    Rep Power
    0

    Default

    can you pm me the whole code and what its supposed to d and il try to help

Similar Threads

  1. how to read this program??
    By kongahh11 in forum New To Java
    Replies: 8
    Last Post: 02-03-2011, 07:03 PM
  2. how to read excel file through java program
    By madhuragowda in forum New To Java
    Replies: 2
    Last Post: 04-16-2010, 08:53 AM
  3. Replies: 5
    Last Post: 10-17-2008, 02:13 PM
  4. How to read a Web Page through java program
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-04-2008, 02:37 PM
  5. How to read a Web Page through java program
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:31 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
  •