• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

JAVA HELP

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

POL-tec2002

Member
Joined
Jan 14, 2002
Location
CT usa and zakopane poland
Hello, im new to java and I have to do a project where I need to make windows pop up in a sequence. I have some questions.

1. How do I make new windows in java?

2. HOw do i sequence them.
 
As Captain Newbie pointed, the java tutorials are great.

Also stick with Swing over AWT for any windows/applets...atleast for now. Swing is newer and has more functions than AWT.
 
Shelnutt2 said:
As Captain Newbie pointed, the java tutorials are great.

Also stick with Swing over AWT for any windows/applets...atleast for now. Swing is newer and has more functions than AWT.
Something pops into the back of my mind about Swing also being guaranteed to be available in future Java frameworks...hmm. I don't remember.

Swing has dependencies on AWT for event handling, though...
 
AWT is also very machine (especially OS) dependant, while with swing you can be a bit more sure of what's going to come out. But not totally.
 
Im using JE creator. Also how can I make a program pause, and then resume reading the rest of the code when the user presses enter? Here is my code. I would like to make it pause, but the reader.pause doesnt work?


import TurtleGraphics.StandardPen; // necessary for Standard Pen class
import java.awt.*; // necessary for color changes


public class Illusion {

public static void main(String[] args) {


// Create application frame.
IllusionFrame frame = new IllusionFrame();

// Show frame
frame.setVisible(true);

//Create pen object
StandardPen pen= new StandardPen();

//Writes Muller-Lyer illusion
pen.up();
pen.move(5);
pen.setDirection(180); pen.move(50);
pen.down();
pen.drawString("Muller-Lyer illusion");
pen.up();

//Draws first half of arrow
pen.home();
pen.turn(180); pen.move(25);
pen.down();
pen.turn(90); pen.move(50);
pen.setDirection(135);pen.move(10);
pen.setDirection(315);pen.move(10);
pen.setDirection(225);pen.move(10);

//Draws second half of arrow
pen.setDirection(45);pen.move(10);
pen.setDirection(180);pen.move(100);
pen.setDirection(45);pen.move(10);
pen.setDirection(225);pen.move(10);
pen.setDirection(315);pen.move(10);


//Brings Pen Home and draws first part of second arrow.
pen.home();
pen.up();
pen.turn(180); pen.move(50);
pen.down();
pen.turn(90); pen.move(50);
pen.setDirection(45);pen.move(10);
pen.setDirection(225);pen.move(10);
pen.setDirection(315);pen.move(10);
pen.setDirection(135);pen.move(10);

//Draws Second part of second arrow.
pen.setDirection(180);pen.move(100);
pen.setDirection(135);pen.move(10);
pen.setDirection(315);pen.move(10);
pen.setDirection(225);pen.move(10);
pen.setDirection(45);pen.move(10);

reader.pause();

//Writes Muller-Lyer illusion
pen.up();
pen.move(5);
pen.setDirection(180); pen.move(50);
pen.down();
pen.drawString("Muller-Lyerss illusion");
pen.up();

}

}
 
Back