Programming I Packets and JAR 11th lecture.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming Lecture 4 Writing Java Applications, Java Development Tools.
Advertisements

Introduction to Java 2 Programming Lecture 10 API Review; Where Next.
Introduction to Java 2 Programming Lecture 3 Writing Java Applications, Java Development Tools.
1 G54PRG Programming Lecture 1 Amadeo Ascó Adam Moore 22 GUI Programming I.
1 G54PRG Programming Lecture 1 Amadeo Ascó Adam Moore 29 Organising Code: Packages & Archives.
Cognos Web Services Business Intelligence. SOA SOA (Service Oriented Architecture) The SOA approach involves seven key principles: -- Coarse -grained.
L1-2:CSC ©Dr. Basheer M. Nasef Lecture #1 By Dr. Basheer M. Nasef.
JAVA PROGRAMING LANGUAGE. Content of Java 2 SDK  Development Tools (In the bin subdirectory.) Tools and utilities that will help you develop, execute,
Java Tutorial – Building GUIs Java with Added Swing Daniel Bryant
Winter 2005Jason Prideaux1 Apache ANT A platform independent build tool for Java programs.
Using Java without BlueJ Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling BlueJ projects A BlueJ.
By Dr. Jiang B. Liu 12. The Java Beans. Java Beans n JavaBeans is a portable, platform-independent software component model written in Java. It enables.
Using Java without BlueJ Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling BlueJ projects A BlueJ.
Introduction to Java.
עיצוב תוכנה מונחה עצמים תירגול 1. 1.Packages and Paths 2.Jar Files Outline.
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Java 程序设计 Java Programming Fall, Contents for Today Java Program Structure  How to Compile a Java Program  How to Run a Java Program Environment.
Programming Fundamentals 2: Background/ F II Objectives – –give a non-technical overview of Java Semester 2, Background.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
Java Spring PImage Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Packages. Package 1.Avoid naming conflicts. Put classes into packages so that they can be referenced through package names. 2.Distribute software conveniently.
Introduction to Java The Java Platform, The Java Language, JDK, Eclipse Svetlin Nakov Technical Trainer Software University
Creating Windows. How can we use Java to create programs that use windows (GUI applications)? How can we use Java to create programs that use windows.
CS 4244: Internet Programming User Interface Programming in Java 1.0.
22-July-2002cse142-13B-Development © 2002 University of Washington1 Development Tools CSE 142, Summer 2002 Computer Programming 1
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
 Installation of Android Development Environment  Creating the App with OpenGL ES API  Running the App on Emulator Android App Development.
The Java Platform, The Java Language, JDK, IntelliJ
Swinging in Your Java Playground. Background Swing is a part of the Java Foundation Classes (JFC). The JFC is made up of features intended to give a programmer.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
Lecture 02. Java Virtual Machine(JVM) –set of computer software programs and data structures that use a virtual machine model for the execution of other.
introductory lecture on java programming
Creating Web Services Presented by Ashraf Memon Presented by Ashraf Memon.
CSCI 115 Computer Programming Overview. Computer Software System Software –Operating systems –Utility programs –Language compilers Application Software.
Past Computing Environments: Swing Ian Smith UI Toolkits (History Lesson) 4 Programming tools for building interfaces 4 Originally in Java you had AWT.
Object Oriented Programming Object and Classes Lecture 3 MBY.
How to install JavaCV in Eclipse. Make sure to download and install all these before you proceed Eclipse for Java EE developers (current is Juno)
Today Javadoc. Packages and static import. Viewing API source code. Upcoming Topics: –protected access modifier –Using the debugger in Eclipse –JUnit testing.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
CS-140 Dick Steflik Lecture 3. Java C++ Interpreted optimized for the internet Runs on virtual ized machine Derived from C++ Good object model Widely.
CSC 205 Programming II Lecture 5 AWT - I.
Welcome To java
“Packages in Java”.
Running Programs & IDEs Reference: COS240 Syllabus
Java Look-and-Feel Design Guidelines
Java Import Statement Copyright © Curt Hill
Installing and running the local check projects in Eclipse
Programming without BlueJ Week 12
Swing & the JFC – Advanced Java GUI
Getting Started ARCS Lab..
TOSCA-Metadata (directory )
Understanding and Creating Jar files in Java
TOSCA-Metadata (directory )
Executable Jars Dan Fleck Fall /27/2018.
Most Common Grading Issues
Applying OO Concepts Using Java
(Computer fundamental Lab)
Building a program (Java libraries) - an example
F II 1. Background Objectives
Developing Java Applications with NetBeans
Developing Java Applications with NetBeans
Working with Libraries
CMPE212 – Reminders Assignment 2 due today, 7pm.
Presentation transcript:

