Programski jezici. leto

Size: px
Start display at page:

Download "Programski jezici. leto"

Transcription

1 Programski jezici leto

2 Grafički programi Koriste grafičke mogućnosti: boje, fontove, geometrijske oblike, slike,... Komuniciraju sa korisnikom preko grafičkog korisničkog interfejsa koji se sastoji od grafičkih komponenti: prozor, meni, dugme, oznaka, tekstualno polje,... 2

3 Programiranje grafičkih programa se razlikuje od programiranja konzolnih programa, jer je način njihovog izvršavanja različit Grafički program se ne izvršava sinhrono (od početka do kraja, jedna naredba iza druge), već asinhrono Grafički program se sastoji od naredbi koje se izvršavaju kao reakcija na korisnikove aktivnosti nad komponentama grafičkog interfejsa programa 3

4 Klasični pristup: programski se određuje kada korisnik unosi ulazne podatke i kada dobija izlazne podatke Grafički pristup: korisnik određuje kada unosi ulazne podatke i kada dobija izlazne podatke (izbor iz menija, klik na dugme,...) Korisnikove aktivnosti sa fizičkim uređajima miša i tastature nad grafičkim elementima programa su drugi oblik ulaznih podataka (događaji) 4

5 Programiranje grafičkih programa je programiranje vođeno događajima (engl. event-driven programming) Grafički program dobija događaje kao ulaz Deo grafičkog programa koji reaguje na određeni događaj se naziva rukovalac događaja (engl. event listener, event handler) 5

6 Java grafički programi svoj korisnički interfejs grade integrisano sa ostalim naredbama Java grafički programi koriste klase iz dve standardne biblioteke za rad sa grafičkim komponentama Biblioteka AWT (Abstract Window Toolkit) do Java verzije 1.1 u paketu java.awt Biblioteka Swing od Java verzije 1.2 u paketu javax.swing 6

7 Biblioteka AWT podržava minimalni skup komponenti grafičkog interfejsa koje poseduju sve platforme koje podržavaju Javu Oslanja se na odgovarajući operativni sistem Izgleda podjednako osrednje na svim platformama Klase u paketima java.awt.* 7

8 Biblioteka Swing je napisana od nule Obezbeđuje veći broj složenijih grafičkih komponenti od biblioteke AWT Ne oslanja se na operativni sistem Jednako izgleda i radi na svim platformama Klase u paketima javax.swing.* Nazivi klasa počinju sa Jxxx 8

9 Grafički elementi za pravljenje korisničkog interfejsa Prozor (pravougaonik na ekranu) Okvir (permanentni prozor) Dijalog (privremeni prozor) Komponenta (element koji ima veličinu i poziciju na ekranu i proizvodi događaje) Kontejner (komponenta koja može obuhvatati druge komponente) 9

10 Okvir Prozor najvišeg nivoa (ne nalazi se unutar drugog prozora i ne može se dodati drugom prozora) Glavni prozor grafičkog programa Mogućnosti: može se otvoriti i zatvoriti, može mu se promeniti veličina, može obuhvatati druge komponente Klasa JFrame 10

11 Okvir 11

12 public class PrazanOkvir { public static void main(string[] args) { } } JFrame okvir = new JFrame("Prazan okvir"); okvir.setsize(300, 200); okvir.setlocation(100, 150); okvir.setdefaultcloseoperation(jframe.exit_on_close); okvir.setvisible(true); 12

13 Kontejneri (okvir, panel) Mogu se samostalno prikazati na ekranu Služe za grupisanje komponenti Komponente (dugme, oznaka, tekstualno polje, meni,...) Mogu se prikazati samo unutar nekog kontejnera 13

14 Primer: Grafičko programiranje 14

15 Primer: Grafičko programiranje JButton dugmeok = new JButton("OK"); JLabel oznakaime = new JLabel("Unesite svoje ime: "); JTextField tekstpoljeime = new JTextField("Ovde upišite svoje ime"); JCheckBox potvrdastudent = new JCheckBox("Student"); JRadioButton radiodugmezaposlen = new JRadioButton("Zaposlen"); JComboBox kombpoljegodina = new JComboBox(new String[]{"I godina", "II godina", "III godina", "IV godina"}); 15

16 Dodavanje komponenti kontejneru: add() public class TestGUIKomponente{ public static void main(string[] args) { // Konstruisanje glavnog prozora (okvira) JFrame okvir = new JFrame("Test GUI komponente"); okvir.setlocation(100, 150); okvir.setdefaultcloseoperation(jframe.exit_on_close); // Konstruisanje komponenti JButton dugmeok = new JButton("OK");... 16

17 } } // Konstruisanje panela za komponente JPanel panel = new JPanel(); // Smeštanje komponenti u panel panel.add(dugmeok);... // Smeštanje panela u okvir okvir.add(panel); okvir.pack(); okvir.setvisible(true); 17

