Welcome to java einfach objektorientiert verteilt interpretierend

Slides:



Advertisements
Similar presentations
Applets The objectives of this chapter are: To describe applets and their purpose To discuss embedding applets in HTML pages.
Advertisements

June 1, 2000 Object Oriented Programming in Java (95-707) Advanced Topics 1 Lecture 9 Object Oriented Programming in Java Advanced Topics Abstract Windowing.
1 Simple Phone Applet Lab Mobile Phone Display Area Send, Menu and End Numbers 0-9 * and #
© L.Lúcio, An example GUI in Java n Two graphic libraries in Java u AWT u Swing n Swing is more recent than AWT: u Built on top of AWT classes;
Chapter 14 Applets. 2 Knowledge Goals Understand the differing roles of applications and applets Understand how a browser operates Understand the role.
CS3157 Java UI Recitation. Material Covered: Overview of AWT components, Event Handling, creating applets, and sample UI. Not covered in recitation: Drawing,
Creating a GUI with Swing. Introduction Very useful link: Swing – is a part of JFC (Java Foundation.
Graphical User Interfaces
1 lecture 12Lecture 13 Event Handling (cont.) Overview  Handling Window Events.  Event Adapters Revisited.  Introduction to Components and Containers.
James Tam An introduction into HCI: Task-Centered System Design An Introduction To Graphical User Interfaces The event-driven model Building a simple.
Java GUI building with the AWT. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many.
Developing User Interfaces (DUI) Chris North cs3724: HCI.
CHAPTER-1 SWING JAVA-GUI. HERE ARE SOME TERMS THAT YOU’LL ENCOUNTER IN YOUR LESSON ON GRAPHICS: AWT Swing Applet/JApplet Graphics object init() GUI.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Java On The Web Session 15. Memory Upload JAVA Applets Colors Fonts Drawing Methods Posting your Applet.
Applets.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Lesson 36: The calculator – Java Applets. 1. Creating Your First Applet HelloWorldApp is an example of a Java application, a standalone program. Now you.
MIT AITI 2003 Lecture 17. Swing - Part II. The Java Event Model Up until now, we have focused on GUI's to present information (with one exception) Up.
Java GUI building with Swing. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
Java Programming 1 Java Programming II Events, AWT, and Swing.
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Introduction to Applets Course Lecture Slides 29 th July 2010.
Cs884(Prasad)java12AWT1 Abstract Windowing Toolkit Support for Graphical User Interface (Event-driven programming)
Objectives of This Session
Event Handling Mohanraj S AP / IT Angel College of Engg & Tech.,
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
Java's Graphical User Interface Toolkit
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
Applets Yong Choi School of Business CSU, Bakersfield.
 GUI – Graphic User Interface  Up to now in the programs we have written all output has been sent to the standard output device i.e.: the DOS console.
Java Applet Basics (2). The Body Mass Index Calculator.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
CS 4244: Internet Programming User Interface Programming in Java 1.0.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Ch13 Creating windows and applets. Short overview AWT (Abstract Windowing Toolkit) Early Java development used graphic classesEarly Java development used.
GUI DYNAMICS Lecture 11 CS2110 – Fall GUI Statics and GUI Dynamics  Statics: what’s drawn on the screen  Components buttons, labels, lists, sliders,
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
1 Applications & Applets Standalone applications & Java applets Peter Mozelius DSV/UCSC.
Chapter 2 Creating a Java Application and Applet.
Graphical User Interfaces A Graphical User Interface (GUI) in Java is created with at least three kinds of objects: –components, events, and listeners.
What Is an Event? Events – Objects that describe what happened Event sources – The generator of an event Event handlers – A method that receives an event.
Chapter 12: The Abstract Window Toolkit Java Programming FROM THE BEGINNING Copyright © 2000 W. W. Norton & Company. All rights reserved. 1 Chapter 12.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Applets. 9/04/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L12: Applets Slide 2 Applets Usually.
IB103 Week 9 Free Standing Programs Chapter 18. Applets vs. Applications Applications are free standing See Program “Greeting” which prints out Hello.
TENTH LECTURE Event and listener. Events and Listeners An event can be defined as a type of signal to the program that something has happened. The event.
Java Swing and Events Chris North cs3724: HCI. Presentations nadine edwards, steve terhar Vote: UI Hall of Fame/Shame?
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 14 JavaFX Basics.
Java Programming (By Rama Bhadra Rao M) You can Trace me in Day 5
GUI.1 Graphical User Interfaces GUIs. GUI.2 The Plan Components Flat Layouts Hierarchical Layouts Designing a GUI Coding a GUI.
Chapter 6 Building Java GUIs. MVC Model View Controller The model passes its data to the view for rendering The view determines which events are passed.
Design Applet based java program to find the area and perimeter of a rectangle given its length and width. Java GUI.
CSC 205 Programming II Lecture 5 AWT - I.
Welcome To java
Java Applet What is a Java Applet? How is applet compiled?
Java Applets.
Welcome to java einfach objektorientiert verteilt interpretierend
Event Handling Chapter 2 Objectives
Abstract Window ToolKit (AWT)
Ellen Walker Hiram College
MVC Paradigm The MVC paradigm breaks applications or interfaces into three parts: the model, the view, and the controller. A --> 25 % B --> 60 % C -->
Graphical user interface-based programming
UNIT-5.
Java Applets.
Graphics Programming - Frames
LayoutManagers The LayoutManagers are used to arrange components in a particular manner. LayoutManager is an interface that is implemented by all the classes.
GUI building with the AWT
static public void graficar(
G6DICP - Lecture 27 Java Applets.
A Brief History January 1996: first official release JDK 1.0
Presentation transcript:

Welcome to java einfach objektorientiert verteilt interpretierend robust secure architekturneutral portabel schnell parallel(multitheded)

Vielfalt von Java-Anwendungen Android App JavaBeans (Javaenterprise) Java Applikation Applet Servlet Desktopapplikation mit GUI (AWT/Swing) Konsolapplikation (ohne GUI) Applikationsserver (ohne UI) JavaFX Applikation

Dateiname: Klassenname.java Erstes Java-Programm Dateiname: Klassenname.java Indiesem Fall: HelloOne.java public class HelloOne { public static void main(String args[]) System.out.println("welcome to java"); System.out.println("today is "+new java.util.Date()); }

Kommandozeilenargumente public class HelloEcho { public static void main(String args[]) for(int i=0;i<args.length;i++) System.out.println(args[i]); // oder for(String s:args) System.out.println(s); System.exit(0); }

Mit Graphic User Interface (AWT) import java.awt.*; import java.awt.event.*; import java.util.*; public class HelloTwo extends Panel { Label l1=new Label("welcome to java",Label.CENTER); Label l2=new Label("today is "+new Date(),Label.CENTER); Button close=new Button("Close"); public HelloTwo() . . . } public static void main(String args[])

Der Constructor public HelloTwo() { setFont(new Font("System", Font.PLAIN,24)); setLayout(new GridLayout(3,1,0,10)); add(l1); add(l2); add(close); close.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {System.exit(0);}}); } Hier entsteht eine inner class, in diesem Fall eine anonomous class

Die main-Function public static void main(String args[]) { Frame f=new Frame("first Desktop Application"); HelloTwo h =new HelloTwo(); f.add(h); f.setVisible(true); f.pack(); }

Das Applet import java.applet.*; import java.awt.*; public class HelloThree extends Applet { public void init() Panel h=new HelloTwo(); add(h); } Ein Applet wird immer in eine html-Seite eingebunden und mittels Browser oder appletviewer ausgeführt. <html> <body> <applet code=HelloThree width=940 height=540></applet> </body> </html>

Verbesserte Version: Button ist hier in der main-fkt. public class HelloTwoBetter extends Panel { Label l1=new Label("welcome to java",Label.CENTER); Label l2=new Label("today is "+new Date(),Label.CENTER); public HelloTwoBetter() setFont(new Font("System", Font.PLAIN,24)); setLayout(new GridLayout(3,1,0,10)); add(l1); add(l2); } public static void main(String args[]) Frame f=new Frame("first Desktop Application"); HelloTwoBetter h =new HelloTwoBetter(); f.add(h,BorderLayout.CENTER); Button close=new Button("Close"); close.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){System.exit(0);}}); f.add(close,BorderLayout.SOUTH); f.setVisible(true); f.pack(); Button ist hier in der main-fkt. Somit taucht er bei Verwendung Des Panels als Component im Applet nicht mehr auf