1 / 9

Organising Code: Packages & Archives

29. Organising Code: Packages & Archives. Previously. Panels & Layout Manager Positioning Elements Layout Managers Using Layout Managers. Overview. Packages Packages Views. Packages. Projects in Java are structured in packages Packages are directories with subdirectories

boyd
Download Presentation

Organising Code: Packages & Archives

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 29 Organising Code: Packages & Archives

  2. Previously • Panels & Layout Manager • Positioning Elements • Layout Managers • Using Layout Managers

  3. Overview • Packages • Packages Views

  4. Packages • Projects in Java are structured in packages • Packages are directories with subdirectories • With .java files (development) With .class file (in .jar file) Windows Java src com src\com\aaz\sample0 src.com.aaz.sample0 aaz sample0 Eclipse view Windows view

  5. Packages • Name of package meaningful • Java classes maybe grouped into "Packages“ • Packages have hierarchical names • The core class libraries are all in packages that start with java • The GUI classes are in the packages and sub-packages of java.awt and java.swing

  6. Packages • Consider our Switch project • We have the project itself com.<author/company>.<project_word> • The class(es) to start the application would be in the base package for the project com.<author/company>.<project_word> • There are classes specific to generate the GUI for this project so added them into their own package, e.g. gui com.<author/company>.<project_word>.gui • Other general useful classes could be added in a general package com.<author/company>.util

  7. Packages Views The application

  8. Packages Views Windows Explorer Eclipse

  9. Packages Views • If you open the bin directory then you will get the same structure than in the src directory • bin directory for .class files – compiled files • src directory for .java files – code files

More Related