Enviar pesquisa
Carregar
15a gui
•
Transferir como PPTX, PDF
•
0 gostou
•
385 visualizações
P
Program in Interdisciplinary Computing
Seguir
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 10
Baixar agora
Recomendados
H.W 2
H.W 2
Ahmed Metwalli
Java Event Handling
Java Event Handling
Shraddha
Swing
Swing
Nataraj Dg
Python keyboard and mouse events
Python keyboard and mouse events
Ahmed Alyazji
Lecture8 oopj
Lecture8 oopj
Dhairya Joshi
Mac OS Lion Tips and Tricks
Mac OS Lion Tips and Tricks
Mike Glennon
Ordenara los vectores
Ordenara los vectores
Israel JD
Programming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI Application
Mahmoud Samir Fayed
Recomendados
H.W 2
H.W 2
Ahmed Metwalli
Java Event Handling
Java Event Handling
Shraddha
Swing
Swing
Nataraj Dg
Python keyboard and mouse events
Python keyboard and mouse events
Ahmed Alyazji
Lecture8 oopj
Lecture8 oopj
Dhairya Joshi
Mac OS Lion Tips and Tricks
Mac OS Lion Tips and Tricks
Mike Glennon
Ordenara los vectores
Ordenara los vectores
Israel JD
Programming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI Application
Mahmoud Samir Fayed
Lecture 8.pdf
Lecture 8.pdf
SakhilejasonMsibi
Enhance the ButtonViewer program so that it prints the time at which t.docx
Enhance the ButtonViewer program so that it prints the time at which t.docx
todd401
10 awt event model
10 awt event model
Bayarkhuu
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptx
MattFlordeliza1
Multimedia lecture ActionScript3
Multimedia lecture ActionScript3
Mohammed Hussein
Chapter 11.5
Chapter 11.5
sotlsoc
Androd Listeners
Androd Listeners
ksheerod shri toshniwal
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
suraj pandey
Event Handling in java
Event Handling in java
Google
Introduction to GUIs with guizero
Introduction to GUIs with guizero
primeteacher32
3.4 events and interactivity
3.4 events and interactivity
allenbailey
Actionscript 3 - Session 2 Getting Started Flash IDE
Actionscript 3 - Session 2 Getting Started Flash IDE
OUM SAOKOSAL
event handling new.ppt
event handling new.ppt
usama537223
Keyboard and mouse events in python
Keyboard and mouse events in python
mal6ayer
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2
PRN USM
Event Handling in JAVA
Event Handling in JAVA
Srajan Shukla
Mobile Application Development
Mobile Application Development
Muhammad Sajid
What is Event
What is Event
Asmita Prasad
Java Swing JFC
Java Swing JFC
Sunil OS
CORE JAVA-2
CORE JAVA-2
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
Phpmysqlcoding
Phpmysqlcoding
Program in Interdisciplinary Computing
Database basics
Database basics
Program in Interdisciplinary Computing
Mais conteúdo relacionado
Semelhante a 15a gui
Lecture 8.pdf
Lecture 8.pdf
SakhilejasonMsibi
Enhance the ButtonViewer program so that it prints the time at which t.docx
Enhance the ButtonViewer program so that it prints the time at which t.docx
todd401
10 awt event model
10 awt event model
Bayarkhuu
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptx
MattFlordeliza1
Multimedia lecture ActionScript3
Multimedia lecture ActionScript3
Mohammed Hussein
Chapter 11.5
Chapter 11.5
sotlsoc
Androd Listeners
Androd Listeners
ksheerod shri toshniwal
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
suraj pandey
Event Handling in java
Event Handling in java
Google
Introduction to GUIs with guizero
Introduction to GUIs with guizero
primeteacher32
3.4 events and interactivity
3.4 events and interactivity
allenbailey
Actionscript 3 - Session 2 Getting Started Flash IDE
Actionscript 3 - Session 2 Getting Started Flash IDE
OUM SAOKOSAL
event handling new.ppt
event handling new.ppt
usama537223
Keyboard and mouse events in python
Keyboard and mouse events in python
mal6ayer
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2
PRN USM
Event Handling in JAVA
Event Handling in JAVA
Srajan Shukla
Mobile Application Development
Mobile Application Development
Muhammad Sajid
What is Event
What is Event
Asmita Prasad
Java Swing JFC
Java Swing JFC
Sunil OS
CORE JAVA-2
CORE JAVA-2
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
Semelhante a 15a gui
(20)
Lecture 8.pdf
Lecture 8.pdf
Enhance the ButtonViewer program so that it prints the time at which t.docx
Enhance the ButtonViewer program so that it prints the time at which t.docx
10 awt event model
10 awt event model
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptx
Multimedia lecture ActionScript3
Multimedia lecture ActionScript3
Chapter 11.5
Chapter 11.5
Androd Listeners
Androd Listeners
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
Event Handling in java
Event Handling in java
Introduction to GUIs with guizero
Introduction to GUIs with guizero
3.4 events and interactivity
3.4 events and interactivity
Actionscript 3 - Session 2 Getting Started Flash IDE
Actionscript 3 - Session 2 Getting Started Flash IDE
event handling new.ppt
event handling new.ppt
Keyboard and mouse events in python
Keyboard and mouse events in python
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2
Event Handling in JAVA
Event Handling in JAVA
Mobile Application Development
Mobile Application Development
What is Event
What is Event
Java Swing JFC
Java Swing JFC
CORE JAVA-2
CORE JAVA-2
Mais de Program in Interdisciplinary Computing
Phpmysqlcoding
Phpmysqlcoding
Program in Interdisciplinary Computing
Database basics
Database basics
Program in Interdisciplinary Computing
CGS2835 HTML5
CGS2835 HTML5
Program in Interdisciplinary Computing
Mysocial databasequeries
Mysocial databasequeries
Program in Interdisciplinary Computing
Mysocial databasequeries
Mysocial databasequeries
Program in Interdisciplinary Computing
CGS2835 HTML5
CGS2835 HTML5
Program in Interdisciplinary Computing
01 intro tousingjava
01 intro tousingjava
Program in Interdisciplinary Computing
Web architecture v3
Web architecture v3
Program in Interdisciplinary Computing
Xhtml
Xhtml
Program in Interdisciplinary Computing
Webdev
Webdev
Program in Interdisciplinary Computing
Web architecture
Web architecture
Program in Interdisciplinary Computing
Sdlc
Sdlc
Program in Interdisciplinary Computing
Mysocial
Mysocial
Program in Interdisciplinary Computing
Javascript
Javascript
Program in Interdisciplinary Computing
Javascript
Javascript
Program in Interdisciplinary Computing
Html5
Html5
Program in Interdisciplinary Computing
Frameworks
Frameworks
Program in Interdisciplinary Computing
Drupal
Drupal
Program in Interdisciplinary Computing
Database
Database
Program in Interdisciplinary Computing
Javascript2
Javascript2
Program in Interdisciplinary Computing
Mais de Program in Interdisciplinary Computing
(20)
Phpmysqlcoding
Phpmysqlcoding
Database basics
Database basics
CGS2835 HTML5
CGS2835 HTML5
Mysocial databasequeries
Mysocial databasequeries
Mysocial databasequeries
Mysocial databasequeries
CGS2835 HTML5
CGS2835 HTML5
01 intro tousingjava
01 intro tousingjava
Web architecture v3
Web architecture v3
Xhtml
Xhtml
Webdev
Webdev
Web architecture
Web architecture
Sdlc
Sdlc
Mysocial
Mysocial
Javascript
Javascript
Javascript
Javascript
Html5
Html5
Frameworks
Frameworks
Drupal
Drupal
Database
Database
Javascript2
Javascript2
15a gui
1.
Getting GUI! LIS4930
© PIC
2.
It All Starts
With A Window LIS4930 © PIC A JFrame is the object that represents a window on the screen.
3.
Put Widgets in
the Window LIS4930 © PIC Once you have a JFrame, you can put things (‘widgets’) in it by adding them to the JFrame. The most common include JButton, JRadioButton, JLable, JList, JScrollButton, JSlider, JTextField, and JTable. Look at the javax.swing package for more widgets.
4.
Four Steps to
Creating a GUI LIS4930 © PIC 1 2 3 4 Make a frame (JFrame) JFrame frame = new JFrame( ); Make a widget (button, text field, etc.) Jbutton Button = new JButton(“Click Me”); Add a widget to the frame frame.getContentPane( ).add(Button); Display it (give it a size and make it visible) frame.setSize(300, 300); frame.setVisible(true); DEMO TIME
5.
Clicking the Button
Doesn’t do Anything!!!! LIS4930 © PIC How do I get the button to do something specific when the user clicks it? 1 2 A METHOD to be called when the user clicks A way to KNOW when the user clicks We Need To Know Two Things
6.
How To Know
When The User Clicks LIS4930 © PIC In Java, the process of getting and handling a user event is called event-handling. If you care about the button’s events, implement an interface that says, “I’m listening for your events”. A listener interface is the bridge between the listener (you) and the event source (the button) An event source (like the button) creates an event object when the user does something that matters (like click the button). Every event type has a matching listener interface. If you want MouseEvents, implement the MouseListener interface. Want WindowEvents, implement WindowListener. You get the idea.
7.
How the Listener
and Source Communicate The Listener First tell the button you are listening to it by calling its addActionListener(this) method and giving it a reference to the ActionListener (in this case it is you “this”) As an ActionListener you MUST implement the ActionListener interface and its only method, actionPerformed( ). The Event Source Each of the interested ActionListeners are stored in a list by the button and when the event occurs, the button calls all the actionPerformed( ) methods of the ActionListeners. LIS4930 © PIC
8.
Getting a Button’s
ActionEvent LIS4930 © PIC 1 2 3 Implement the ActionListener interface Register with the button (tell it you want to listen for events) Define the event-handling method (implement the actionPerformed( ) method from the ActionListener interface)
9.
Listening to the
Button. LIS4930 © PIC DEMO TIME
10.
Getting back to
graphics… LIS4930 © PIC There are three ways to put things on a GUI. 1 2 3 Put widgets on a frame Add buttons, menus, radio buttons, etc. frame.getContentPane( ).add(myButton); Draw 2D graphics on a widget Use a graphics object to paint shapes graphics.fillOval(70,70,100,100); Put a JPEG on a widget You can put your own images on a widget graphics.drawImage(myPic,10,10,this);
Baixar agora