Graphical User Interface
|
|
- Austin Park
- 6 years ago
- Views:
Transcription
1 Lecture 10 Graphical User Interface An introduction Sahand Sadjadee Programming Fundamentals 725G61 Department of Computer and Information Science (IDA) Linköping University Sweden January 10,
2 Graphical User Interface (GUI) In general, a user interface is composed of a set of components which provide the possibility that a human via five senses interact with a device, machine or a unit which can perform a set of functionalities. A phone equipped with a User Interface for human interaction.
3 Every interaction with a telephone device is composed of three parts 1. Input to the device provided by the user. 2. Output from the device to the user. 3. Actions performed by the user which each lead to different functionalities executed by the device. In simple words an interaction with a device means working with it.
4 A sample interaction with a telephone device when a person tries to call another person: 1. Pick up the handset(action) to clear the line(functionality). 2. Dial via the dial pad (input) to make call(functionality) 3. The other party rings as you can hear a voice pattern via the head set (output). 4. The other party picks up and you start to speak via head set( input). 5. The other party speaks and you hear it via the head set (output). 6. The conversation is finished and you hang up(functionality) by putting back the head set (action).
5 Graphical User Interface Graphical User Interface or GUI Is a type of user interface which allows users to interact with computer programs through graphical components. By interaction, it means providing input, viewing output and executing different functionalities provided by the program. Microsoft Windows calculator equipped with Graphical User Interface.
6 Unlike Graphical User Interface, A Text-based user interface is only composed of characters formed in different lines. A finance program equipped with Text-based User Interface for human interaction.
7 Swing Swing is an API as part of Java Standard Library which provides classes and interfaces required for implementing Graphical User Interface for Java Desktop Applications. Java Desktop Applications are Java programs which run on Personal Computers. A simple calculator implemented by using Swing API.
8 Some facts about Swing 1. Swing components look the same on every Operating System like Linux, Unix, Mac OS X and Windows. 2. Every class as part of Swing which starts with J provides a viewable component. 3. The Swing API is located in javax.swing package. 4. It is not possible remember every detail about every class so it is necessary to refer to official Swing documentation available at
9 Swing classes and interfaces
10 JFrame JFrame is a class designed for creating the main window in a Java desktop application. 1. the main window is displayed first when the program is executed by the user. 2. The main window is closed by the user for quitting the program. 3. The main window represents the main view of the application and contains other components.
11 An empty main window created by using JFrame class
12 Some of the methods provided by JFrame class 1. public void settitle(string title) Set the title of the main window. The default title is. 2. public void setvisible(boolean b) Displays the main window to the user. 3. public void setsize(int width, int height) Sets the size of the main window in pixels. The default size is 0X0. 4. public void setlocation(int x, int y) Sets the location of the main window in the screen in pixels. Top left corner has the (0,0) coordination. 5. public void setdefaultcloseoperation(int operation) Defines what happens when the user clicks on the close button of the main window. By default it hides and does not close. 6. public Component add(component comp) Adds a new component to the main window.
13 How do we use Jframe? 1. Create a class which has a main method. 2. Inside of the main method, create an object from class Jframe. 3. Inside of the main method, call the method setvisible(true) on the created object. Works fine and pretty straight forward but it has a problem! What is the problem then?
14 By using the previous approach we cannot change a behavior or add new attributes and behaviors to the main window! To be able to do that so, we need to use inheritance first as follow: 1. Create a new class. 2. Extend the new class by inheriting from JFrame class. 3. Override the desired methods, declare different constructors/destructor or add new fields and methods. 4. Create a class which has a main method. 5. Create an object from the newly created class inside of the main method. 6. Call method setvisible(true) on the created object. 7. initialize the main window by calling required methods inside of Of a constructor.
15 a program which has one main window with the default size of 640X480. // declaring a new class named MyFrame inheriting from the JFrame class, steps 1 and 2. // MyFrame.java class MyFrame extends javax.swing.jframe{ // declaring different constructors comparing to JFrame, step 3. public MyFrame(){ setsize(640, 480); // setting the default size to 640X480, step 7. } } //Main.java, step 4 class Main{ public static void main(string[] args){ // assuming MyFrame is imported or the Main and MyFrame classes locate in the same package. MyFrame mainwindow = new MyFrame(); // creating an object from MyFrame class, step 5. mainwindow.setvisible(true); // step 6 } }
16 JButton The JButton class is used for creating buttons in Java Desktop applications. 1. In general, a button is a click-able rectangular area which contains a label or/and an image representing the functionality it provides. 2. By clicking on a button, a method inside of the program executes. 3. A button must be placed inside of the main window.
17 Some of the methods provided by JButton class 1. public void settext(string title) Assigns a text as the label of the button. 2. public void setsize(int width, int height) Sets the size of the button located inside of the main window. 3. public void setlocation(int x, int y) Sets the location of the button inside of the main window. 4. public void addactionlistener(actionlistener l) Defines a method which is called when the button is clicked.
18 A button inside of the main window
19 How do we use class Jbutton? 8. Create a field of type Jbutton inside of the your newly created class which inherits the Jframe class(our MyFrame class). 9. Create an object inside of a constructor of it(our MyFrame class) 10. Call the desired methods on the created Jbutton object inside of the constructor like setsize and SetLocation methods. 11. add the button to the main window by using the Jframe::add method.
20 package se.liu.ida.gp.a8; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; // declaring a new class named MyFrame inheriting from the JFrame class, steps 1 and 2. // MyFrame.java class MyFrame extends javax.swing.jframe { // declaring different constructors comparing to JFrame, step 3. public MyFrame() { setsize(640, 480); // setting the default size to 640X480, step 7 setlayout(null); // disabling layout manager, step 7 button = new JButton("Click me!"); // step 9 button.setsize(120, 40); button.setlocation(200, 200); button.addactionlistener(new ActionListener() { // step public void actionperformed(actionevent e) { System.out.println("I am Clicked!"); } }); add(button); //step 10 } private JButton button; // step 8 } // Main.java, step 4,5,6
21 Result- A button inside of the main window
22 JTextField The JTextField class is used for creating text fields in Java Desktop applications. In general, a text field is a single-line rectangular area for inputting and outputting text from/to the user. It only appears in the main window.. JTextArea The JTextArea class is used for creating text areas in Java Desktop applications. In general, a text area is a multi-line rectangular area for inputting and outputting text from/to the user. It only appears in the main window. In other words, they are both simple text editors!
23 Some of the methods provided by both JTextField and JTextArea classes 1. public void settext(string title) Assigns a text to the text editor. 2. public String gettext() Returns the text currently inside of the text editor. 3. public void setlocation(int x, int y) Sets the location of the text editor inside of the main window. 4. public void setsize(int width, int height) Sets the size of the text editor inside of the main window.
24 A text field and a button inside of the main window
25 How do we use class JTextField/JTextArea classes? We use these classes as we did for the JButton class. In fact this approach applies for every component which appears inside of the main window. Why is that!?
26 package se.liu.ida.gp.a8; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jtextfield; // declaring a new class named MyFrame inheriting from the JFrame class, steps 1 and 2. // MyFrame.java class MyFrame extends javax.swing.jframe { // declaring different constructors comparing to JFrame, step 3. public MyFrame() { setsize(640, 480); // setting the default size to 640X480, step 7 setlayout(null); // disabling layout manager, step 7 button = new JButton("Click me!"); // step 9 button.setsize(120, 40); //step 10 button.setlocation(200, 200); //step 10 button.addactionlistener(new ActionListener() { // step public void actionperformed(actionevent e) { textfield.settext("i'm clicked!"); } }); add(button); //step 11
27 Continued... textfield = new JTextField(); // step 9 textfield.setsize(200, 40); //step 10 textfield.setlocation(340, 200); //step 10 add(textfield); //step 11 } private JButton button; // step 8 private JTextField textfield; //step 8 } // Main.java, step 4,5,6
28 Result- A text field and a button inside of the main window
29 JLabel The class JLabel is used for creating labels in GUI of a Java desktop application. 1. In general, a label is a descriptive piece of text and/or an image which is used for describing other components. 2. By design, some components have built-in labels like buttons and some don't like text fields and text areas. 3. JLabels only appear in the main window.
30 Some of the methods provided by JLabel class 1. public void settext(string title) Assigns a text as a label. 2. public String gettext() Returns the label. 3. public void setlocation(int x, int y) Sets the location of the label inside of the main window. 4. public void setsize(int width, int height) Sets the size of the label inside of the main window.
31 A label, a text field and a button inside of the main window
32 package se.liu.ida.gp.a8; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jlabel; import javax.swing.jtextfield; // declaring a new class named MyFrame inheriting from the JFrame class, steps 1 a // MyFrame.java class MyFrame extends javax.swing.jframe { // declaring different constructors comparing to JFrame, step 3. public MyFrame() { setsize(640, 480); // setting the default size to 640X480, step 7 setlayout(null); // disabling layout manager, step 7 button = new JButton("Click me!"); // step 9 button.setsize(120, 40); //step 10 button.setlocation(200, 200); //step 10 button.addactionlistener(new ActionListener() { // step public void actionperformed(actionevent e) { textfield.settext("i'm clicked!"); } });
33 Continued... add(button); //step 11 textfield = new JTextField(); // step 9 textfield.setsize(200, 40); //step 10 textfield.setlocation(340, 200); //step 10 add(textfield); //step 11 label = new JLabel(); //step 9 label.settext("name"); //step 10 label.setsize(200, 40); //step 10 label.setlocation(340, 150); //step 10 add(label); //step 11 } private JButton button; // step 8 private JTextField textfield; //step 8 private JLabel label; //step 8 } // Main.java, step 4,5,6
34 Result- A label, a text field and a button inside of the main window
35 Result- A label, a text field and a button inside of the main window after the click on the button.
36 JOptionPane The JOptionPane class is used for showing different types of modal dialog boxes to the users. 1. A dialog box is a window containing certain components designed for inputting or outputting data from/to the users. 2. A modal dialog box does not allow the user to work with any other component in the application until the dialog box is dismissed. 3. A dialog box appears by clicking on a button inside of the main window.
37 4 different modal dialog boxes provided by JOptionPane Method Name showconfirmdialog Description Asks a confirming question, like yes/no/cancel. showinputdialog Prompt for some input. showmessagedialo g showoptiondialog Tell the user about something that has happened. The Grand Unification of the above three. All methods are static and there is no need to create an object from JOptionPane to use them!
38 package se.liu.ida.gp.a8; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jlabel; import javax.swing.jtextfield; // declaring a new class named MyFrame inheriting from the JFrame class, steps 1 and 2. // MyFrame.java class MyFrame extends javax.swing.jframe { // declaring different constructors comparing to JFrame, step 3. public MyFrame() { setsize(640, 480); // setting the default size to 640X480, step 7 setlayout(null); // disabling layout manager, step 7 button = new JButton("Click me!"); // step 9 button.setsize(120, 40); //step 10 button.setlocation(200, 200); //step 10 button.addactionlistener(new ActionListener() { // step public void actionperformed(actionevent e) { String text = textfield.gettext(); Javax.swing.JoptionPane.showMessageDialog(null, text); } });
39 Continued... add(button); //step 11 textfield = new JTextField(); // step 9 textfield.setsize(200, 40); //step 10 textfield.setlocation(340, 200); //step 10 add(textfield); //step 11 label = new JLabel(); //step 9 label.settext("name"); //step 10 label.setsize(200, 40); //step 10 label.setlocation(340, 150); //step 10 add(label); //step 11 } private JButton button; // step 8 private JTextField textfield; //step 8 private JLabel label; //step 8 } // Main.java, step 4,5,6
40 Result- calling showmessagedialog on JoptionPane class.
41 That was it, hope you enjoyed it!
Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords
Goals By the end of this lesson, you should: Lecture 7 More GUI programming 1. Be able to write Java s with JTextField, JList, JCheckBox and JRadioButton components 2. Be able to implement a ButtonGroup
More informationSampleApp.java. Page 1
SampleApp.java 1 package msoe.se2030.sequence; 2 3 /** 4 * This app creates a UI and processes data 5 * @author hornick 6 */ 7 public class SampleApp { 8 private UserInterface ui; // the UI for this program
More informationCOMPSCI 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 informationCSE 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 information17 GUI API: Container 18 Hello world with a GUI 19 GUI API: JLabel 20 GUI API: Container: add() 21 Hello world with a GUI 22 GUI API: JFrame: setdefau
List of Slides 1 Title 2 Chapter 13: Graphical user interfaces 3 Chapter aims 4 Section 2: Example:Hello world with a GUI 5 Aim 6 Hello world with a GUI 7 Hello world with a GUI 8 Package: java.awt and
More informationGraphical 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 informationHanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS
Hanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS Glossary of Terms 2-4 Step by Step Instructions 4-7 HWApp 8 HWFrame 9 Never trust a computer
More informationBuilding Java Programs Bonus Slides
Building Java Programs Bonus Slides Graphical User Interfaces Copyright (c) Pearson 2013. All rights reserved. Graphical input and output with JOptionPane JOptionPane An option pane is a simple dialog
More informationFrames, 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 informationGraphical User Interfaces
Graphical User Interfaces CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Overview Command line versus GUI apps
More informationThe JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class
CHAPTER GRAPHICAL USER INTERFACES 10 Slides by Donald W. Smith TechNeTrain.com Final Draft 10/30/11 10.1 Frame Windows Java provides classes to create graphical applications that can run on any major graphical
More informationTopic 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 informationTopic 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 informationJFrame In Swing, a JFrame is similar to a window in your operating system
JFrame In Swing, a JFrame is similar to a window in your operating system All components will appear inside the JFrame window Buttons, text labels, text fields, etc. 5 JFrame Your GUI program must inherit
More informationSystems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid
Systems Programming Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid Leganés, 21st of March, 2014. Duration: 75 min. Full
More informationSection Basic graphics
Chapter 16 - GUI Section 16.1 - Basic graphics Java supports a set of objects for developing graphical applications. A graphical application is a program that displays drawings and other graphical objects.
More informationCSE 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 informationDr. Hikmat A. M. AbdelJaber
Dr. Hikmat A. M. AbdelJaber JWindow: is a window without a title bar or move controls. The program can move and resize it, but the user cannot. It has no border at all. It optionally has a parent JFrame.
More informationAnswer on question #61311, Programming & Computer Science / Java
Answer on question #61311, Programming & Computer Science / Java JSP JSF for completion Once the user starts the thread by clicking a button, the program must choose a random image out of an image array,
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CMPE212, FALL TERM, 2012 FINAL EXAMINATION 18 December 2012, 2pm Instructor: Alan McLeod If the instructor is unavailable
More informationMIT 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 informationWindow 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 informationOutline. 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 informationWindow 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/* Write a Program implementing GUI based Calculator using Swing */
/* Write a Program implementing GUI based Calculator using Swing */ import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.*; public class Calculator extends JFrame
More informationSwing 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 informationGUI (Graphic User Interface) Programming. Part 2 (Chapter 8) Chapter Goals. Events, Event Sources, and Event Listeners. Listeners
GUI (Graphic User Interface) Programming Part 2 (Chapter 8) Chapter Goals To understand the Java event model To install action and mouse event listeners To accept input from buttons, text fields, and the
More informationAP CS Unit 11: Graphics and Events
AP CS Unit 11: Graphics and Events This packet shows how to create programs with a graphical interface in a way that is consistent with the approach used in the Elevens program. Copy the following two
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC124, WINTER TERM, 2009 FINAL EXAMINATION 7pm to 10pm, 18 APRIL 2009, Dunning Hall Instructor: Alan McLeod If the
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2006 FINAL EXAMINATION 7pm to 10pm, 19 DECEMBER 2006, Jeffrey Hall 1 st Floor Instructor: Alan
More informationMore about GUIs GEEN163
More about GUIs GEEN163 The best programmers are not marginally better than merely good ones. They are an order-ofmagnitude better, measured by whatever standard: conceptual creativity, speed, ingenuity
More informationPROGRAMMING 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 informationCSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2012
CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2012 Name: This exam consists of 6 problems on the following 8 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More informationCOMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) )
COMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) ) Course Evaluations Please do these. -Fast to do -Used to
More informationSwing I CHAPTER EVENT-DRIVEN PROGRAMMING 921 Events and Listeners 921
CHAPTER 17 Swing I 17.1 EVENT-DRIVEN PROGRAMMING 921 Events and Listeners 921 17.2 BUTTONS, EVENTS, AND OTHER SWING BASICS 923 Example: A Simple Window 923 Buttons 930 Action Listeners and Action Events
More informationGraphics User Defined Forms, Part I
Graphics User Defined Forms, Part I Quick Start Compile step once always mkdir labs javac PropertyTax5.java cd labs mkdir 5 Execute step cd 5 java PropertyTax5 cp /samples/csc/156/labs/5/*. cp PropertyTax1.java
More informationJRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();
Q)Write a program to design an interface containing fields User ID, Password and Account type, and buttons login, cancel, edit by mixing border layout and flow layout. Add events handling to the button
More informationIntroduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008
Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008 Announcements A3 is up, due Friday, Oct 10 Prelim 1 scheduled for Oct 16 if you have a conflict, let us know now 2 Interactive
More informationSwing I Event-Driven Programming Buttons, Events, and Other Swing Basics Containers and Layout Managers 946
17.1 Event-Driven Programming 925 Events and Listeners 925 17.2 Buttons, Events, and Other Swing Basics 926 Example: A Simple Window 927 Buttons 933 Action Listeners and Action Events 934 Example: A Better
More informationBuilding 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 informationJava Programming Lecture 6
Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components
More informationPage 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
Page 1 of 16 HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2005 FINAL EXAMINATION 9am to 12noon, 19 DECEMBER 2005 Instructor: Alan McLeod If
More informationCSE 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 informationGUI Applications. Let s start with a simple Swing application in Java, and then we will look at the same application in Jython. See Listing 16-1.
GUI Applications The C implementation of Python comes with Tkinter for writing Graphical User Interfaces (GUIs). The GUI toolkit that you get automatically with Jython is Swing, which is included with
More informationCSCI 201L Midterm Written SOLUTION Fall % of course grade
CSCI 201L Midterm Written SOLUTION Fall 2015 10% of course grade 1. Inheritance Answer the following questions about inheritance. a. Does Java allow overloading, overriding, and redefining of methods?
More informationCSCI 201L Midterm Written Summer % of course grade
CSCI 201L Summer 2016 10% of course grade 1. Abstract Classes and Interfaces Give two differences between an interface and an abstract class in which all of the methods are abstract. (0.5% + 0.5%) 2. Serialization
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #19: November 4, 2015 1/14 Third Exam The third, Checkpoint Exam, will be on: Wednesday, November 11, 2:30 to 3:45 pm You will have 3 questions, out of 9,
More informationSwing - JLabel. Adding a text (and HTML) labels to a GUI
Swing - JLabel Adding a text (and HTML) labels to a GUI Prerequisites - before this lecture You should have seen: The lecture on JFrame The lecture on JButton The lectuer on JTextField Including having
More informationCONTENTS. 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 informationDatenbank-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 informationLecture 5: Java Graphics
Lecture 5: Java Graphics CS 62 Spring 2019 William Devanny & Alexandra Papoutsaki 1 New Unit Overview Graphical User Interfaces (GUI) Components, e.g., JButton, JTextField, JSlider, JChooser, Containers,
More informationCOMP16121 Sample Code Lecture 1
COMP16121 Sample Code Lecture 1 Sean Bechhofer, University of Manchester, Manchester, UK sean.bechhofer@manchester.ac.uk 1 SimpleFrame 1 import javax.swing.jframe; 2 3 public class SimpleFrame { 4 5 /*
More informationCMP 326 Midterm Fall 2015
CMP 326 Midterm Fall 2015 Name: 1) (30 points; 5 points each) Write the output of each piece of code. If the code gives an error, write any output that would happen before the error, and then write ERROR.
More informationSD 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 informationJava Interfaces Part 1 - Events Version 1.1
Java Interfaces Part 1 - Events Version 1.1 By Dr. Nicholas Duchon July 22, 2007 Page 1 Overview Philosophy Large Scale Java Language Structures Abstract classes Declarations Extending a abstract classes
More informationGraphical User Interface (GUI)
Graphical User Interface (GUI) Layout Managment 1 Hello World Often have a static method: createandshowgui() Invoked by main calling invokelater private static void createandshowgui() { } JFrame frame
More informationProgramming 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 informationSD 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 informationCS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java
1 CS/ENGRD 2110 SPRING 2014 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Java OO (Object Orientation) 2 Python and Matlab have objects and classes. Strong-typing nature of
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2006 FINAL EXAMINATION 7pm to 10pm, 19 DECEMBER 2006, Jeffrey Hall 1 st Floor Instructor:
More informationLab 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 informationMidterm assessment - MAKEUP Fall 2010
M257 MTA Faculty of Computer Studies Information Technology and Computing Date: /1/2011 Duration: 60 minutes 1-Version 1 M 257: Putting Java to Work Midterm assessment - MAKEUP Fall 2010 Student Name:
More informationPart 3: Graphical User Interface (GUI) & Java Applets
1,QWURGXFWLRQWR-DYD3URJUDPPLQJ (( Part 3: Graphical User Interface (GUI) & Java Applets EE905-GUI 7RSLFV Creating a Window Panels Event Handling Swing GUI Components ƒ Layout Management ƒ Text Field ƒ
More informationIntroduction 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 informationJava Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1
Java Swing based on slides by: Walter Milner Java Swing Walter Milner 2005: Slide 1 What is Swing? A group of 14 packages to do with the UI 451 classes as at 1.4 (!) Part of JFC Java Foundation Classes
More informationObject-Oriented Software Engineering Re-exam, 2012 (Also Object-Oriented Analysis, Design and Programming, Re-exam, 2012)
Object-Oriented Software Engineering Re-exam, 2012 (Also Object-Oriented Analysis, Design and Programming, Re-exam, 2012) Medialogy, 4 th Semester, Aalborg Thursday 23 August 2012, 09.00 12.00 Instructions
More informationPage 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
Page 1 of 16 SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2005 FINAL EXAMINATION 9am to 12noon, 19 DECEMBER 2005 Instructor: Alan McLeod
More information14.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 informationLecture 3: Java Graphics & Events
Lecture 3: Java Graphics & Events CS 62 Fall 2017 Kim Bruce & Alexandra Papoutsaki Text Input Scanner class Constructor: myscanner = new Scanner(System.in); can use file instead of System.in new Scanner(new
More informationG51PGP Programming Paradigms. Lecture 008 Inner classes, anonymous classes, Swing worker thread
G51PGP Programming Paradigms Lecture 008 Inner classes, anonymous classes, Swing worker thread 1 Reminder subtype polymorphism public class TestAnimals public static void main(string[] args) Animal[] animals
More informationIntroduction to Graphical Interface Programming in Java. Introduction to AWT and Swing
Introduction to Graphical Interface Programming in Java Introduction to AWT and Swing GUI versus Graphics Programming Graphical User Interface (GUI) Graphics Programming Purpose is to display info and
More informationMultiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)
M257 MTA Spring2010 Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) 1. If we need various objects that are similar in structure, but
More informationPIC 20A GUI with swing
PIC 20A GUI with swing Ernest Ryu UCLA Mathematics Last edited: November 22, 2017 Hello swing Let s create a JFrame. import javax. swing.*; public class Test { public static void main ( String [] args
More informationControl 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 informationOverview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008
Overview Lecture 7: Inheritance and GUIs Written by: Daniel Dalevi Inheritance Subclasses and superclasses Java keywords Interfaces and inheritance The JComponent class Casting The cosmic superclass Object
More informationJFrame & JLabel. By Iqtidar Ali
JFrame & JLabel By Iqtidar Ali JFrame & its Features JFrame is a window with border, title and buttons. The component added to frame are referred to as its contents & are managed by the content pane. To
More informationDEMYSTIFYING PROGRAMMING: CHAPTER FOUR
DEMYSTIFYING PROGRAMMING: CHAPTER FOUR Chapter Four: ACTION EVENT MODEL 1 Objectives 1 4.1 Additional GUI components 1 JLabel 1 JTextField 1 4.2 Inductive Pause 1 4.4 Events and Interaction 3 Establish
More informationSwing - JTextField. Adding a text field to the main window (with tooltips and all)
Swing - JTextField Adding a text field to the main window (with tooltips and all) Prerequisites - before this lecture You should have seen: The lecture on JFrame The lecture on JButton Including having
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2007 FINAL EXAMINATION 7pm to 10pm, 10 DECEMBER 2007, Jeffery Hall Instructor: Alan McLeod If the
More informationCS Exam 1 Review Suggestions
CS 235 - Fall 2015 - Exam 1 Review Suggestions p. 1 last modified: 2015-09-30 CS 235 - Exam 1 Review Suggestions You are responsible for material covered in class sessions, lab exercises, and homeworks;
More informationCS 106A, Lecture 23 Interactors and GCanvas
CS 106A, Lecture 23 Interactors and GCanvas suggested reading: Java Ch. 10.5-10.6 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5
More information2110: GUIS: Graphical User Interfaces
2110: GUIS: Graphical User Interfaces Their mouse had a mean time between failure of a week it would jam up irreparably, or... jam up on the table--... It had a flimsy cord whose wires would break. Steve
More informationRAIK 183H Examination 2 Solution. November 11, 2013
RAIK 183H Examination 2 Solution November 11, 2013 Name: NUID: This examination consists of 5 questions and you have 110 minutes to complete the test. Show all steps (including any computations/explanations)
More informationBased on slides by Prof. Burton Ma
Based on slides by Prof. Burton Ma 1 TV - on : boolean - channel : int - volume : int + power(boolean) : void + channel(int) : void + volume(int) : void Model View Controller RemoteControl + togglepower()
More informationCSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University
Events and Listeners CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides
More informationExample 3-1. Password Validation
Java Swing Controls 3-33 Example 3-1 Password Validation Start a new empty project in JCreator. Name the project PasswordProject. Add a blank Java file named Password. The idea of this project is to ask
More informationCSCI 201L Midterm Written SOLUTION Summer % of course grade
CSCI 201L SOLUTION Summer 2016 10% of course grade 1. Abstract Classes and Interfaces Give two differences between an interface and an abstract class in which all of the methods are abstract. (0.5% + 0.5%)
More informationCourse 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 informationPackages: 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 informationCompSci 230 S Programming Techniques. Basic GUI Components
CompSci 230 S1 2017 Programming Techniques Basic GUI Components Agenda Agenda Basic GUI Programming Concepts Graphical User Interface (GUI) Simple GUI-based Input/Output JFrame, JPanel & JLabel Using Layout
More informationPART1: Choose the correct answer and write it on the answer sheet:
PART1: Choose the correct answer and write it on the answer sheet: (15 marks 20 minutes) 1. Which of the following is included in Java SDK? a. Java interpreter c. Java disassembler b. Java debugger d.
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC124, WINTER TERM, 2009 FINAL EXAMINATION 7pm to 10pm, 18 APRIL 2009, Dunning Hall Instructor: Alan McLeod
More informationGraphical User Interfaces 2
Graphical User Interfaces 2 CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Extending JFrame Dialog boxes Overview
More informationWorkbook 7. Remember to check the course website regularly for announcements and errata:
Introduction Workbook 7 Last week you built your own graphical interface with Java Swing in order to make your program more accessible to other users. Unfortunately, whilst your interface looked pretty,
More informationCMP 326 Final Spring There is a blank page at the end of the exam if you need more room to answer a question.
CMP 326 Final Spring 2014 Name: There is a blank page at the end of the exam if you need more room to answer a question. 1) (10 pts) Fill in the blanks to specify the missing keywords or definitions. public
More informationJava 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 informationGraphical 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 informationThe class definition is not a program by itself. It can be used by other programs in order to create objects and use them.
Data Classes and Object-Oriented Programming Data classes can be motivated by the need to create data structures that have grouped together a number of variables of simpler type (ints, Strings, arrays)
More informationCS108, Stanford Handout #22. Thread 3 GUI
CS108, Stanford Handout #22 Winter, 2006-07 Nick Parlante Thread 3 GUI GUIs and Threading Problem: Swing vs. Threads How to integrate the Swing/GUI/drawing system with threads? Problem: The GUI system
More informationMidterm Test II Object Oriented Programming in Java Computer Science, University of Windsor Fall 2014 Time 2 hours. Answer all questions
Midterm Test II 60-212 Object Oriented Programming in Java Computer Science, University of Windsor Fall 2014 Time 2 hours Answer all questions Name : Student Id # : Only an unmarked copy of a textbook
More information