RMI, and Java GUIs 4-3-2002. Comments zEveryone should be filling out and turning in group evaluations. These are largely for your protection. It can.

Slides:



Advertisements
Similar presentations
1 Graphical User Interface (GUI) Applications Abstract Windowing Toolkit (AWT) Events Handling Applets.
Advertisements

Introduction to Java 2 Programming
Java GUI building with the AWT. AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Graphic User Interfaces Layout Managers Event Handling.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Java Remote Method Invocation (RMI) In Java we implement object systems: O1O2 O3 thread 1thread 2 execution scheme JVM 1JVM 2 distribution scheme.
Remote Method Invocation
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
Event Driven Programming and GUIs Part 3 CS221 – 4/15/09.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
1 Chapter 7 Graphics and Event Handling. 2 Overview The java.awt and javax.swing packages and their subpackages support graphics and event handling. Many.
Slides prepared by Rose Williams, Binghamton University Chapter 17 Swing I.
CSE 115 Week 5 February , Monday Announcements Exam 3 today Exam 3 today Lab 3 due this week Lab 3 due this week Exam 4 Monday 2/18 Exam.
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
Graphical User Interfaces (GUIs) GUI: An application that uses graphical objects to interact with users GUI applications consist of: –Events: A user or.
Swing CS-328 Dick Steflik John Margulies. Swing vs AWT AWT is Java’s original set of classes for building GUIs Uses peer components of the OS; heavyweight.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Java RMI RMI = Remote Method Invocation. Allows Java programs to invoke methods of remote objects. Only between Java programs. Several versions (JDK-1.1,
10.1 AWT The AWT classes Users today expect a Graphical User Interface (GUI) Improves application usability Difficult to implement cross-platform.
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
GUI Programming in Java
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
ACM/JETT Workshop - August 4-5, ExceptionHandling and User Interfaces (Event Delegation, Inner classes) using Swing.
Welcome to CIS 083 ! Events CIS 068.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
Java Programming: Advanced Topics 1 Common Elements of Graphical User Interfaces Chapter 6.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 13 : Swing I King Fahd University of Petroleum & Minerals College of Computer Science.
GUIs in Java Swing, Events CS2110, SW Development Methods Readings: MSD, Chapter 12 Lab Exercise.
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
– Advanced Programming P ROGRAMMING IN Lecture 21 Introduction to Swing.
1 Outline 1 Introduction 2 Overview of Swing Components 3 JLabel 4 Event Handling 5 TextFields 6 How Event Handling Works 7 JButton 8 JCheckBox and JRadioButton.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
GUIs in Java Opening Discussion zHow did the project work out? How did you decide to tackle the problem? What pieces did you break it into?
Java Remote Method Invocation RMI. Idea If objects communicate with each other on one JVM why not do the same on several JVM’s? If objects communicate.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
CS Lecture 00 Swing overview and introduction Lynda Thomas
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Lec.10 (Chapter 8 & 9) GUI Jiang (Jen) ZHENG June 27 th, 2005.
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Proxy Pattern. What’s a Proxy? A remote proxy acts as a local representative of a remote object Remote Object: instantiated in a different JVM heap (a.
Remote Method Invocation A Client Server Approach.
Distributed ATM Smita Hiremath CSC Topic Description ATM software has 3 components: Client Server Database.
1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Netprog Java RMI1 Remote Method Invocation.
Remote Method Invocation Internet Computing Workshop Lecture 17.
Java Swing What is swing? Swing is a ”Lightweight” GUI ToolKit for Java Different from AWT / SWT Toolkits for GUIs Few lines of code to produce GUI elements.
Welcome To java
A First Look at GUI Applications
Java Remote Method Invocation (RMI)
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
Ellen Walker Hiram College
Graphical User Interfaces -- Introduction
Graphical User Interface
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

RMI, and Java GUIs

Comments zEveryone should be filling out and turning in group evaluations. These are largely for your protection. It can be used to point out where there are problems in group mechanics. zI had planned on talking about sequence diagrams today, but I’m going to push that back a week and discuss some Java topics instead.

Remote Method Invocation zJava makes virtually all network communication easier than it is in C/C++. This is particularly true when using RMI. zWith RMI you can treat objects on other computers as if they were local on your own computer and call methods on them accordingly. Of course, there is a lag when you do this, but you don’t have to explicitly worry about the socketing and whatnot.

Remote Interfaces zThe entity you get for an object remotely is actually not the object itself, but an interface that object implements. The interface must extend java.rmi.Remote. zThe implementation class should also extend java.rmi.server.UnicastRemoteObject. zNote that this implies that the implementation can have more functionality than the remote interface does. zAll remote methods can throw java.rmi.RemoteException.

Passing zDifferent types of objects are passed differently yRemote objects - any object that extends java.rmi.Remote is passed as a remote object. You get a skeleton that does network communication. ySerializable objects - If an object is not Remote it must be serializable and then it is passed by value. yPrimitives - No pass by reference of primitives

Registering and Lookup zOnce you have a remote object, it can pass you others, but getting the first one takes a different approach. zAn object can register itself with the rmi registry using the rebind method of java.rmi.Naming. (You have to start a local registry with rmiregistry first.) zObjects can get a remote reference to a registered object using the lookup method of java.rmi.Naming.

Compiling zOnce you have written your code you first compile it with a normal Java compiler. After that you have to do another step to create stub and skeleton classes that do most of the work behind RMI. You to this is the RMI compiler, rmic. Just run rmic specifying the name of the implementation class.

Java GUIs zOne of the greatest things about Java, from an application building standpoint, is how easy it is to make a GUI in it. zSince 5 out of 8 of the groups HAVE to do this to implement anything we will take a few minutes to discuss it. zJava has two graphics libraries, AWT and Swing. They work very similarly.

AWT zThe AWT library uses inheritance extensively. Components of the GUI are represented by the component class. Container is a subclass of Component that can have other components added to it. Each of these has other subclasses representing buttons, windows, text fields, labels, etc.

Layouts zTo make Java GUIs portable, they use layout managers to position and size various components. You can place things at specific locations on the screen, but that isn’t very portable. zEvery container has a layout manager it uses to place the components in it. By nesting containers and layout managers you can get great flexibility.

Some Layout Managers zHere are some of the layout managers in AWT. yFlowLayout - places one component after another like text on a page. yGridLayout - places components on a regular grid. yBorderLayout - Objects can be placed a north, south, east, west, or center. yGridBagLayout - A powerful layout manager for placing objects in an irregular grid.

Events zNo GUI is complete unless it can react to the user. User interactions with a GUI are called events and we want to be able to create code to “handle” events. zIn Java (since version 1.1) we do this be attaching event listeners to GUI components. When an event happens for an object all the appropriate listeners for that object are called.

Events and Listeners zThere are a fair number of event types and listeners. zThe listeners include ActionListener, MouseListener, KeyListener, and FocusListener. Each listener type has certain methods that it must define. zAction events are some of the most common and happen when you do things like click buttons.

Swing zSwing is actually based on AWT, but provides a look and feel that is machine independent. It has pretty much all the same objects but the names typically start is J (i.e. JButton and JFrame). zSwing also has other classes AWT didn’t. These include JTable, JTree, JColorChooser, and JToolBar. zAWT or Swing for project?