ITEC 109 Lecture 27 GUI. GUIs Review Sounds –Arrays hold sample values –Creating a keyboard –Sound effects Homework 3 –The big two –Due after break –Lab.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Java Software Development Paradigm Lecture # 12. Basics of GUI.
Graphic User Interfaces Layout Managers Event Handling.
Corresponds with Chapter 12
Java Swing Recitation – 11/(20,21)/2008 CS 180 Department of Computer Science, Purdue University.
Event Driven Programming and GUIs Part 3 CS221 – 4/15/09.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
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.
IEEM 110 Computing in Industrial Applications Basic User Interface in Java.
Graphical User Interfaces
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Contructing GUI’s in Java Implemented in the Swing API Imported into your programs by: import javax.swing.*; Most Swing programs also need the AWT packages.
Lesson 35: Review of the Java GUI. The JFrame, Container and JButton.
A.k.a. GUI’s.  If you want to discuss your Lab 2 grade come see me this week. ◦ Office: 436 ERB. One hour prior to class ◦ Open to Appointments MWF 
GUI Basics: Introduction. Creating GUI Objects // Create a button with text OK JButton jbtOK = new JButton("OK"); // Create a label with text "Enter your.
Java Programming Chapter 10 Graphical User Interfaces.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
Lesson 27: Introduction to the Java GUI. // helloworldbutton.java import java.awt.*; import javax.swing.*; class HelloButton{ public static void main.
Layout Management Containers can arrange their components. Our container is a JPanel, and it can set the way it’s components will be laid out : mypanel.setLayout.
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.
Java GUI CSCE 190 – Java Instructor: Joel Gompert Mon, July 26, 2004.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
Copyright © 2002, Systems and Computer Engineering, Carleton University c-Gui3.ppt * Object-Oriented Software Development Part 18-c Building.
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.
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.
Object Oriented programming Instructor: Dr. Essam H. Houssein.
ITEC 109 Lecture 27 GUI Interaction. Review GUI basics JFrame JPanel JLabel, JButton, JTextField Layout managers –Flow / Box –Border / Grid.
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.
CS Fall 2012, Lab 09 Haohan Zhu. Boston University Slideshow Title Goes Here CS Fall 2012, Lab /20/2015 GUI - Graphical User Interface.
GUI Basics. What is GUI? A graphical user interface (GUI) is a type of user interface item that allows people to interact with programs in more ways than.
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.
1 / 67 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 14 Programming Fundamentals using Java 1.
University of Limerick1 Software Architecture Java Layout Managers.
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.
1 GUIs, Layout, Drawing Rick Mercer. 2 Event-Driven Programming with Graphical user Interfaces  Most applications have graphical user interfaces (GUIs)
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
GUI Basics. Agenda What GUI How to make in java Creating frames Frequently used GUI components Layout Managers.
Review_6 AWT, Swing, ActionListener, and Graphics.
Basics of GUI Programming Chapter 11 and Chapter 22.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
Ajmer Singh PGT(IP) JAVA IDE Programming - I. Ajmer Singh PGT(IP) GUI (Graphical User Interface) It is an interface that uses a graphic entities along.
Java Programming, Second Edition Chapter Thirteen Understanding Swing Components.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Swing GUI Components So far, we have written GUI applications which can ‘ draw ’. These applications are simple, yet typical of all Java GUI applications.
Graphical User Interface (GUI)
Event Handler Methods Text field Object Responder JAVA AWT Environment: Messages are sent between JAVA Objects Screen Event Notification Press Button.
1 Lecture 8: User Interface Components with Swing.
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.
GUIs & Event-Driven Programming Chapter 11 Review.
Chapter 7 A First Look at GUI Applications Layout Managers.
Graphical User Interfaces
Java GUI.
Modern Programming Language Java
Graphical User Interface (pronounced "gooey")
Graphical user interface with Swing by jose maria gonzalez pinto
Ellen Walker Hiram College
Timer class and inner classes
GUIS: Graphical User Interfaces
Steps to Creating a GUI Interface
Week 8 Swing NetBeans GUI Builder
Graphical User Interface
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

ITEC 109 Lecture 27 GUI

GUIs Review Sounds –Arrays hold sample values –Creating a keyboard –Sound effects Homework 3 –The big two –Due after break –Lab week after break = Free help

GUIs Schedule This week –Graphical user interfaces

GUIs Objectives GUIs Another usage of variables, operations, functions, conditionals, and arrays –Video

GUIs How 0,0 1920,1080 Lots of little dots make up the image Ends up with: 2,073,600 pixels

GUIs Operating system Runs programs, allows access to hardware JFrame interfaces with the OS (type of variable) Allows you to ask for a window of a specific size, or one that will hold your app Let me have a window of size X,Y please

GUIs Example import javax.swing as swing import java frame = swing.JFrame(); frame.setTitle(“First window”) frame.setSize(200,150) frame.show(); Window title Shows it to the user Include Java

GUIs Before widgets Mental model JFrame JPanel

GUIs Component s JLabel JButton JTextField panel = swing.JPanel() label = swing.JLabel() label.setText(”My first label") panel.add(label) button = swing.JButton() button.setText(”My first button") panel.add(button) text = swing.JTextField() text.setText("First text") panel.add(text) frame.setContentPane(panel) Create GUI component Add to content pane Add one pane to the JFrame

GUIs Grouping Panels can include other panels JPanel JFrame

GUIs Layouts Need a way to specify what goes where Default is left to right with a break when it won’t meet the next line Several other possibilities

GUIs Border Layout Specific layout Not all parts are required (scaling) primary = swing.JPanel(); primary.setLayout(awt.BorderLayout()); n = swing.JButton(); n.setText("North") primary.add(n,awt.BorderLayout.NORTH); c = swing.JButton(); c.setText("Center") primary.add(c,awt.BorderLayout.CENTER); frame.setContentPane(primary) Tells the Panel to arrange its contents in a specific way Tell the frame to display this panels content

GUIs Grid Layout Rows and columns primary = swing.JPanel(); primary.setLayout(awt.GridLayout(2,2)); one = swing.JButton(); one.setText("First") two = swing.JButton(); two.setText("Second") three = swing.JButton(); three.setText("Third") primary.add(one); primary.add(two); primary.add(three); frame.setContentPane(primary)

GUIs Flow Assures left to right or right to left primary = swing.JPanel(); primary.setLayout(awt.FlowLayout()); one = swing.JButton(); one.setText("Look at") two = swing.JButton(); two.setText("Me") primary.add(one); primary.add(two); frame.setContentPane(primary);

GUIs Box Layout Allows for blank spaces in the GUI primary = swing.JPanel(); primary.setLayout(swing.BoxLayout(primary,swing.BoxLayout.PAGE_AX IS)); one = swing.JButton(); one.setText( "Hello") two = swing.JButton(); two.setText("World") primary.add(one) primary.add(swing.Box.createRigidArea(awt.Dimension(0,50))); primary.add(two) frame.setContentPane(primary);

GUIs Documentatio n Reading it is good Using it for inspiration is better –Find out how to specify where extra space goes –Create spaces between components

GUIs Process Identify what the GUI does Draw boxes on paper Determine components for the page Figure out how many panels do you need Figure out the layout of the panels Code –Notice this is the last step!!!!

GUIs Review JFrame JPanel Layouts JButton / JLabel / JTextField