18 Koordinate grafičkih elemenata okvir.setbounds(100, 150, 300, 200); 18

19 Razmeštanje komponenti unutar kontejnera Prilikom dodavanja komponente unutar kontejnera (metodom add()), automatski se određuje pozicija i veličina komponente Svaki kontejner ima podrazumevani postupak razmeštanja komponenti unutar njega Postupak razmeštanja se može promeniti metodom: public void setlayout(layoutmanager m) 19

20 Standardni postupci razmeštanja (engl. layout manager) FlowLayout GridLayout BorderLayout... 20

21 Primer: 21

22 Primer: 22

23 Rukovaoci događajima Programiranje grafičkih programa se zasniva na događajima Grafički program reaguje na razne vrste događaja Događaji se dešavaju u nepredvidljivim trenucima i po nepredvidljivom redosledu 23

24 Rukovaoci događajima Događaji su predstavljeni objektima klasa koje su naslednice klase EventObject Događaji su razvrstani prema tipu događaja događaji klika na dugme događaji rada sa mišem događaji rada sa tastaturom... 24

25 Rukovaoci događajima Mehanizam rukovanja događajima Komponenta u kojoj se događaj desio je izvor događaja Kada se desi događaj, JVM konstruiše objekat koji opisuje nastali događaj Konstruisani objekat događaja se prenosi tačno određenom metodu rukovaoca događaja i taj metod se poziva radi obrade događaja 25

26 Rukovaoci događajima Rukovalac događaja mora biti objekat klase koja implementira specijalni interfejs Rukovalac događaja se mora eksplicitno pridružiti komponenti koja je potencijalni izvor događaja 26

27 Rukovaoci događajima Odnos između klasa i interfejsa za rukovanje događajima 27

28 Rukovaoci događajima Tipovi događaja koje generišu komponente (izvori događaja) Tip događaja Interfejs rukovaoca događaja ActionEvent ActionListener MouseEvent MouseListener WindowEvent WindowListener KeyEvent KeyListener FocusEvent FocusListener ItemEvent ItemListener TextEvent TextListener ComponentEvent ComponentListener ContainerEvent ContainerListener

29 Rukovaoci događajima Standardna imena interfejsa i metoda Rukovalac događaja implementira odgovarajući XxxxListener interfejs Rukovalac događaja se pridružuje komponenti metodom addxxxxlistener() U rukovaocu događaja se izvršava tačno određeni metod koji obrađuje događaj 29

30 Rukovaoci događajima Primer: akcijski događaj (ActionEvent) za klik na dugme tasterom miša Akcijski događaj se obrađuje pomoću ActionListener objekta ActionListener objekat mora imati metod actionperformed() Taj metod se automatski poziva kada se desi akcijski događaj 30

31 Rukovaoci događajima Rukovalac događaja za klik na dugme mora biti objekat klase koja implementira interfejs ActionListener To obezbeđuje da rukovalac događaja za klik na dugme sadrži metod koji se poziva kada se desi događaj klika na dugme 31

32 Rukovaoci događajima Format klase RD koja predstavlja rukovaoca događaja i služi za konstruisanje ActionListener objekta: public class RD implements ActionListener {... public void actionperformed(actionevent e) { // Naredbe koje obrađuju // događaj klika na dugme } } 32

33 Rukovaoci događajima Primer: brojanje klikova na dugme 33

GUI - događaji (Events) i izuzeci. Bojan Tomić

GUI - događaji (Events) i izuzeci. Bojan Tomić GUI - događaji (Events) i izuzeci Bojan Tomić Događaji GUI reaguje na događaje (events) Događaj je neka akcija koju korisnik programa ili neko drugi izvrši korišćenjem perifernih uređaja (uglavnom miša

More information

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 143 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/

More information

SD Module-1 Advanced JAVA

SD Module-1 Advanced JAVA Assignment No. 4 SD Module-1 Advanced JAVA R C (4) V T Total (10) Dated Sign Title: Transform the above system from command line system to GUI based application Problem Definition: Write a Java program

More information

Osnove programskog jezika C# Čas 5. Delegati, događaji i interfejsi

Osnove programskog jezika C# Čas 5. Delegati, događaji i interfejsi Osnove programskog jezika C# Čas 5. Delegati, događaji i interfejsi DELEGATI Bezbedni pokazivači na funkcije Jer garantuju vrednost deklarisanog tipa. Prevodilac prijavljuje grešku ako pokušate da povežete

More information

SD Module-1 Advanced JAVA. Assignment No. 4

SD Module-1 Advanced JAVA. Assignment No. 4 SD Module-1 Advanced JAVA Assignment No. 4 Title :- Transform the above system from command line system to GUI based application Problem Definition: Write a Java program with the help of GUI based Application

More information

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 331 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/

More information

Programski jezik JAVA PREDAVANJE 5

Programski jezik JAVA PREDAVANJE 5 Programski jezik JAVA PREDAVANJE 5 č Svi proizvođači softverskih alata podržavaju izradu grafičkih aplikacija u njima - GUI programiranje (GUI=graphic user interface) Podrška za GUI u Javi nalazi se u

More information

Dr. Hikmat A. M. AbdelJaber

Dr. Hikmat A. M. AbdelJaber Dr. Hikmat A. M. AbdelJaber GUI are event driven (i.e. when user interacts with a GUI component, the interaction (event) derives the program to perform a task). Event: click button, type in text field,

More information

Svi Java tipovi imaju ekvivalentan tip u jeziku Scala Većina Scala koda se direktno preslikava u odgovarajući Java konstrukt

Svi Java tipovi imaju ekvivalentan tip u jeziku Scala Većina Scala koda se direktno preslikava u odgovarajući Java konstrukt Funkcionalno programiranje Interoperabilnost jezika Scala i Java Prevođenje u Java bajt kod Svi Java tipovi imaju ekvivalentan tip u jeziku Scala Većina Scala koda se direktno preslikava u odgovarajući

More information

Programski jezik JAVA PREDAVANJE

Programski jezik JAVA PREDAVANJE Programski jezik JAVA PREDAVANJE 8 2018 www.etf.ac.me Polja za potvrdu i Radio tasteri Polja za potvrdu i radio tasteri nijesu uzajamno isključivi, što znači da ako imate pet polja za potvrdu u jednom

More information

CSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 331 Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT Lecturer: Michael Hotan slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer,

More information

Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing

Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing Rui Moreira Some useful links: http://java.sun.com/docs/books/tutorial/uiswing/toc.html http://www.unix.org.ua/orelly/java-ent/jfc/

More information

Java & Graphical User Interface II. Wang Yang wyang AT njnet.edu.cn

Java & Graphical User Interface II. Wang Yang wyang AT njnet.edu.cn Java & Graphical User Interface II Wang Yang wyang AT njnet.edu.cn Outline Review of GUI (first part) What is Event Basic Elements of Event Programming Secret Weapon - Inner Class Full version of Event

More information

COMPSCI 230. Software Design and Construction. Swing

COMPSCI 230. Software Design and Construction. Swing COMPSCI 230 Software Design and Construction Swing 1 2013-04-17 Recap: SWING DESIGN PRINCIPLES 1. GUI is built as containment hierarchy of widgets (i.e. the parent-child nesting relation between them)

More information

Objektno orijentisano programiranje 2. Grafički korisnički interfejs

Objektno orijentisano programiranje 2. Grafički korisnički interfejs Objektno orijentisano programiranje 2 Uvod je karakteristika gotovo svih savremenih aplikacija Termin na engleskom: Graphical User Interface (GUI) GUI je vezan za rad sa prozorima: izlazni podaci se prikazuju

More information

14.2 Java s New Nimbus Look-and-Feel 551 Sample GUI: The SwingSet3 Demo Application As an example of a GUI, consider Fig. 14.1, which shows the SwingS

14.2 Java s New Nimbus Look-and-Feel 551 Sample GUI: The SwingSet3 Demo Application As an example of a GUI, consider Fig. 14.1, which shows the SwingS 550 Chapter 14 GUI Components: Part 1 14.1 Introduction 14.2 Java s New Nimbus Look-and-Feel 14.3 Simple GUI-Based Input/Output with JOptionPane 14.4 Overview of Swing Components 14.5 Displaying Text and

More information

Packages: Putting Classes Together

Packages: Putting Classes Together Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic

More information

Osnove programskog jezika C# Čas 4. Nasledjivanje 2. deo

Osnove programskog jezika C# Čas 4. Nasledjivanje 2. deo Osnove programskog jezika C# Čas 4. Nasledjivanje 2. deo Nasledjivanje klasa Modifikator new class A { public virtual void F() { Console.WriteLine("I am A"); } } class B : A { public override void F()

More information

Table of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...

Table of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7... Table of Contents Chapter 1 Getting Started with Java SE 7 1 Introduction of Java SE 7... 2 Exploring the Features of Java... 3 Exploring Features of Java SE 7... 4 Introducing Java Environment... 5 Explaining

More information

CSS CSS. selector { property: value; } 3/20/2018. CSS: Cascading Style Sheets

CSS CSS. selector { property: value; } 3/20/2018. CSS: Cascading Style Sheets CSS CSS CSS: Cascading Style Sheets - Opisuje izgled (appearance) i raspored (layout) stranice - Sastoji se od CSS pravila, koji defini[u skup stilova selector { property: value; 1 Font face: font-family

More information

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by

More information

Systems Programming Graphical User Interfaces

Systems Programming Graphical User Interfaces Systems Programming Graphical User Interfaces Julio Villena Román (LECTURER) CONTENTS ARE MOSTLY BASED ON THE WORK BY: José Jesús García Rueda Systems Programming GUIs based on Java

More information

Graphical User Interfaces in Java - SWING

Graphical User Interfaces in Java - SWING Graphical User Interfaces in Java - SWING Graphical User Interfaces (GUI) Each graphical component that the user can see on the screen corresponds to an object of a class Component: Window Button Menu...

More information

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling Handout 12 CS603 Object-Oriented Programming Fall 15 Page 1 of 12 Handout 14 Graphical User Interface (GUI) with Swing, Event Handling The Swing library (javax.swing.*) Contains classes that implement

More information

Previously, we have seen GUI components, their relationships, containers, layout managers. Now we will see how to paint graphics on GUI components

Previously, we have seen GUI components, their relationships, containers, layout managers. Now we will see how to paint graphics on GUI components CS112-Section2 Hakan Guldas Burcin Ozcan Meltem Kaya Muge Celiktas Notes of 6-8 May Graphics Previously, we have seen GUI components, their relationships, containers, layout managers. Now we will see how

More information

GUI Design. Overview of Part 1 of the Course. Overview of Java GUI Programming

GUI Design. Overview of Part 1 of the Course. Overview of Java GUI Programming GUI Design Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu /~spring Overview of Part 1 of the Course Demystifying

More information

Course Status Networking GUI Wrap-up. CS Java. Introduction to Java. Andy Mroczkowski

Course Status Networking GUI Wrap-up. CS Java. Introduction to Java. Andy Mroczkowski CS 190 - Java Introduction to Java Andy Mroczkowski uamroczk@cs.drexel.edu Department of Computer Science Drexel University March 10, 2008 / Lecture 8 Outline Course Status Course Information & Schedule

More information

The AWT Event Model 9

The AWT Event Model 9 The AWT Event Model 9 Course Map This module covers the event-based GUI user input mechanism. Getting Started The Java Programming Language Basics Identifiers, Keywords, and Types Expressions and Flow

More information

11/7/12. Discussion of Roulette Assignment. Objectives. Compiler s Names of Classes. GUI Review. Window Events

11/7/12. Discussion of Roulette Assignment. Objectives. Compiler s Names of Classes. GUI Review. Window Events Objectives Event Handling Animation Discussion of Roulette Assignment How easy/difficult to refactor for extensibility? Was it easier to add to your refactored code? Ø What would your refactored classes

More information

Chapter 6: Graphical User Interfaces

Chapter 6: Graphical User Interfaces Chapter 6: Graphical User Interfaces CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 6: Graphical User Interfaces CS 121 1 / 36 Chapter 6 Topics

More information

user-friendly and easy to use.

user-friendly and easy to use. Java Graphic User Interface GUI Basic Dr. Umaporn Supasitthimethee Computer Programming II -2- Java GUI A graphical user interface (GUI) makes a system user-friendly and easy to use. Creating a GUI requires

More information

Programiranje III razred

Programiranje III razred Tehnička škola 9. maj Bačka Palanka Programiranje III razred Naredbe ciklusa for petlja Naredbe ciklusa Veoma često se ukazuje potreba za ponavljanjem nekih naredbi više puta tj. za ponavljanjem nekog

More information

GUI Programming: Swing and Event Handling

GUI Programming: Swing and Event Handling GUI Programming: Swing and Event Handling Sara Sprenkle 1 Announcements No class next Tuesday My Fourth of July present to you: No quiz! Assignment 3 due today Review Collections: List, Set, Map Inner

More information

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Starting Out with Java: From Control Structures Through Objects Sixth Edition Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes

More information

Java AWT Windows, Text, & Graphics

Java AWT Windows, Text, & Graphics 2 AWT Java AWT Windows, Text, & Graphics The Abstract Windows Toolkit (AWT) contains numerous classes and methods that allow you to create and manage applet windows and standard windows that run in a GUI

More information

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7 PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,

More information

VB komande. Programiranje 1

VB komande. Programiranje 1 VB komande Programiranje 1 Zadatak 1: Sastaviti program koji se sastoji iz jedne ListBox kontrole, jedne Textbox kontrole i dva komandna dugmeta. Klikom na prvo komandno dugme umeće se u ListBox sadržaj

More information

VRIJEDNOSTI ATRIBUTA

VRIJEDNOSTI ATRIBUTA VRIJEDNOSTI ATRIBUTA Svaki atribut (bilo da je primarni ključ, vanjski ključ ili običan atribut) može i ne mora imati ograničenja na svojim vrijednostima. Neka od ograničenja nad atributima: Null / Not

More information

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Frames, GUI and events Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Introduction to Swing The Java AWT (Abstract Window Toolkit)

More information

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

Graphics. Lecture 18 COP 3252 Summer June 6, 2017 Graphics Lecture 18 COP 3252 Summer 2017 June 6, 2017 Graphics classes In the original version of Java, graphics components were in the AWT library (Abstract Windows Toolkit) Was okay for developing simple

More information

Graphical User Interfaces (GUIs)

Graphical User Interfaces (GUIs) CMSC 132: Object-Oriented Programming II Graphical User Interfaces (GUIs) Department of Computer Science University of Maryland, College Park Model-View-Controller (MVC) Model for GUI programming (Xerox

More information

Graphical User Interfaces. Comp 152

Graphical User Interfaces. Comp 152 Graphical User Interfaces Comp 152 Procedural programming Execute line of code at a time Allowing for selection and repetition Call one function and then another. Can trace program execution on paper from

More information

Graphic User Interfaces. - GUI concepts - Swing - AWT

Graphic User Interfaces. - GUI concepts - Swing - AWT Graphic User Interfaces - GUI concepts - Swing - AWT 1 What is GUI Graphic User Interfaces are used in programs to communicate more efficiently with computer users MacOS MS Windows X Windows etc 2 Considerations

More information

Učitati cio broj n i štampati njegovu recipročnu vrijednost. Ako je učitan broj 0, štampati 1/0.

Učitati cio broj n i štampati njegovu recipročnu vrijednost. Ako je učitan broj 0, štampati 1/0. Kontrolne naredbe Primjeri: Opšti oblik razgranate strukture (if sa ) if (uslov) Naredba 1 ili blok naredbi1 Naredba 2 ili blok naredbi2 Učitati broj x i štampati vrijednost double x, z; Scanner in=new

More information

MIT AITI Swing Event Model Lecture 17

MIT AITI Swing Event Model Lecture 17 MIT AITI 2004 Swing Event Model Lecture 17 The Java Event Model In the last lecture, we learned how to construct a GUI to present information to the user. But how do GUIs interact with users? How do applications

More information

Jonathan Aldrich Charlie Garrod

Jonathan Aldrich Charlie Garrod Principles of Software Construction: Objects, Design, and Concurrency (Part 3: Design Case Studies) Introduction to GUIs Jonathan Aldrich Charlie Garrod School of Computer Science 1 Administrivia Homework

More information

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing. COSC User Interfaces Module 3 Sequential vs. Event-driven Programming Example Programs DemoLargestConsole.java DemoLargestGUI.java Demo programs will be available on the course web page. GUI Program Organization

More information

Graphical User Interfaces. Swing. Jose Jesus García Rueda

Graphical User Interfaces. Swing. Jose Jesus García Rueda Graphical User Interfaces. Swing Jose Jesus García Rueda Introduction What are the GUIs? Well known examples Basic concepts Graphical application. Containers. Actions. Events. Graphical elements: Menu

More information

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline Sequential vs. Event-driven Programming Reacting to the user GUI Program Organization Let s digress briefly to examine the organization of our GUI programs We ll do this in stages, by examining three example

More information

Window Interfaces Using Swing Objects

Window Interfaces Using Swing Objects Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs

More information

Advanced Java Programming (17625) Event Handling. 20 Marks

Advanced Java Programming (17625) Event Handling. 20 Marks Advanced Java Programming (17625) Event Handling 20 Marks Specific Objectives To write event driven programs using the delegation event model. To write programs using adapter classes & the inner classes.

More information

Programming Mobile Devices J2SE GUI

Programming Mobile Devices J2SE GUI Programming Mobile Devices J2SE GUI University of Innsbruck WS 2009/2010 thomas.strang@sti2.at Graphical User Interface (GUI) Why is there more than one Java GUI toolkit? AWT write once, test everywhere

More information

Java. GUI building with the AWT

Java. GUI building with the AWT Java GUI building with the AWT AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore

More information

Introduction to GUIs. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2014

Introduction to GUIs. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2014 Introduction to GUIs Principles of Software Construction: Objects, Design, and Concurrency Jonathan Aldrich and Charlie Garrod Fall 2014 Slides copyright 2014 by Jonathan Aldrich, Charlie Garrod, Christian

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 32 April 9, 2018 Swing I: Drawing and Event Handling Chapter 29 HW8: Spellchecker Available on the web site Due: Tuesday! Announcements Parsing, working

More information

Događaj koji se javlja u toku izvršenja programa i kvari normalno izvršenje. Kada se desi izuzetak, sistem pokušava da pronađe način da ga obradi.

Događaj koji se javlja u toku izvršenja programa i kvari normalno izvršenje. Kada se desi izuzetak, sistem pokušava da pronađe način da ga obradi. Obrada izuzetaka Šta je izuzetak? Događaj koji se javlja u toku izvršenja programa i kvari normalno izvršenje. Kada se desi izuzetak, sistem pokušava da pronađe način da ga obradi. Prosleđuje izuzetak,

More information

Interacción con GUIs

Interacción con GUIs Interacción con GUIs Delegation Event Model Fuente EVENTO Oyente suscripción Fuente Oyente suscripción EVENTO Adaptador EVENTO java.lang.object java.util.eventobject java.awt.awtevent java.awt.event. ActionEvent

More information

import java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 {

import java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 { import java.awt.color; import java.awt.flowlayout; import java.awt.font; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton;

More information

Parts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions.

Parts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions. Parts of a Contract Syntax - Method signature Method name Parameter list Return type Semantics - Comments Preconditions: requirements placed on the caller Postconditions: what the method modifies and/or

More information

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13 CONTENTS Chapter 1 Getting Started with Java SE 6 1 Introduction of Java SE 6... 3 Desktop Improvements... 3 Core Improvements... 4 Getting and Installing Java... 5 A Simple Java Program... 10 Compiling

More information

GUI in Java TalentHome Solutions

GUI in Java TalentHome Solutions GUI in Java TalentHome Solutions AWT Stands for Abstract Window Toolkit API to develop GUI in java Has some predefined components Platform Dependent Heavy weight To use AWT, import java.awt.* Calculator

More information

Graphical User Interface (GUI) and Object- Oriented Design (OOD)

Graphical User Interface (GUI) and Object- Oriented Design (OOD) Chapter 6,13 Graphical User Interface (GUI) and Object- Oriented Design (OOD) Objectives To distinguish simple GUI components. To describe the Java GUI API hierarchy. To create user interfaces using frames,

More information

Module 4 Multi threaded Programming, Event Handling. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Module 4 Multi threaded Programming, Event Handling. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Module 4 Multi threaded Programming, Event Handling OOC 4 th Sem, B Div 2017-18 Prof. Mouna M. Naravani Event Handling Complete Reference 7 th ed. Chapter No. 22 Event Handling Any program that uses a

More information

CSEN401 Computer Programming Lab. Topics: Graphical User Interface Window Interfaces using Swing

CSEN401 Computer Programming Lab. Topics: Graphical User Interface Window Interfaces using Swing CSEN401 Computer Programming Lab Topics: Graphical User Interface Window Interfaces using Swing Prof. Dr. Slim Abdennadher 22.3.2015 c S. Abdennadher 1 Swing c S. Abdennadher 2 AWT versus Swing Two basic

More information

GUI DYNAMICS Lecture July 26 CS2110 Summer 2011

GUI DYNAMICS Lecture July 26 CS2110 Summer 2011 GUI DYNAMICS Lecture July 26 CS2110 Summer 2011 GUI Statics and GUI Dynamics 2 Statics: what s drawn on the screen Components buttons, labels, lists, sliders, menus,... Containers: components that contain

More information

BM214E Object Oriented Programming Lecture 13

BM214E Object Oriented Programming Lecture 13 BM214E Object Oriented Programming Lecture 13 Events To understand how events work in Java, we have to look closely at how we use GUIs. When you interact with a GUI, there are many events taking place

More information

Together, the appearance and how user interacts with the program are known as the program look and feel.

Together, the appearance and how user interacts with the program are known as the program look and feel. Lecture 10 Graphical User Interfaces A graphical user interface is a visual interface to a program. GUIs are built from GUI components (buttons, menus, labels etc). A GUI component is an object with which

More information

CompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons

CompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons CompSci 125 Lecture 17 GUI: Graphics, Check Boxes, Radio Buttons Announcements GUI Review Review: Inheritance Subclass is a Parent class Includes parent s features May Extend May Modify extends! Parent

More information

PREDMET. Osnove Java Programiranja. Čas JAVADOC

PREDMET. Osnove Java Programiranja. Čas JAVADOC PREDMET Osnove Java Programiranja JAVADOC Copyright 2010 UNIVERZITET METROPOLITAN, Beograd. Sva prava zadržana. Bez prethodne pismene dozvole od strane Univerziteta METROPOLITAN zabranjena je reprodukcija,

More information

Java Swing. Recitation 11/(20,21)/2008. CS 180 Department of Computer Science, Purdue University

Java Swing. Recitation 11/(20,21)/2008. CS 180 Department of Computer Science, Purdue University Java Swing Recitation 11/(20,21)/2008 CS 180 Department of Computer Science, Purdue University Announcements Project 8 is out Milestone due on Dec 3rd, 10:00 pm Final due on Dec 10th, 10:00 pm No classes,

More information

Izrada VI laboratorijske vježbe

Izrada VI laboratorijske vježbe Izrada VI laboratorijske vježbe 1. Programirati proceduru koja se aktivira sa Standard palete alatki klikom na button Fajlovi. Prilikom startovanja procedure prikazuje se forma koja sadrži jedan list box

More information

Window Interfaces Using Swing Objects

Window Interfaces Using Swing Objects Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs

More information

Swing from A to Z Some Simple Components. Preface

Swing from A to Z Some Simple Components. Preface By Richard G. Baldwin baldwin.richard@iname.com Java Programming, Lecture Notes # 1005 July 31, 2000 Swing from A to Z Some Simple Components Preface Introduction Sample Program Interesting Code Fragments

More information

Basicsof. JavaGUI and SWING

Basicsof. JavaGUI and SWING Basicsof programming3 JavaGUI and SWING GUI basics Basics of programming 3 BME IIT, Goldschmidt Balázs 2 GUI basics Mostly window-based applications Typically based on widgets small parts (buttons, scrollbars,

More information

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming

More information

Agenda. Container and Component

Agenda. Container and Component Agenda Types of GUI classes/objects Step-by-step guide to create a graphic user interface Step-by-step guide to event-handling PS5 Problem 1 PS5 Problem 2 Container and Component There are two types of

More information

G51PRG: Introduction to Programming Second semester Applets and graphics

G51PRG: Introduction to Programming Second semester Applets and graphics G51PRG: Introduction to Programming Second semester Applets and graphics Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk Previous two lectures AWT and Swing Creating components and putting

More information

Datenbank-Praktikum. Universität zu Lübeck Sommersemester 2006 Lecture: Swing. Ho Ngoc Duc 1

Datenbank-Praktikum. Universität zu Lübeck Sommersemester 2006 Lecture: Swing. Ho Ngoc Duc 1 Datenbank-Praktikum Universität zu Lübeck Sommersemester 2006 Lecture: Swing Ho Ngoc Duc 1 Learning objectives GUI applications Font, Color, Image Running Applets as applications Swing Components q q Text

More information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction to the JAVA UI classes Advanced HCI IAT351 Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing

More information

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming Objectives: Last revised 1/15/10 1. To introduce the notion of a component and some basic Swing components (JLabel, JTextField, JTextArea,

More information

Introduction to concurrency and GUIs

Introduction to concurrency and GUIs Principles of Software Construction: Objects, Design, and Concurrency Part 2: Designing (Sub)systems Introduction to concurrency and GUIs Charlie Garrod Bogdan Vasilescu School of Computer Science 1 Administrivia

More information

UPUTSTVO ZA KORIŠĆENJE NOVOG SPINTER WEBMAIL-a

UPUTSTVO ZA KORIŠĆENJE NOVOG SPINTER WEBMAIL-a UPUTSTVO ZA KORIŠĆENJE NOVOG SPINTER WEBMAIL-a Webmail sistem ima podršku za SSL (HTTPS). Korištenjem ovog protokola sva komunikacija između Webmail sistema i vašeg Web čitača je kriptovana. Prilikom pristupa

More information

Programiranje Programski jezik C. Sadržaj. Datoteke. prof.dr.sc. Ivo Ipšić 2009/2010

Programiranje Programski jezik C. Sadržaj. Datoteke. prof.dr.sc. Ivo Ipšić 2009/2010 Programiranje Programski jezik C prof.dr.sc. Ivo Ipšić 2009/2010 Sadržaj Ulazno-izlazne funkcije Datoteke Formatirane datoteke Funkcije za rad s datotekama Primjeri Datoteke komunikacija između programa

More information

2010 가을학기부산대학교정보컴퓨터공학부 OVERVIEW OF GUI PROGRAMMING

2010 가을학기부산대학교정보컴퓨터공학부 OVERVIEW OF GUI PROGRAMMING 2010 가을학기부산대학교정보컴퓨터공학부 OVERVIEW OF GUI PROGRAMMING Outline Graphic User Interface (GUI) Introduction AWT and Swing Graphics Programming Event Handling User Interface Components with Swing 2 Graphic User

More information

Uputstvo za korišćenje logrotate funkcije

Uputstvo za korišćenje logrotate funkcije Copyright AMRES Sadržaj Uvod 3 Podešavanja logrotate konfiguracionog fajla 4 Strana 2 od 5 Uvod Ukoliko je aktivirano logovanje za RADIUS proces, može se desiti da posle određenog vremena server bude preopterećen

More information

Advanced Java Programming. Swing. Introduction to Swing. Swing libraries. Eran Werner, Tel-Aviv University Summer, 2005

Advanced Java Programming. Swing. Introduction to Swing. Swing libraries. Eran Werner, Tel-Aviv University Summer, 2005 Advanced Java Programming Swing Eran Werner, Tel-Aviv University Summer, 2005 19 May 2005 Advanced Java Programming, Summer 2005 1 Introduction to Swing The Swing package is part of the Java Foundation

More information

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"

More information

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun! Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques

More information

b) program deljiv3; uses wincrt; var i:integer; begin i:=3; while i<100 do begin write(i:5); i:=i+3; end; end.

b) program deljiv3; uses wincrt; var i:integer; begin i:=3; while i<100 do begin write(i:5); i:=i+3; end; end. NAREDBA CIKLUSA SA PREDUSLOVOM WHILE 1.Odrediti vrednosti s i p nakon izvrsenja sledecih naredbi za dato a=43, a=34, a=105 program p1; var a,s,p:integer; write('unesite a:');readln(a); p:=a; s:=0; while

More information

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in Lab 4 D0010E Object-Oriented Programming and Design Lecture 9 Lab 4: You will implement a game that can be played over the Internet. The networking part has already been written. Among other things, the

More information

Java: Graphical User Interfaces (GUI)

Java: Graphical User Interfaces (GUI) Chair of Software Engineering Carlo A. Furia, Marco Piccioni, and Bertrand Meyer Java: Graphical User Interfaces (GUI) With material from Christoph Angerer The essence of the Java Graphics API Application

More information

Graphical interfaces & event-driven programming

Graphical interfaces & event-driven programming Graphical interfaces & event-driven programming Lecture 12 of TDA 540 (Objektorienterad Programmering) Carlo A. Furia Alex Gerdes Chalmers University of Technology Gothenburg University Fall 2017 Pop quiz!

More information

Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science

Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science mluckner@mini.pw.edu.pl http://www.mini.pw.edu.pl/~lucknerm } Abstract Window Toolkit Delegates creation and

More information

Računarske osnove Interneta (SI3ROI, IR4ROI)

Računarske osnove Interneta (SI3ROI, IR4ROI) Računarske osnove terneta (SI3ROI, IR4ROI) Vežbe MPLS Predavač: 08.11.2011. Dražen Drašković, drazen.draskovic@etf.rs Autori: Dražen Drašković Naučili ste na predavanjima MPLS (Multi-Protocol Label Switching)

More information

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright GUI Basics Object Orientated Programming in Java Benjamin Kenwright Outline Essential Graphical User Interface (GUI) Concepts Libraries, Implementation, Mechanics,.. Abstract Windowing Toolkit (AWT) Java

More information

Introduction. Introduction

Introduction. Introduction Introduction Many Java application use a graphical user interface or GUI (pronounced gooey ). A GUI is a graphical window or windows that provide interaction with the user. GUI s accept input from: the

More information

Programske paradigme Funkcionalna paradigma

Programske paradigme Funkcionalna paradigma Programske paradigme Funkcionalna paradigma 1. čas: Uvod u funkcionalno programiranje. Programski jezik Haskel. Upoznavanje sa razvojnim okruženjem. Tipovi podataka. Funkcionalno programiranje Stil u programiranju

More information

Swing. By Iqtidar Ali

Swing. By Iqtidar Ali Swing By Iqtidar Ali Background of Swing We have been looking at AWT (Abstract Window ToolKit) components up till now. Programmers were not comfortable when doing programming with AWT. Bcoz AWT is limited

More information

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver Building a GUI in Java with Swing CITS1001 extension notes Rachel Cardell-Oliver Lecture Outline 1. Swing components 2. Building a GUI 3. Animating the GUI 2 Swing A collection of classes of GUI components

More information

Vežbe - XII nedelja PHP Doc

Vežbe - XII nedelja PHP Doc Vežbe - XII nedelja PHP Doc Dražen Drašković, asistent Elektrotehnički fakultet Univerziteta u Beogradu Verzija alata JavaDoc za programski jezik PHP Standard za komentarisanje PHP koda Omogućava generisanje

More information