walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/virtual/introtoprogramming/howto/... · web viewthe...

14
How to get Game.zip into Eclipse To install Java, follow these instructions: http://walshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/HowToIn stallJava/HowToInstallJava.html Download and install eclipse: https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020- 12/R/eclipse-inst-jre-win64.exe Launch eclipse When asked to select a workspace, use the default. Begin photo Screenshot of the “Eclipse IDE Launcher.” In the Workspace textbox, the words “C:\Users\Edward\eclipse-workspace” appears. A red arrow points to the “Launch” button. End photo

Upload: others

Post on 09-May-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

How to get Game.zip into Eclipse

To install Java, follow these instructions: http://walshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/HowToInstallJava/HowToInstallJava.html

Download and install eclipse: https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020-12/R/eclipse-inst-jre-win64.exe

Launch eclipse

When asked to select a workspace, use the default.

Begin photoScreenshot of the “Eclipse IDE Launcher.” In the Workspace textbox, the words “C:\Users\Edward\eclipse-workspace” appears. A red arrow points to the “Launch” button.End photo

Page 2: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

Close the splash screen

Begin photoScreenshot of “Welcome to the Eclipse IDE for Java Developers” tabbed pane. A red arrow points to the X in the tab that will close this pane.End photo

Page 3: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

Create a new Java project

Begin photoScreenshot of Eclipse. The top of the window contains a menu bar. The “file” menu is selected. The menu item “New” is selected. The sub menu-item “Java Project” is selected.End photo

Page 4: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

For the project name, type the word “game” in lower case.Click Finish.

Begin photoScreenshot of Eclipse’s “New Java Project” dialog box. The “Project Name” textbox contains the word “game.” A red arrow points to the Finish button.End photo

Page 5: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

Do NOT create a module.

Begin photoScreenshot of Eclipse’s “New module-info.java. A red arrow points to the “Don’t Create” button.End photo

Download Game.zip http://walshe.faculty.mjc.edu/Virtual/IntroToProgramming/Game.zip

Go to your Downloads folder and unzip Game.zip.

Page 6: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

Open the Game folder.Open the Game folder.Drag and Drop these files into Eclipse

Begin photoScreenshot of Window 10 desktop. The folder “This PC > Downloads > Game > Game” is opened. The folder contains the files banana.gif, banana.png, bananas.gif, bananas.png, cat.gif, cat.png, and Game.java. Eclipse is opened. The Eclipse “Package Explorer” is opened. The “Package Explorer” contains the project named game. The user is drag all the files into the game project.End photo

Page 7: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

We want to copy the files.Click the OK button.

Begin photoScreenshot of Eclipse’s “File Operation” dialog box. The “Copy files” checkbox is checked. A red arrow points to the OK button.End photo

CONTINUED ON NEXT PAGE

Page 8: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

In Eclipse, move Game.java into the src folder.

Begin photoA screenshot of “eclipse-workspace – Eclipse IDE.” The “Package Explorer” is opened. The “Package Explorer” contains a folder named game. The folder contains: a folder named scr, bananga.gif, banana.png, bananas.gif, bananas.png, cat.gif, cat.png, and Game.java. The user is suppose to drag the file Game.java into the src folder.End photo

CONTINUED ON NEXT PAGE

Page 9: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

Click the arrow that is for the src folder.Click the arrow that is for the (default package).Double click Game.java to pop it into the editor.

Begin photoScreenshot of “eclipse-workspace – Eclipse IDE.” The “Package Explorer” is opened. One of the items in the “Package Explorer” is a folder named src. A red arrow points to src’s expand tree icon. The src folder contains the item “default package.” A are arrow points to the default package’s expand tree icon. The default package contains the file Game.java.End photo

In the editor, find these 3 lines of code: public void paintFrame(Graphics g) {

/* Type your code here */ }

Change it to look like this: public void paintFrame(Graphics g) {

/* Type your code here */ g.setFont(new Font("Dialog",Font.BOLD, 36)); g.drawString("Hello World",100,100); }

Page 10: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

Save your editing changes:

Begin photoScreenshot of “eclipse-workspace – Eclipse IDE.” The top of the window contains a menu bar and an icon bar. A red arrow points to the save icon (the icon looks like a floppy disk).End photo

Page 11: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

At the top of the window is a menu.click: run -> Debug _

Begin photoScreenshot of “eclipse-workspace – Eclipse IDE.” The top of the window contains a menu bar. The menu Run is selected. The menu item “Debug” is selected.End photo

CONTINUED ON NEXT PAGE

Page 12: walshe.faculty.mjc.eduwalshe.faculty.mjc.edu/Virtual/IntroToProgramming/HowTo/... · Web viewThe “Project Name” textbox contains the word “game.” A red arrow points to the

If there are no error nor problems, then you will see this:

Begin photoA screenshot of a window. The window contains the words “Hello World.”End photo