Editing Java programs with the BlueJ IDE. Working environments to develop (= write) programs There are 2 ways to develop (write) computer programs: 1.Using.

Slides:



Advertisements
Similar presentations
Lesson 12 Getting Started with Excel Essentials
Advertisements

 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
Introduction to the gedit editor. gedit: the Gnome editor Gnome: Gnome is a freely available (i.e., no cost) desktop environment for the UNIX system The.
1 eclipse Tips. 2 What is eclipse? Eclipse is a popular IDE (Integrated Development Environment) that we will use to create, compile, execute, and test.
Chapter 2 Creating a Research Paper with Citations and References
Lesson One: The Beginning Chapter 2: Processing Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from built-in help reference.
BlueJ: a very quick introduction. BlueJ BlueJ is an IDE (Interactive Development Environment). It includes –an editor, which you use to write your programs.
VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
The Internet. Telnet Telnet means using your computer as a terminal. All commands you type are sent to the host computer you are connected to and executed.
XP New Perspectives on Microsoft Office Word 2003 Tutorial 1 1 Microsoft Office Word 2003 Tutorial 1 – Creating a Document.
13-Jul-15 BlueJ: A Very Quick Introduction. BlueJ BlueJ is an IDE (Integrated Development Environment). It includes an editor, which you use to write.
Word Processing Microsoft Office: Exploring Word 2011 for MAC.
Command Console Tutorial BCIS 3680 Enterprise Programming.
CS0007: Introduction to Computer Programming Setting Up Java.
Marlene Galea.  The JDK (Java Development Kit)  An IDE (Integrated Development Environment) ◦ Different IDEs include:  JCreator  NetBeans  BlueJ.
File Management and Organisation © Copyright William Rowan 2007.
One to One instructions Installing and configuring samba on Ubuntu Linux to enable Linux to share files and documents with Windows XP.
From BlueJ to NetBeans SWC 2.semester.
Microsoft Office Word 2003 Tutorial 1 Creating a Document.
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
PowerPoint. Basic Vocabulary Slide - Presentation - Slide layout – ► ► ► ► a single page in PowerPoint all the slides for a speech all the slides for.
MICROSOFT WORD GETTING STARTED WITH WORD. CONTENTS 1.STARTING THE PROGRAMSTARTING THE PROGRAM 2.BASIC TEXT EDITINGBASIC TEXT EDITING 3.SAVING A DOCUMENTSAVING.
Mail merge I: Use mail merge for mass mailings Perform a complete mail merge Now you’ll walk through the process of performing a mail merge by using the.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Microsoft Word 2000 Presentation 2 Microsoft Word Topics  Tools –Spelling/Grammar Check –Thesaurus –AutoCorrect –Word Count –Change Case –Background.
1 Word 2010 Intro to Word – Part 2. 2 Steps for Creating a Document  Step 1: Open a Blank Document (New, or Open)  Step 2: Name the Document (Save As.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
© 2010 South-Western / Cengage Learning Century 21 Keyboarding  Cycle 1  Office Features 1.
Unit 1: Java and Eclipse The Eclipse Development Environment.
Output in Java Hello World!. Structure of a Java Program  All Java files in ICS3U1 have the following structure: class HelloWorld { }  Notice the open.
Introduction to programming in the Java programming language.
Edmo.do/j/q4b8fs xnt8zb SAVE DOCUMENTS TO EDMODO WEBSITE.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
CMPF124: Basics Skills for Knowledge Workers Manipulating Windows GUI.
MS-WORD MS-Word is a word processing software. it helps you to create letters, memo, reports etc. HOW TO OPEN WORD click start menu button write Ms-word.
Moving and Copying Text Instructor: Glenda H. Easter ITSW 1401, Intro to Word Processing.
1 Lesson 12 Getting Started with Excel Essentials Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Chapter Three The UNIX Editors.
CS7 Recitation Cem Akkaya. Outline  Homework-0 in detail  Useful links and tools  Setting up your java environment.
Microsoft Word Level 1 Michael Carco. Word Level 1 Agenda  Word Basics  Navigating in a Document  Inserting and Modifying Text  Creating and Modifying.
Compiling and running Java programs with BlueJ. Successfully compiled files program files in BlueJ You can tell from the shade of a program icon in BlueJ.
Microsoft Word 2010 Chapter 2 Creating a Research Paper with Citations and References.
Reading input from the console input. Java's console input The console is the terminal window that is running the Java program I.e., that's the terminal.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
®® Microsoft Windows 7 Windows Tutorial 2 Organizing Your Files.
XP New Perspectives on Microsoft Windows XP Tutorial 2 1 Microsoft Windows XP Working with Files Tutorial 2.
Open Office Writer Introduction AOSS _ Course material AOSS Master training workshop Singapore 2007.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Text Basics It's important to know how to perform basic tasks with text when working in a word processing application. In this lesson, you'll learn the.
1. Using word you can create the document and edit them later, as and when required,by adding more text, modifying the existing text, deleting/moving.
CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
Microsoft Word 2000 Presentation 3 Microsoft Word Topics Wizards –Letters –Envelopes and Labels Quick Navigation of Documents –Keyboard short-cuts Editing.
Fundamentals of Windows Mouse n 4 Basic Operations: –Pointing –Clicking –Double Clicking –Dragging.
Microsoft Word 125 S. Clark St., 4th floor, Chicago, Illinois  Telephone  Fax
Guide To UNIX Using Linux Third Edition
Microsoft Word - Formatting Pages
Lesson 17 Getting Started with Excel Essentials
Lesson 18 Getting Started with Excel Essentials
How to Run a Java Program
Microsoft Word Text Basics.
How to Run a Java Program
New Perspectives on Windows XP
BlueJ: a very quick introduction
Linux Operations and Administration
BlueJ: a very quick introduction
Review of Previous Lesson
Presentation transcript:

Editing Java programs with the BlueJ IDE

Working environments to develop (= write) programs There are 2 ways to develop (write) computer programs: 1.Using an editor (e.g. gedit) and a compiler (such as javac) separately. You have seen this method in the last webnote abus/02/BlueJ/java.html abus/02/BlueJ/java.html 2. Using an editor and a compiler in an integrated manner

Working environments to develop (= write) programs (cont.) In the second way, you will need to install a special application called an Integrated Development Environment (IDE)

Java IDEs There are a number of Integrated Development Environment IDE) available for Java Java IDEs: Eclipse -- Eclipse is highly extensible and customizable, but hard to learn (freely available) NetBeans -- created by Sun MircoSystem (original designer of the Java programming language) (freely available) JBuilder -- top commercial Java IDE; very costly... BlueJ -- easy to learn (freely available)

