1 Simple Phone Applet Lab 10. 2 Mobile Phone Display Area Send, Menu and End Numbers 0-9 * and #

Slides:



Advertisements
Similar presentations
Java GUI building with the AWT. AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
Advertisements

GUI Elements Session 17. Memory Upload Layout Components Button TextField TextArea Label Choice Containers Panels The applet itself.
TCU CoSc Programming with Java Visual Design (Chapter 5)
Java Software Development Paradigm Lecture # 12. Basics of GUI.
CMSC 341 Building Java GUIs. 09/26/2007 CMSC 341 GUI 2 Why Java GUI Development? Course is about Data Structures, not GUIs. We are giving you the opportunity.
Corresponds with Chapter 12
Jan AWT Widgets Yangjun Chen Dept. Business Computing University of Winnipeg.
Java Swing Recitation – 11/(20,21)/2008 CS 180 Department of Computer Science, Purdue University.
Graphics Programming With Applets Feb 23, Applets There are three different types of executable java code. –Standalone application, which has main()
GUI programming AWT(Abstract Windows Toolkit)-GUI components library when Java was introduced AWT was replaced by Swing components import javax.swing.*;
Applets. The Applet Class public class MyApplet extends java.applet.Applet {... /** The no-arg constructor is called by the browser when the Web page.
Review of Java Applets Vijayan Sugumaran Decision and Information Sciences Oakland University.
Buttons. Appearance of buttons A button has one of three appearances: Disabled by your program Enabled by your program Enabled by your program and pressed.
IEEM 110 Computing in Industrial Applications Basic User Interface in Java.
CS3157 Java UI Recitation. Material Covered: Overview of AWT components, Event Handling, creating applets, and sample UI. Not covered in recitation: Drawing,
Jan Containers Yangjun Chen Dept. Business Computing University of Winnipeg.
CS102--Object Oriented Programming Lecture 19: – The Swing Package (II) Copyright © 2008 Xiaoyan Li.
Java GUI building with the AWT. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many.
Unit 11 Object-oriented programming: Graphical user interface Jin Sa.
Chapter 9: Applets Jim Burns Fall Outline Learn about applets Learn about applets Write an HTML doc to host an applet Write an HTML doc to host.
Applets, AWTS CompSci 230 Software Construction.
Field Trip #26 Create a Find a Word Puzzle in Java By Keith Lynn.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
Introduction to Java Applet Programs Section 1.3Intro. to Java Applet Programs: a Greeter Applet Section 3.7Graphical/Internet Java: Applet: An Einstein.
Java GUI building with the AWT. AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
Graphical User Interface CSI 1101 N. El Kadri. Plan - agenda Graphical components Model-View-Controller Observer/Observable.
Java GUI building with Swing. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
Java Applets. Topics What is an applet? To convert GUI applications to Applets Hello World applet example!! Applets life cycle examples Invoking applets.
10/24/20151 Java GUI Programming. 10/24/20152 What is a GUI? Java has standard packages for creating custom Graphical User Interfaces Some of the fundamental.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
(c)2009 by E.S. Boese. All Rights Reserved. Classes Chapter 13 – Lecture Slides 1 Got class?
MSc Workshop - © S. Kamin, U. ReddyLect 3 - GUI -1 Lecture 3 - Graphical User Interfaces r GUI toolkits in Java API r JFrame r GUI components.
1 Lesson: Applets with User Input and Output with GUI ICS4M.
Layout Managers Arranges and lays out the GUI components on a container.
1 GUIs, Layout, Drawing Rick Mercer. 2 Event-Driven Programming with Graphical user Interfaces  Most applications have graphical user interfaces (GUIs)
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.
Java Applet. Introductions Applet is java program that can be embedded into HTML pages Java applets runs on the java enables web browsers such as mozila.
University of Limerick1 Software Architecture Java Layout Managers.
Java Applet Basics (2). The Body Mass Index Calculator.
Introduction to GUI in 1 Graphical User Interface 2 Nouf Almunyif.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
1 GUIs, Layout, Drawing Rick Mercer. 2 Event-Driven Programming with Graphical user Interfaces  Most applications have graphical user interfaces (GUIs)
Introduction to Java Applet Programs Section 1.3Intro. to Java Applet Programs: a Greeter Applet Section 3.7Graphical/Internet Java: Applet: An Einstein.
Csc Basic Graphical User Interface (GUI) Components.
Review_6 AWT, Swing, ActionListener, and Graphics.
Basics of GUI Programming Chapter 11 and Chapter 22.
PANELS. Color Class Colour constants are as follows: –Color.black –Color.blue import java.awt.* to access Color Class.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
AWT Layout Managers (Chapter 10) Java Certification Study Group January 21, 1999 Mark Roth.
CSI 3125, Preliminaries, page 1 Layout Managers. CSI 3125, Preliminaries, page 2 Layout Managers The LayoutManagers are used to arrange components in.
Lecture # 6 Graphical User Interface(GUI). Introduction A graphical user interface (GUI) presents a user- friendly mechanism for interacting with an application.
Graphical User Interface (GUI) Two-Dimensional Graphical Shapes.
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.
Introduction to GUI Programming in Java: Frames, Simple Components, and Layouts.
Getting Started with GUI Programming Chapter 10 CSCI 1302.
AWT Vs SWING. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses.
Introduction Many Java application use a graphical user interface or GUI (pronounced “gooey”). A GUI is a graphical window or windows that provide interaction.
GUI building with the AWT
Java Applets.
Object-Orientated Analysis, Design and Programming
INFSY 547: WEB-Based Technologies
Ellen Walker Hiram College
AWT Components and Containers
Java Applets.
GUI building with the AWT
GUI building with the AWT
Graphical User Interface
Presentation transcript:

1 Simple Phone Applet Lab 10

2 Mobile Phone Display Area Send, Menu and End Numbers 0-9 * and #

3 Layout of Mobile Phone Display Area Send, Menu and End Numbers 0-9 * and #

4 You can type in the display area

5 You can press numbers

6 Panel to make Applet or Frame layout easier, we break a frame up into regions and compose each of them separately. Each region is called a Panel. Each can have its own different LayoutManager. Panels don't have any visible bounding lines. We can delimit them with differing background colours. If we want something to draw on with drawString and drawLine normally you would use a Canvas.

7 Button

8 Code of red color import java.applet.*; import java.awt.*; public class lab10 extends java.applet.Applet { public void init() { setLayout(new FlowLayout()); setBackground(Color.red); add(new Label("<<")); add(new Button("How are you DCO students")); add(new Label(">>")); }

9 Button of mobile phones

10 Source Code import java.applet.*; import java.awt.*; public class lab101 extends java.applet.Applet { public void init() { String str; setLayout(new FlowLayout()); setBackground(Color.red); add(new Button("send")); add(new Button("menu")); add(new Button("stop")); for (int i = 1; i <9; i++) { str = "" +i; //Integer to String add(new Button(str)); } add(new Button("*")); add(new Button("0")); add(new Button("#")); } }

11 HTML with different width Maximum Using Array

12 Use GridLayout String str; setLayout( new GridLayout( 5, 3 )); // row 5: col :3 setBackground(Color.red); add(new Button("send")); add(new Button("menu")); add(new Button("stop")); for (int i = 1; i <10; i++) { str = "" +i; //Integer to String add(new Button(str)); } add(new Button("*")); add(new Button("0")); add(new Button("#"));

13 The source code import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class Grid_JApplet1 extends JApplet { public void init() { // Swing adds JComponents to the container's // contentPane rather than directly to the panel // as with the AWT. Container contentPane = getContentPane(); // Modify and add code between this line // // Create an instance of a JPanel sub-class GridPanel gridPanel = new GridPanel(); // And add one or more panels to the JApplet panel. contentPane.add(gridPanel); // // and this line. } // A sample JPanel class for holding components class GridPanel extends JPanel { GridPanel() { // Modify and add code between this line // String str; setLayout( new GridLayout( 5, 3 )); // row 5: col :3 setBackground(Color.red); add(new Button("send")); add(new Button("menu")); add(new Button("stop")); for (int i = 1; i <10; i++) { str = "" +i; //Integer to String add(new Button(str)); } add(new Button("*")); add(new Button("0")); add(new Button("#")); // // and this line. }

14 The HTML

15 Text Field A TextField is a scrollable text display object with one row of characters. The preferred width of the field may be specified during construction and an initial string may be specified.TextField

16 Simple Text Field

17 Source Code

18 Source import java.awt.*; import java.applet.Applet; public class TextFieldSimpleTest extends Applet { public void init() { TextField f1 = new TextField("type something"); add(f1); }

19 Text Area A TextArea is a multi-row text field that displays a single string of characters, where newline ('\n' or '\n\r' or '\r', depending on platform) ends each row. The width and height of the field is set at construction, but the text can be scrolled up/down and left/right.TextArea

20 Text Area

21 Source Code import java.awt.*; import java.applet.Applet; public class TextAreaSimpleTest extends Applet { TextArea disp; public void init() { disp = new TextArea("Code goes here", 10, 30); add(disp); }

22 Scroll

23 Source code import java.awt.*; import java.applet.Applet; public class TextAreaScroll extends Applet { String s = "This is a very long message " + "How are you DCO students " + "are you learning Java?"; public void init() { add(new TextArea (s, 4, 15, TextArea.SCROLLBARS_NONE)); add(new TextArea (s, 4, 15, TextArea.SCROLLBARS_BOTH)); }

24 Source code of Phone

25 Diagram