Programming I Packets and JAR 11th lecture

© Branko Kavšek, Jernej Vičič Packets What are packets and how do we use them? http://java.sun.com/docs/books/tutorial/java/package/index.html The JAR tool http://java.sun.com/docs/books/tutorial/deployment/jar/index.html 11th lecture Programming I © Branko Kavšek, Jernej Vičič

© Branko Kavšek, Jernej Vičič Overview Basic libraries Packets JAR Swing JavaDoc 11th lecture Programming I © Branko Kavšek, Jernej Vičič

Basic libraries JavaTM SE 6 Platform Java Platform, Standard Edition 6 JDK. Version 6

Paketi paketi (packages) so knjižnice Java objektov. v program jih lahko uvozimo z besedo import. Java API vsebuje veliko različnih paketov, lahko pa pakete naredimo tudi sami. Paket je tesno povezan z imenikom datotečnega sistema Vsi javni razredi, ki so v nekem imeniku se lahko med sabo kličejo.

Packets All public classes that are in a directory can call each other. Package behaves as a directory, all the classes of a package are friends (you can call another method, modify / read properties). We must store all classes in the same directory at design time. Packages can be placed in a Java JAR archive.

Packts - example import java.lang.Math; // sedaj lahko uporabljamo metodi iz Math public class Bla { public static void main(String argv[]) { double x=5; System.out.println(Math.sin(x)); // kličemo Math.sin(3.14); }

Packets package PrviPaket; public class Razred{ public static void main(String args[]){ System.out.println("Dober dan!"); } } // Razred

Packets Content of the example must be saved in the file Razred.java, which is located in the directory PrviPaket. Compile file Razred.java as an ordinary Java program. The implementation is slightly different: java PrviPaket/Razred

Pakets - JAR Jar is Java Archive. It is a file format based on the zip and is used to combine multiple files into one. It is primarily designed to facilitate and speed up the handling of java projects. It handles (in addition to Class files) also images similar rubbish.

Packets - JAR Make a jar archive: jar cvf pp.jar PrviPaket/ Start a class in an archive (add to classpath): java -classpath pp.jar PrviPaket/Razred Executable jar files: Open a nerw jar file. Find file MANIFEST.MF Add the line: Main-Class: PrviPaket/Razred Make a new archive: jar cvfm pp1.jar c:\temp\MANIFEST.MF PrviPaket/ Start: java -jar pp1.jar

© Branko Kavšek, Jernej Vičič Swing – why, how, who? Sun and allies JFC AWT Java 2D Accessibility Drag and Drop Swing 11th lecture Programming I © Branko Kavšek, Jernej Vičič

© Branko Kavšek, Jernej Vičič Swing usage Analogous to AWT components Add the letter J Additional componnets 11th lecture Programming I © Branko Kavšek, Jernej Vičič

© Branko Kavšek, Jernej Vičič Swing - usage tree = new JTree(); list = new JList(items); button = new JButton("Pritisni"); button.addActionListener(new ButtonListener()); 11th lecture Programming I © Branko Kavšek, Jernej Vičič

Swing – Differences between Swing and AWT All components are written in Java AWT components are only envelope Uniform look on all platforms Look up Greater control over the components Pluggable Look and Feel Slow and greedy 11th lecture Programming I © Branko Kavšek, Jernej Vičič

© Branko Kavšek, Jernej Vičič Swing Windows look 11th lecture Programming I © Branko Kavšek, Jernej Vičič

Swing metal (Java) look 11th lecture Programming I © Branko Kavšek, Jernej Vičič

© Branko Kavšek, Jernej Vičič Swing Motif look 11th lecture Programming I © Branko Kavšek, Jernej Vičič

© Branko Kavšek, Jernej Vičič Swing Source code: SwingApplet.html 11th lecture Programming I © Branko Kavšek, Jernej Vičič

© Branko Kavšek, Jernej Vičič JavaDoc Example! 11th lecture Programming I © Branko Kavšek, Jernej Vičič