The BlueJ Tutorial - seg.ece. Tutorial (Greek... · PDF file1 1 The BlueJ Tutorial...

Click here to load reader

  • date post

    01-Apr-2018
  • Category

    Documents

  • view

    213
  • download

    0

Embed Size (px)

Transcript of The BlueJ Tutorial - seg.ece. Tutorial (Greek... · PDF file1 1 The BlueJ Tutorial...

  • 1

    1

    The BlueJ Tutorial

    Version 1.2 for BlueJ version 1.1

    : Michael Klling School of Network Computing

    Monash University

    :

    &

    2001

  • 2

    2

    1 1.1 1.2

    2 2.1 2.2 2.3 BlueJ 2.4 SDK, JDK JRE 2.5

    3 BLUEJ

    3.1 BlueJ 3.2 BlueJ project

    4 T EDIT / COMPILE / EXECUTE 4.1 4.2 ( EXECUTION ) 4.3 (EDITING) 4.4 Compilation 4.5 COMPILER

    5 ...

    5.1 ( Inspection ) 5.2 ( Composition )

    6 PROJECT

    6.1 project 6.2 6.3 (Dependencies) 6.4

    7 (DEBUGGING)

    7.1 Breakpoint 7.2 7.3 (Inspecting) 7.4 Halt & Terminate

    8 9 APPLETS

    9.1 Applet 9.2 Applet 9.3 Applet (Testing)

    10

  • 3

    3

    10.1 project BlueJ BlueJ 10.2 project 10.3 main static 10.4

  • 4

    4

    1.

    1.1 BlueJ. BlueJ Java Java. BlueJ Monash . BlueJ : http//bluej.monash.edu 1.2 . . Java. Java . .

    2.

    2.1 BlueJ Java . .jar . . 2.2 JDK 1.2.2 . BlueJ JDK 1.3 . . JDK Sun http://java.sun.com/j2se/.

  • 5

    5

    2.3 BlueJ To BlueJ bluej-xxx.jar . xxx . bluej-111.jar 1.1.1 BlueJ. : http//bluej.monash.edu

    2.4 SDK, JDK JRE Java : SDK , JDK JRE . Java 2 SDK (Software Development Kit). O JDK (Java Development Kit) Sun . . Java 2 SDK v. 1.3 JDK 1.3 jdk1.3 . JRE (Java Runtime Environment) . JRE SDK, SDK. JRE BlueJ, SDK BlueJ . 2.5 A bluej-111.jar . jar , . DOS prompt . : /bin/java -jar bluej-111.jar ( path) JDK enter . BlueJ JDK BlueJ. : T path BlueJ (. "Program Files"). Install .

  • 6

    6

    site BlueJ ( FAQ ) .

    3. BLUEJ

    3.1 BlueJ BlueJ DOS script BlueJ. BlueJ . DOS/UNIX project $ bluej $ bluej examples/people : BlueJ DOS :

    DOS bluej =>=> BlueJ. 3.2 BlueJ project BlueJ projects Java . BlueJ project ( BlueJ project) BlueJ Project => Open project .

    4. T EDIT / COMPILE / EXECUTE project People BlueJ. project People examples BlueJ).

  • 7

    7

    1. , .

    1 : T BlueJ 4.1 BlueJ , , public . BlueJ . . . : static . static main, Java ,

  • 8

    8

    static main . . Java . Database, Person, Staff Student 2 . ( 2). new .

    2 : -

    Staff. Staff 2 , , . , . 3 .

  • 9

    9

    3:

    3 , by default staff_1 . , OK Staff . BlueJ ( ) 4 . .

    4 : Person ( Java ) . :

    .

  • 10

    10

    4.2 ( EXECUTION ) , public . ( 5). (Inspect and Remove) . . .

    5 :

    getRoom setRoom staff_1 . getRoom, ( 6). (unknown room) ( staff_1 ) .

    6 :

    . 5

  • 11

    11

    , Object(inherited from Object ) Person(inherited from Person ). Person ( getName ) . (unknown name) , ( Person ) . . getRoom getName , setRoom . ( 7) .

    7:

    interface ( ). . String. String o () 7. OK . getName. . : .

  • 12

    12

    4.3 (EDITING) . Edit Implementation ( ). (editor) . . Staff getRoom. room room G.4.24 G.4.24. : return room; return "room " + room; BlueJ Java compiler . : . 4.4 Compilation BlueJ . Staff . compilation . project people. project ( compiled ) . project BlueJ (uncompiled ), . . . (compile) ,

  • 13

    13

    . compile , , ( Class compiled No syntax errors ). compiler . project (. people ) compiler . (compiling) (editor) . ( editor compile ). editor . BlueJ compile ( Compile). , , compile , project ( recompilation compiled ). ( ) compile. compiler , editor , . 4.5 COMPILER compiler . (help). editor , Compile . . editor ( ? ) ( 8) .

  • 14

    14

    8: compiler help

    BlueJ . . BlueJ . : .

  • 15

    15

    5. ... , .

    5.1 ( Inspection ) K , ( ) Inspect ( 5) . (fields) . (. Staff ) . Inspect . (object fields) ( 9).

    9: (Inspection)

    ( ) . Inspection ( debugging tool ). Staff (fields) ( strings ). , . . project people2 , BlueJ .

  • 16

    16

    people2 10. project ( people ), Address . Person Address ( ) .

    10: project people2 (inspection) . Staff setAddress ( Person ) . , Staff Address . inspect Staff_1 . ( inspection ) 11 . , (private Address address) , , . inspect Inspect ( ). Address ( 12).

  • 17

    17

    11: Inspection

    12: Inspection public , Inspect , , Get . .

  • 18

    18

    . : .

    5.2 ( Composition ) . . Database ( (constructor) , o o , ). Database , ( person) ( Database ). Staff Student , , Database Staff Student. addPerson Database. Person ( Person abstract , , Staff Student Person , addPerson Staff Student Person ) . ( Staff Student ) addPerson , . . OK . ,