Introduction to GUI in Graphical User Interface Nouf Almunyif.

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Advertisements

Introduction to Objects and Input/Output
Dialogs. Displaying Text in a Dialog Box Windows and dialog boxes –Up to this our output has been to the screen –Many Java applications use these to display.
1 Introduction to Java Programming Lecture 4 Using JOptionPane Spring 2008.
Object-Oriented Programming with Java Java with added Swing Lecture 3.
COMP 14 Introduction to Programming Miguel A. Otaduy May 17, 2004.
COMP 14 Introduction to Programming Mr. Joshua Stough February 2, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 29, 2005.
Programming with Java standard classes. Java API Application Programming Interface Provides hundreds of standard classes that can be incorporated into.
Relational Operators Control structures Decisions using “if” statements  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course.
Scott Grissom, copyright 2006Ch 11: GUI Slide 1 Graphical User Interfaces (Ch 11) Careful design of a graphical user interface is key to a viable software.
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
Warm-Up: Monday, March 3 List all devices you can think of that can be used to input information into the computer.
1 Interface Types & Polymorphism & introduction to graphics programming in Java.
Intro to GUIs (Graphical User Interfaces) Section 2.5Intro. to GUIs: a GUI Greeter Section 3.7Graphical/Internet Java: Einstein's Equation.
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.
Java Programming, Second Edition Chapter Five Input and Selection.
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
GUI Clients 1 Enterprise Applications CE00465-M Clients with Graphical User Interfaces.
Input/Output in Java. Output To output to the command line, we use either System.out.print () or System.out.println() or System.out.printf() Examples.
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Introduction to Java Applications Outline 2.1Introduction 2.2A Simple Program: Printing a.
1 Java Programming 1 Introduction to Basic GUI Lesson 4.
Even-Driven Programming and basic Graphical User Interface.
Timer class and inner classes. Processing timer events Timer is part of javax.swing helps manage activity over time Use it to set up a timer to generate.
Objectives ► Become familiar with the class String ► ► Learn how to use input and output dialog boxes in a program ► ► Learn how to tokenize the input.
1/23: Java Modular Components Identifiers: naming requirements for Java variables & objects Stepping out of the MS-DOS window: The Java Modular Component:
 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.
Introduction to GUI in 1 Graphical User Interface 2 Nouf Almunyif.
Dialog Boxes.
Graphical User Interfaces. Graphical input and output with JOptionPane.
GUI Graphical User Interface Each onscreen component and window is an object Object interaction makes communication and scoping challenging Event-driven.
Basics of GUI Programming Chapter 11 and Chapter 22.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
JOptionPane Class JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something. While the JOptionPane.
 2005 Pearson Education, Inc. All rights reserved. 1 Introduction to Classes and Objects.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
SE-1020 Dr. Mark L. Hornick 1 Graphical User Interfaces.
CSC 142 H 1 CSC 142 Standard input/output. CSC 142 H 2 Console Ouput  Use the static PrintStream object out in System System.out.println("Hello, world");
Lecture # 6 Graphical User Interface(GUI). Introduction A graphical user interface (GUI) presents a user- friendly mechanism for interacting with an application.
Creating and Using Dialogs ● A dialog is a box that pops up and prompts the user for a value or informs them of something ● One way: directly create objects.
Casting, Wrapper Classes, Static Methods, JOptionPane Class.
Objects First With Java A Practical Introduction Using BlueJ Building Graphical User Interfaces (GUIs) Week
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
Introduction to GUI in 1 Graphical User Interface Nouf Almunyif.
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit 6 Graphical user interfaces 1.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 7 ( Book Chapter 14) GUI and Event-Driven Programming.
Java Programming Lecture 2
Outline Creating Objects The String Class Packages Formatting Output
AP Java 10/4/2016.
Section 64 – Manipulating Data Using Methods – Java Swing
Java Programming: From Problem Analysis to Program Design,
CSE 114 – Computer Science I Event Programming
JOptionPane Dialogs javax.swing.JOptionPane is a class for creating dialog boxes. Has both static methods and instance methods for dialogs. Easy to create.
Timer class and inner classes
CS18000: Problem Solving and Object-Oriented Programming
Chapter 2 - Introduction to Java Applications
Building Graphical User Interface with Swing a short introduction
Chapter 3: Introduction to Objects and Input/Output
AP Java 10/4/2016.
Graphics Programming - Frames
Chapter 7 (Book Chapter 14)
Advanced Programming in Java
CS431 ws99 Half Text Half Graphics
Ch. No Name Marks 01 AWT Networking JDBC Swing 05
Object-Oriented Software Engineering
Ch. No Name Marks 01 AWT Networking JDBC Swing 05
Chapter 4 Interface Types and Polymorphism Part 1
TA: Nouf Al-Harbi NoufNaief.net :::
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

Introduction to GUI in Graphical User Interface Nouf Almunyif

Graphical User Interface Java is equipped with many powerful ,easy to use GUI component such as input and output dialog boxes that you can use them to make your program attractive and user friendly GUI-based programs are implemented by using classes from the javax.swing and java.awt packages. Nouf Almunyif

Using Dialog Boxes for Input/Output JOptionPane this class is contained in the package javax.swing We will use two methods of this class : showInputDialog showMessageeDialog Nouf Almunyif

ShowInputDialog General syntax Str= JOptionPane.showInputDialog(stringexpression); This method returns the input as a String value Example: str=JOptionPane.showInputDialog("Enter your name "); Nouf Almunyif

showMessageeDialog General syntax JOptionPane.showMessageDialog(ParentComponent, message string, box title , msseg type); Example: JOptionPane.showMessageDialog(null,"Hello","Title", JOptionPane.INFORMATION_MESSAGE); Nouf Almunyif

Messagee Type JOptionPane.showMessageDialog(null,"Hello","Title", JOptionPane. ????????????); ERROR_MESSAGE WARNING_MESSAGE INFORMATION_MESSAGE PLAIN_MESSAGE QUESTION_MESSAGE Nouf Almunyif

Short form showMessageeDialog General syntax JOptionPane.showMessageDialog (ParentComponent, message string); Example: JOptionPane.showMessageDialog(null,"Hello"); Nouf Almunyif

Example for adding two numbers Nouf Almunyif

Nouf Almunyif

Sample GUI Object Window Nouf Almunyif

Creating a JFrame a JFrame class have the following component: JFrame(); JFrame(string Title); setTitle(String title ); setSize(int Wedth , int length); setVisible(boolean var); setLocation (FRAME_X_ORIGIN, FRAME_Y_ORIGIN) Nouf Almunyif

Example Nouf Almunyif