Results 1 to 8 of 8
- 06-12-2011, 06:13 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
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!
- 06-12-2011, 06:19 PM #2
what you hate of yourself
- Join Date
- Jun 2011
- Posts
- 16
- Rep Power
- 0
do you mean an undo command?
- 06-12-2011, 06:20 PM #3
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
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 topLast edited by terrytran; 06-12-2011 at 07:08 PM.
- 06-12-2011, 06:23 PM #4
what you hate of yourself
- Join Date
- Jun 2011
- Posts
- 16
- Rep Power
- 0
i would request for the sake of everyone to please use the code tags
- 06-12-2011, 06:27 PM #5
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
sorry i do not know what is a code tag im very new
- 06-12-2011, 06:32 PM #6
what you hate of yourself
- Join Date
- Jun 2011
- Posts
- 16
- Rep Power
- 0
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?
- 06-12-2011, 06:34 PM #7
Member
- Join Date
- Jun 2011
- Posts
- 5
- Rep Power
- 0
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!
- 06-12-2011, 06:38 PM #8
what you hate of yourself
- Join Date
- Jun 2011
- Posts
- 16
- Rep Power
- 0
Similar Threads
-
how to read this program??
By kongahh11 in forum New To JavaReplies: 8Last Post: 02-03-2011, 07:03 PM -
how to read excel file through java program
By madhuragowda in forum New To JavaReplies: 2Last Post: 04-16-2010, 08:53 AM -
java.io.IOException: Unable to read entire block; 493 bytes read before EOF; expected
By kushagra in forum New To JavaReplies: 5Last Post: 10-17-2008, 02:13 PM -
How to read a Web Page through java program
By Java Tip in forum java.netReplies: 0Last Post: 04-04-2008, 02:37 PM -
How to read a Web Page through java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:31 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks