SlideShare uma empresa Scribd logo
1 de 17
Developing User Interfaces
         (DUI)

         Chris North
        cs3724: HCI
GUI Development: Goals
1. Learn general GUI programming concepts
      •    GUI components
      •    Layout
      •    Event-based programming
      •    Graphics
      •    Animation
2. Learn Java
      •    Swing
      •    Layout managers
      •    Listerners
      •    2D graphics
      •    Threads


Then: can learn other languages quickly
      •    VB, C#, Xwin, Java 49
Intro to Java
Why Java?
Java materials
• Java 2 = sdk 1.2 or better
     • http://java.sun.com/j2se/
• Documentation:
     • http://java.sun.com/docs/
     • Tutorials, reference, API


• Borland JBuilder 6
     • http://www.borland.com/jbuilder/personal/
     • Free! Cross between VB and VC++
Java differences
•   Basic statements identical to C++
•   Object-oriented only!
•   No .h files
•   main() is inside a class
•   No global variables
•   No pointers (object references only)
•   No delete: automatic garbage collection
•   Single inheritance only, “interfaces”
•   Applet/application
•   GUI: AWT, Swing
•   Packaging
•   Error Handling, exceptions (try, catch)
        • E.g. Array bounds checking
• Security
• Components: beans
Java compiling
• Code:
     • hello.java   (text file)
• Compile:
     • javac hello.java
     • Creates: hello.class (byte code)
• Run:
     • java hello
     • Java virtual machine, interpets/compiles (machine code)
• Packaging: jar
• Or use JBuilder, like VC++
Java Applications
• Run from command line
• hello.java:
class hello {
  public static void main(String[] args){
     System.out.println(“Hello World!”);
  }
}


• javac hello.java
• java hello
Hello World!
Typically create objects
• hello.java:
class hello {
  public static void main(String[] args){
     // Create and use objects
     hello h = new hello();
     …
  }
  public hello(){ // Constructor
     …
  }
  …
}
Many Classes
• Compile each separately
• Can be main( ) in any/all classes
• hello.java:
class hello {
  goodbye g;
  public static void main(String[] args){
  …
}
• goodbye.java:
class goodbye {
  public static void main(String[] args){
  …
}
Hmmm…
• dir
hello.class
goodbye.class
blah.class
foo.class
bar.class
areyouawakein.class
• Java ???
• RunMe.bat:
java hello
JBuilder
Java Applets
• Run in a web browser
• hello.java:
import javax.swing.*;
class hello extends JApplet {
  public void init(){
     getContentPane().add(
          new JLabel(“Hello World!”) );
  }
}
• javac hello.java
                                     Hello World!
• appletviewer hello
Java Applets in HTML
• hello.html:
<html><body>
<applet code=“hello.class”
  height=100 width=200>
Need java.
</applet>
</body></html>
                                hello.html



• Put hello.html and
  hello.class on website
                             Hello World!
• Java plug-in
Applet Methods
•   init( ) - initialization
•   start( ) - resume processing (e.g. animations)
•   stop( ) - pause
•   destroy( )     - cleanup
•   paint( ) - redraw stuff (‘expose’ event)
Applet Security
•   No read/write on client machine
•   Can’t execute programs on client machine
•   Communicate only with server
•   “Java applet window” Warning

• Certificates
Upcoming Java Topics
•   GUIs: Swing, AWT, MVC
•   Event handling, listeners
•   Graphics
•   Animation, threads
•   Components, JavaBeans
•   Databases, JDBC

Mais conteúdo relacionado

Mais procurados

Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVAKUNAL GADHIA
 
Core Java Tutorial
Core Java TutorialCore Java Tutorial
Core Java TutorialJava2Blog
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming Saravanakumar R
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)Sujit Majety
 
Introduction to java
Introduction to java Introduction to java
Introduction to java Java Lover
 
Java Presentation
Java PresentationJava Presentation
Java Presentationpm2214
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaAjay Sharma
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART IOXUS 20
 
Java introduction
Java introductionJava introduction
Java introductionSagar Verma
 
Advanced programming ch1
Advanced programming ch1Advanced programming ch1
Advanced programming ch1Gera Paulos
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryOXUS 20
 

Mais procurados (20)

04b swing tutorial
04b swing tutorial04b swing tutorial
04b swing tutorial
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
 
Core Java Tutorial
Core Java TutorialCore Java Tutorial
Core Java Tutorial
 
Learn Java Part 1
Learn Java Part 1Learn Java Part 1
Learn Java Part 1
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java. converted (2)
Java. converted (2)Java. converted (2)
Java. converted (2)
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
 
Java introduction
Java introductionJava introduction
Java introduction
 
Java introduction
Java introductionJava introduction
Java introduction
 
Advanced programming ch1
Advanced programming ch1Advanced programming ch1
Advanced programming ch1
 
Java basic introduction
Java basic introductionJava basic introduction
Java basic introduction
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – Theory
 

Semelhante a java swing

basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operatorkamal kotecha
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OSbenko
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Anton Arhipov
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)jeresig
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsFabian Jakobs
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
ITFT - Java Coding
ITFT - Java CodingITFT - Java Coding
ITFT - Java CodingBlossom Sood
 
MozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: TaipeiMozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: Taipeilittlebtc
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaattiqrocket
 
JavaClassPresentation
JavaClassPresentationJavaClassPresentation
JavaClassPresentationjuliasceasor
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easyroialdaag
 
MozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: TaichungMozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: Taichunglittlebtc
 

Semelhante a java swing (20)

Java goes wild, lesson 1
Java goes wild, lesson 1Java goes wild, lesson 1
Java goes wild, lesson 1
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
 
Java1
Java1Java1
Java1
 
Java1
Java1Java1
Java1
 
01 java intro
01 java intro01 java intro
01 java intro
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
Hands on Gradle
Hands on GradleHands on Gradle
Hands on Gradle
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
ITFT - Java Coding
ITFT - Java CodingITFT - Java Coding
ITFT - Java Coding
 
MozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: TaipeiMozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: Taipei
 
Lesson1 intro
Lesson1 introLesson1 intro
Lesson1 intro
 
Lesson1 intro
Lesson1 introLesson1 intro
Lesson1 intro
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
JavaClassPresentation
JavaClassPresentationJavaClassPresentation
JavaClassPresentation
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
 
MozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: TaichungMozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: Taichung
 

Último

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Último (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

java swing

  • 1. Developing User Interfaces (DUI) Chris North cs3724: HCI
  • 2. GUI Development: Goals 1. Learn general GUI programming concepts • GUI components • Layout • Event-based programming • Graphics • Animation 2. Learn Java • Swing • Layout managers • Listerners • 2D graphics • Threads Then: can learn other languages quickly • VB, C#, Xwin, Java 49
  • 5. Java materials • Java 2 = sdk 1.2 or better • http://java.sun.com/j2se/ • Documentation: • http://java.sun.com/docs/ • Tutorials, reference, API • Borland JBuilder 6 • http://www.borland.com/jbuilder/personal/ • Free! Cross between VB and VC++
  • 6. Java differences • Basic statements identical to C++ • Object-oriented only! • No .h files • main() is inside a class • No global variables • No pointers (object references only) • No delete: automatic garbage collection • Single inheritance only, “interfaces” • Applet/application • GUI: AWT, Swing • Packaging • Error Handling, exceptions (try, catch) • E.g. Array bounds checking • Security • Components: beans
  • 7. Java compiling • Code: • hello.java (text file) • Compile: • javac hello.java • Creates: hello.class (byte code) • Run: • java hello • Java virtual machine, interpets/compiles (machine code) • Packaging: jar • Or use JBuilder, like VC++
  • 8. Java Applications • Run from command line • hello.java: class hello { public static void main(String[] args){ System.out.println(“Hello World!”); } } • javac hello.java • java hello Hello World!
  • 9. Typically create objects • hello.java: class hello { public static void main(String[] args){ // Create and use objects hello h = new hello(); … } public hello(){ // Constructor … } … }
  • 10. Many Classes • Compile each separately • Can be main( ) in any/all classes • hello.java: class hello { goodbye g; public static void main(String[] args){ … } • goodbye.java: class goodbye { public static void main(String[] args){ … }
  • 13. Java Applets • Run in a web browser • hello.java: import javax.swing.*; class hello extends JApplet { public void init(){ getContentPane().add( new JLabel(“Hello World!”) ); } } • javac hello.java Hello World! • appletviewer hello
  • 14. Java Applets in HTML • hello.html: <html><body> <applet code=“hello.class” height=100 width=200> Need java. </applet> </body></html> hello.html • Put hello.html and hello.class on website Hello World! • Java plug-in
  • 15. Applet Methods • init( ) - initialization • start( ) - resume processing (e.g. animations) • stop( ) - pause • destroy( ) - cleanup • paint( ) - redraw stuff (‘expose’ event)
  • 16. Applet Security • No read/write on client machine • Can’t execute programs on client machine • Communicate only with server • “Java applet window” Warning • Certificates
  • 17. Upcoming Java Topics • GUIs: Swing, AWT, MVC • Event handling, listeners • Graphics • Animation, threads • Components, JavaBeans • Databases, JDBC