Java IDEs (cont.) In this webnote, you will learn to edit Java programs with BlueJ In the next webnote, you will learn how to: You will learn how to program in the Java programming language later in this course compile the Java program with BlueJ run the (compiled) Java program with BlueJ

Java IDEs (cont.) BlueJ is freely available and it can be obtained from this website:

Preparation Before you can use BlueJ, you must: Login to a computer in the MathCS lab Open a terminal window Change the current (working) directory to your cs170 directory This directory is used to store CS 170 labs and homework.

Information about this BlueJ tutorial The tutorial is described from the perspective of the user cheung (Because it was developed by Professor Cheung) The directory used to hold the project is /home/cheung/cs170 For clarity, I have delete all files and folders from my cs170 directory.

Information about this BlueJ tutorial (cont.) We will write a simple Java program and store the program in a project directory called "TestProj". The "TestProj" will be contained inside the /home/cheung/cs170 directory. In other words, the absolute path of the project directory is: /home/cheung/cs170/TestProj

Information about this BlueJ tutorial (cont.) Here is the Simple Java program that you will enter into BlueJ: You don't need to understand this program right now; it will be explained later in the course. public class Hello { public static void main(String[] args) { System.out.println("Hello Class"); System.out.println("How is everyone doing so far ?"); }

Topics covered in this (short) tutorial Things you need to learn to get started with BlueJ Run the BlueJ application Create a new project in BlueJ Create a new program file Insert text into the file Delete text from the file Goto a certain line in the file Search for a pattern in the file Search and replace for a pattern with another pattern in the file Undo a change Save your work Quit without saving (because you made a mess)...

Starting the BlueJ IDE application Enter the following command in a terminal window: This will run BlueJ as a detached process UNIX prompt>> bluej &

Starting the BlueJ IDE application (cont.) You will first see an announcement window:

Starting the BlueJ IDE application (cont.) When it's ready, you will see the main window:

Create a new project BlueJ requires that each project be stored in a different directory When you create a new project, BlueJ will also create a new directory for you.

Create a new project (cont.) How to create a new project: Left click on the Project tab Then left click on the New Project tab:

Create a new project (cont.) A new window will pop up:

Create a new project (cont.) Enter the name of the new project directory (/home/cheung/cs170/TestProj) and click on the Create button:

Create a new project (cont.) When BlueJ has successful created an new project, it will show the following window:

Create a new program file Suppose we want to create a file that contains the following Java program (given above): public class Hello { public static void main(String[] args) { System.out.println("Hello Class"); System.out.println("How is everyone doing so far ?"); }

Create a new program file (cont.) Notice that the program is called class Hello This will be important in the creation procedure.

Create a new program file (cont.) How to create a Java program file: Left click on the New Class button:

Create a new program file (cont.) A new window will pop up:

Create a new program file (cont.) Type in the name of the "class" (which is Hello) and click OK: A new window will pop up:

Create a new program file (cont.) Final result: You can see the new file Hello in the TestProj area.

Create a new program file (cont.) To see that BlueJ has created a file, we list the content of the TestProj directory from a terminal window: The icon named Hello in BlueJ represents the program file Hello.java inside the TestProj directory.

Open a program file for editing If you want to edit a program file, do the following: Right click on the file icon Then left click on the Open Editor button:

Open a program file for editing If you want to edit a program file, do the following: A new window will pop up:

Open a program file for editing The new window contains the content of the file Hello.java (To verify, use "cat Hello.java" in a terminal window) BlueJ has already inserted a few things in the file Hello.java to help you start writing a Java program

Deleting text from a file How to delete text from a file: Highlight the text in BlueJ that you want to delete:

Deleting text from a file (cont.) Press the backspace key You can also press the delete key or control-X Result:

Inserting text into a file Use the scroll bar on the right to find the location in the file where you want to insert text. Left click at the insert location Then type in the new text. Example:

Insert text by copy and paste You can insert text from another window into the document in BlueJ by using the copy and paste facility: 1.Highlight any text in a window (e.g., from a webpage) The highlighted text is automatically copied in UNIX 2.(On a Windows-based PC, you need to type control-C to copy) 3.Now click in the BlueJ window at the position where you want to insert the highlighted text 4.Type control-V (for paste)

Replacing some text How to replace text: Delete the text Insert new text

Undo a change When you make a edit mistake, you can undo the last change with the undo-command: control-Z

Undo a change (cont.) Undo earlier changes: You can undo earlier changes by pressing control-Z multiple time The maximum number of changes can be undo is 25

Undo an undo Suppose you have undone a change that was in fact correct You can undo an undo operation using: control-Y (this is called a Redo operation)

Goto a certain line in the file A feature that is very useful when you write computer programs is: That is because compilers (an application that translates a program written in a high level language into machine code) always report an error along with the location (as a line number) in the file. Goto a certain line in a file

Goto a certain line in the file (cont.) How to go to line number n in a file: 1.Left click on the Tools tab 2.Then left click on the Go to Line tab

Goto a certain line in the file (cont.) Example: After this, a window will pop up and you can enter the desired line number

Goto a certain line in the file (cont.) Keyboard shortcut: The keyboard shortcut for the Go to Line function is control-L

Search for a text pattern Finding the next occurrence of a pattern in a file: 1.Left click on the Find tab The lower portion of the BlueJ window will change to the Find menu Example:

Search for a text pattern (cont.) Enter the search text pattern and click Next: The text highlighted in yellow is the next matching pattern All other matching patterned are highlighted in blue

Search for a text pattern (cont.) Left click on the Next button to find the subsequent matching pattern Search forward: Left click on the Prev button to search forward

Search and Replace Finding the next occurrence of a text pattern in a file and replace it with some other pattern: Left click on the Replace tab The lower portion of the BlueJ window will change to the Replace menu

Search and Replace (cont.) Example:

Search and Replace (cont.) 2. Enter the replacement pattern in the Replace field:

Search and Replace (cont.) 3.Click on the Once button to replace the current occurrence (in yellow):

Search and Replace (cont.) You can replace the next occurrence by clicking on Once another time. Click on All to replace every occurrence

Search and Replace (cont.) Hint: If you do not want to replace the current occurrence and want to continue the Search and Replace operation, then do the following: 1.Click on the text immediately after the current occurrence 2.Click Next (to find the next occurrence) 3.Continue with replace if desire

Search and Replace (cont.) Example:

Search and Replace (cont.) Click on the text immediately after the current occurrence

Search and Replace (cont.) Click Next Continue with the Replace operation if so desired.

Saving the changes Auto saving: You do not need to save your work. When you quit (close) the BlueJ window, it saves your works automatically

Saving the changes (cont.) Save your work explicitly: You can choose to save your work explicit by clicking of Class and then Save:

Quit without saving your work... You do not have this option in BlueJ

Exit BlueJ Before you exit BlueJ, I would recommend that you save all your changes explicitly You have learned saving your work above !!!

Exit BlueJ (cont.) Exiting BlueJ: To exit BlueJ, click Project in the BlueJ's main window and select Quit: