Introduction This assignment will ask that you write a simple graphical user interface (GUI).

Size: px
Start display at page:

Download "Introduction This assignment will ask that you write a simple graphical user interface (GUI)."

Transcription

1 Computing and Information Systems/Creative Computing University of London International Programmes : Graphical Object-Oriented and Internet programming in Java Coursework one Introduction This assignment will ask that you write a simple graphical user interface (GUI). Assignment learning objectives Understand how a JFrame represents a window on the screen Understand how to add components to the JFrame's content pane Understand how an application must listen for a GUI event Understand how to add a listener to a component Understand in general how to implement an Interface Understand in particular how to implement the ActionListener Interface Understand how to use the ActionPerformed method Reading for assignment You should have read volume one of the subject guide including all recommended readings, with particular reference to chapter 12, of Head First Java pages , and chapter 11 of the subject guide. Marks for assignment The marks for each section of the assignment are clearly displayed against each question and add up to 25. There are another 25 marks each available from the second, third and fourth assignments. Deliverables A print out of your two programs: SimpleGUI.java and MyGUI.java Electronic versions of your two programs: SimpleGUI.java and MyGUI.java A paragraph in answer to question (c)

2 Coursework one Consider the program, First, below: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class First { } public static void main (String[] args) { First thing = new First(); thing.go(); } public void go() { JFrame frame = new JFrame(); frame.setsize(500,500); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); } Compile and run this program. You should note that when run the program displays a 500 by 500 window on the screen to the user. (a) Rewrite the program, calling your new program SimpleGUI. In your new program implement the following: (i) (ii) (iii) (iv) Add a JButton to the frame that displays the text coursework one Implement ActionListener Register the JButton with the ActionListener Make the JButton display the text You clicked me! if the user clicks it. [3 marks] [3 marks] [3 marks] [3 marks] You should now have a very simple GUI, that displays a button in a frame to the user. The button displays the text coursework one which changes to You clicked me! if the user clicks the button. However subsequent clicks by the user will have no further effect on the display. (b) Rewrite your program, this time calling it MyGUI. In your new program each time the user clicks on the JButton it will randomly display one of the following statements: [9 marks]

3 Click me you know you want to. One click good, two clicks bad. Why did the chicken cross the road? To get to the other side! The difference between genius and stupidity is that there is a limit to genius. What has been clicked cannot be unclicked. If you believe there is hope then there is hope. To click or not to click that is the question. The click is out there. (c) Explain how the actionperformed() method gets called, and why it is that you do not have to explicitly call it in your code. [4 marks]

4 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION FORM IMPORTANT, PLEASE NOTE: You must complete this form in full and attach it to the coursework that is to be submitted to the University. Full name:... (as it appears on your Registration Form) Student number:... Unit title:... Unit number:... Assignment number:... DECLARATION I declare that: I understand what is meant by plagiarism. I understand the implications of plagiarism. This assignment is all my own work and I have acknowledged any use of the published or unpublished works of other people. Signature Date

5 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION CHECKLIST Before you submit your coursework to the University, have you: completed the title, unit number and assignment number on the submission form? signed and dated the Declaration? put your name and student number on every page? put the unit number, unit name and assignment number on every page? used more than one page? If so, have you securely stapled or tied the pages together? used a disk? If so, have you used a separate disk for each assignment? (Note: you should only use a disk if it is explicitly asked for in the assignment). labelled clearly and securely attached any disks? attached all parts of the coursework required (including the submission form)? If you fail to do these things your coursework may not be accepted. Please send all coursework to: The Registration and Learning Resources Office Room STG13 Stewart House University of London 32 Russell Square London WC1B 5DN United Kingdom Tel: +44 (0) Fax: +44 (0)

6 Computing and Information Systems/Creative Computing University of London International Programmes : Graphical Object-Oriented and Internet programming in Java Coursework two Introduction This assignment asks you to write a basic graphical program, and a graphical program with a simple animation. Assignment learning objectives Understand the form of the most basic graphical program Understand how to subclass JPanel and override paintcomponent() in order to draw graphics Understand what the argument to paintcomponent() is and that only the JVM can construct this object Cast the Graphics object to a Graphics2D object in order to invoke the methods from the Graphics2D library Understand how to use Thread.sleep in an animation to halt the program for a given time interval between frames Reading for assignment You should have read volume one of the subject guide including all recommended readings, with particular reference to chapter 12 of Head First Java, pages , and chapter 12 of the subject guide. Marks for assignment The marks for each section of the assignment are clearly displayed against each question and add up to 25. There are another 25 marks each available from the first, third and fourth assignments. Deliverables Print outs of your four programs: MyDrawPanel.java; SimpleDrawing.java; RandomDrawPanel.java and RandomDrawing.java. Electronic versions of your four programs: MyDrawPanel.java; SimpleDrawing.java; RandomDrawPanel.java and RandomDrawing.java.

7 Coursework two (a) (b) (c) (d) (e) (f) Write a class MyDrawPanel that extends JPanel and overrides paintcomponent(). The paintcomponent() method should display a blue oval with the coordinates (225, 225, 50, 50). Write a program called SimpleDrawing.java. Your program should display a 500 x 500 JFrame. Add a MyDrawPanel object to the frame such that when the program is run the blue oval is displayed. Write a class BigBlueDrawPanel.java that extends JPanel and overrides paintcomponent(). The paintcomponent() method should first create a blue oval with the coordinates (225, 225, 50, 50). Each time the paintcomponent() method is run the coordinates (50, 50) should increase by 2 so that the oval gradually increases in size. Use Thread.sleep to slow the growth of the oval so that the user will be able to clearly see it getting bigger. Write your code so that the coordinates are adjusted each time the oval is drawn such that the centre of the oval stays in the same place each time. Write a class BigBlueDrawing.java that uses BigBlueDrawPanel.java to display the blue oval in a 500 x 500 JFrame. The blue oval should gradually increase until the JFrame is completely filled with the colour blue. [5 marks] [5 marks] [4marks] [1 mark] [5 marks] [5 marks]

8 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION FORM IMPORTANT, PLEASE NOTE: You must complete this form in full and attach it to the coursework that is to be submitted to the University. Full name:... (as it appears on your Registration Form) Student number:... Unit title:... Unit number:... Assignment number:... DECLARATION I declare that: I understand what is meant by plagiarism. I understand the implications of plagiarism. This assignment is all my own work and I have acknowledged any use of the published or unpublished works of other people. Signature Date

9 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION CHECKLIST Before you submit your coursework to the University, have you: completed the title, unit number and assignment number on the submission form? signed and dated the Declaration? put your name and student number on every page? put the unit number, unit name and assignment number on every page? used more than one page? If so, have you securely stapled or tied the pages together? used a disk? If so, have you used a separate disk for each assignment? (Note: you should only use a disk if it is explicitly asked for in the assignment). labelled clearly and securely attached any disks? attached all parts of the coursework required (including the submission form)? If you fail to do these things your coursework may not be accepted. Please send all coursework to: The Registration and Learning Resources Office Room STG13 Stewart House University of London 32 Russell Square London WC1B 5DN United Kingdom Tel: +44 (0) Fax: +44 (0)

10 Computing and Information Systems/Creative Computing University of London International Programmes : Graphical Object-Oriented and Internet programming in Java Coursework three Introduction This assignment asks that you write three GUIs, each with one drawing and one, two or three buttons. The components should be laid out using the BorderLayout manager, and inner classes should be used to implement ActionListener such that each button has a different effect on the drawing when clicked. Assignment learning objectives Understand how layout managers control the size and location of nested components Understand that the layout manager of the background component determines the size and location of the added component Understand how the layout manager uses the preferred size of the added component for its calculations Understand that whether or not this size is respected depends on the layout manager's policies Use BorderLayout manager to add components to one of five background regions Understand that in this case components in the north and south get their preferred heights, but not width; the situation is reversed for the east/west regions; and the component in the middle gets whatever is left over, unless you use pack() Understand that BorderLayout if the default manager for a frame and FlowLayout is the default for a panel Reading for assignment You should read volume two of the subject guide with particular reference to chapter 4, and Chapters 12 and 13 of Head First Java, particularly pages and pages Marks for assignment The marks for each section of the assignment are clearly displayed against each question and add up to 25. There are another 25 marks each available from the first, second and fourth assignments. Deliverables Print out of your programs, GrowCircle.java, GrowAndShrinkCircleGUI.java and ChangeColorCircleGUI.java Electronic version of your programs, GrowCircle.java, GrowAndShrinkCircleGUI.java and ChangeColorCircleGUI.java

11 Coursework three Write the following programs: (a) Write a program called GrowCircle.java that will display a 500 x 500 JFrame. [2 marks] (b) (c) (d) (e) (f) (g) (h) (i) (j) Write an inner class of GrowCircle called CircleDrawPanel that extends JPanel and overrides paintcomponent(). The paintcomponent() method should display a blue oval with the coordinates (225, 200, 50, 50). Use BorderLayout manager to place a JButton in the EAST region of the frame, and an instance of your GrowCircle class in the CENTER region. Make the JButton display the text click me to grow the circle. When compiled your program should display a blue circle next to a button that says click me to grow the circle. Actually clicking the button will have no effect on the circle. Link the JButton and the blue circle such that when the JButton is pressed the circle increases in size by a fixed amount. You may choose the amount that the circle size increases by. The changes you make to your program to implement this must include an inner class. Save your program. Save a copy of your program as GrowAndShrinkCircleGUI.java. Add another JButton to the WEST region of the new program, this one with the text click me to shrink the circle. Adjust the coordinates of the circle so that it is displayed in the middle of the frame. Link the new JButton to the circle, such that if it is clicked the size of the circle decreases by a fixed amount of your choosing. You should use another inner class for this. Save your completed program. Save a copy of your second program as ChangeColorCircleGUI.java. Change this program by adding another JButton to the SOUTH region, with the text click me to change the colour of the circle. Link the new JButton to the oval, such that when it is clicked the colour of the circle changes randomly. [2 marks] [4 marks] [2 marks] [3 marks] [2 marks] [2 marks] [3 marks] [2 marks] [3 marks] Please note: this assignment asks that candidates use very specific names for their classes, and directs that particular text is used for the JButtons. Candidates who do not follow these instructions closely may lose marks.

12 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION FORM IMPORTANT, PLEASE NOTE: You must complete this form in full and attach it to the coursework that is to be submitted to the University. Full name:... (as it appears on your Registration Form) Student number:... Unit title:... Unit number:... Assignment number:... DECLARATION I declare that: I understand what is meant by plagiarism. I understand the implications of plagiarism. This assignment is all my own work and I have acknowledged any use of the published or unpublished works of other people. Signature Date

13 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION CHECKLIST Before you submit your coursework to the University, have you: completed the title, unit number and assignment number on the submission form? signed and dated the Declaration? put your name and student number on every page? put the unit number, unit name and assignment number on every page? used more than one page? If so, have you securely stapled or tied the pages together? used a disk? If so, have you used a separate disk for each assignment? (Note: you should only use a disk if it is explicitly asked for in the assignment). labelled clearly and securely attached any disks? attached all parts of the coursework required (including the submission form)? If you fail to do these things your coursework may not be accepted. Please send all coursework to: The Registration and Learning Resources Office Room STG13 Stewart House University of London 32 Russell Square London WC1B 5DN United Kingdom Tel: +44 (0) Fax: +44 (0)

14 Computing and Information Systems/Creative Computing University of London International Programmes : Graphical Object-Oriented and Internet programming in Java Coursework four Introduction This assignment will ask that you modify two files in order to handle exceptions. In addition you are asked to write a class that can download the HTML source of the web page at a given url, and to write another GUI. This time your GUI will allow the user to input a url into a text field. At the click of a button the HTML source code at the given url is displayed in the text area of the GUI. Assignment learning objectives understand how all exceptions subclass java.lang.exception understand that the compiler does not check that possible runtime exceptions are handled in code understand that the compiler does care about checked exceptions, and insists that they are declared or wrapped in a try/catch block understand how a method throws an exception with the keyword throw followed by a new exceptions object understand that if your code calls a checked exception throwing method, you must either duck the exception or enclose the call in a try/catch block know that there are two types of stream: connection and chain, their functions and how they work chain a FileReader connection stream to a BufferedReader for efficient reading write a program which navigates to a given website and downloads the HTML source of the site Reading for assignment You should read: volume two of the subject guide, chapter 3 volume two of the subject guide, chapter 5 (particularly sections ) Chapter 11 of Head First Java, particularly pages , , and Chapter 12 of Head First Java, particularly pages Chapter 14 of Head First Java, particularly page 433 Marks for assignment The marks for each section of the assignment are clearly displayed against each question and add up to 25. There are another 25 marks each available from the first, second and third assignments. Deliverables Print outs of the revised ages.java and SourceViewer.java programs. Print outs of your PageSourceFinder.java and SourceTextGUI.java programs. Electronic version of all four programs. A sentence or two in answer to question (b) and a paragraph in answer to (d).

15 Coursework four Type and compile the following program. Try to run the program. You should find that while it compiles it does not run instead it reports a NumberFormatException. import java.io.*; public class ages { public static void main (String[] args) { ages ask = new ages(); ask.go("fifty"); } } (a) public void go(string s) { int a = Integer.parseInt(s); System.out.println("your age is "+a); } Add a try/catch block to the ages class (you should add and not delete or comment out any code) so that the program, when re-compiled and run will print out the message fifty is not parse-able as an integer. [3 marks] import java.io.bufferedreader; import java.io.filewriter; import java.io.ioexception; import java.io.inputstreamreader; import java.io.reader; import java.net.malformedurlexception; import java.net.url; class SourceViewer { public static void main(string args[]) throws IOException { String s = " URL u = new URL(s); Reader r = new BufferedReader(new InputStreamReader(u.openStream())); int c = 0; boolean intag = false; while ((c=r.read())!=-1) { System.out.print((char)c); } } }

16 (b) (c) (d) (e) (f) (g) (h) (i) Type and compile the above SourceViewer class. Run the program on a machine with an internet connection. Describe what the program does. Delete (or comment out) the words throws IOException from the main declaration and recompile the program. This time you should find that you have three errors. Correct the errors by using try/catch. Your revised program should have one try block and one catch block for each of the types of unreported exceptions found by the compiler. Explain why is it that the ages class would compile with unreported exceptions while the SourceViewer class would not. By modifying the SourceViewer class or otherwise write a new class, PageSourceFinder. The PageSourceFinder class should have one method with the signature public static String getsource (String s). This method should return the source code of the url given by String s. Write a new class called SourceTextGUI.java. Your new class should have a scrollable JTextArea and a JButton, and should use BorderLayout manager to place these components in the frame. Experiment with the size of the JFrame and the JTextArea until you are happy with the display. Add a JTextField to your program, and text to the JButton which says enter a url and then click me. Change your class so that this time the text that the user puts in the JTextField is treated as a url. If the url is parse-able then the source code of the page given by the url is printed in the JTextArea. If the text input by the user is not parse-able as a url then an error message is printed in the JTextArea. This error message should be generated in the PageSourceFinder class. [1 mark] [4 marks] [1 mark] [5 mark] [5 marks] [2 marks] [3 marks] [1 mark]

17 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION FORM IMPORTANT, PLEASE NOTE: You must complete this form in full and attach it to the coursework that is to be submitted to the University. Full name:... (as it appears on your Registration Form) Student number:... Unit title:... Unit number:... Assignment number:... DECLARATION I declare that: I understand what is meant by plagiarism. I understand the implications of plagiarism. This assignment is all my own work and I have acknowledged any use of the published or unpublished works of other people. Signature Date

18 UNIVERSITY OF LONDON DIPLOMA AND BSc IN COMPUTING AND RELATED SUBJECTS FOR INTERNATIONAL PROGRAMMES STUDENTS COURSEWORK SUBMISSION CHECKLIST Before you submit your coursework to the University, have you: completed the title, unit number and assignment number on the submission form? signed and dated the Declaration? put your name and student number on every page? put the unit number, unit name and assignment number on every page? used more than one page? If so, have you securely stapled or tied the pages together? used a disk? If so, have you used a separate disk for each assignment? (Note: you should only use a disk if it is explicitly asked for in the assignment). labelled clearly and securely attached any disks? attached all parts of the coursework required (including the submission form)? If you fail to do these things your coursework may not be accepted. Please send all coursework to: The Registration and Learning Resources Office Room STG13 Stewart House University of London 32 Russell Square London WC1B 5DN United Kingdom Tel: +44 (0) Fax: +44 (0)

Assignment 1 (2011/12)

Assignment 1 (2011/12) 2910222 Assignment 1 (2011/12) Statement This assignment aims to develop your experimental, data handling, presentation and analytical skills and your understanding of the ping utility and the causes of

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: JSP Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: Standard Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

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

SINGLE EVENT HANDLING

SINGLE EVENT HANDLING SINGLE EVENT HANDLING Event handling is the process of responding to asynchronous events as they occur during the program run. An event is an action that occurs externally to your program and to which

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

Final Examination Semester 2 / Year 2010

Final Examination Semester 2 / Year 2010 Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2010 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student

More information

We are on the GUI fast track path

We are on the GUI fast track path We are on the GUI fast track path Chapter 13: Exception Handling Skip for now Chapter 14: Abstract Classes and Interfaces Sections 1 9: ActionListener interface Chapter 15: Graphics Skip for now Chapter

More information

H212 Introduction to Software Systems Honors

H212 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 information

RAIK 183H Examination 2 Solution. November 10, 2014

RAIK 183H Examination 2 Solution. November 10, 2014 RAIK 183H Examination 2 Solution November 10, 2014 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 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

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 P a g e 1 CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 Q1 Describe some Characteristics/Advantages of Java Language? (P#12, 13, 14) 1. Java

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

Part 3: Graphical User Interface (GUI) & Java Applets

Part 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 information

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

The 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 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

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

Final Examination Semester 2 / Year 2011

Final Examination Semester 2 / Year 2011 Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2011 COURSE COURSE CODE TIME DEPARTMENT LECTURER : JAVA PROGRAMMING : PROG1114 : 2 1/2 HOURS : COMPUTER SCIENCE : LIM PEI GEOK Student

More information

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4. 1 - What if the main method is declared as private? 1. The program does not compile 2. The program compiles but does not run 3. The program compiles and runs properly ( From Lectuer # 2) 4. The program

More information

Name Section. CS 21a Introduction to Computing I 1 st Semester Final Exam

Name Section. CS 21a Introduction to Computing I 1 st Semester Final Exam CS a Introduction to Computing I st Semester 00-00 Final Exam Write your name on each sheet. I. Multiple Choice. Encircle the letter of the best answer. ( points each) Answer questions and based on the

More information

AP CS Unit 11: Graphics and Events

AP 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 information

Final Examination Semester 2 / Year 2012

Final Examination Semester 2 / Year 2012 Final Examination Semester 2 / Year 2012 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student s ID : Batch No. : Notes to candidates:

More information

TTTK Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings)

TTTK Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings) TTTK1143 - Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings) Topic: JApplet and ContentPane. 1. Complete the following class to create a Java Applet whose pane s background color is

More information

Java Help Files. by Peter Lavin. May 22, 2004

Java Help Files. by Peter Lavin. May 22, 2004 Java Help Files by Peter Lavin May 22, 2004 Overview Help screens are a necessity for making any application user-friendly. This article will show how the JEditorPane and JFrame classes, along with HTML

More information

CS 180 Fall 2006 Exam II

CS 180 Fall 2006 Exam II CS 180 Fall 2006 Exam II There are 20 multiple choice questions. Each one is worth 2 points. There are 3 programming questions worth a total of 60 points. Answer the multiple choice questions on the bubble

More information

To gain experience using GUI components and listeners.

To gain experience using GUI components and listeners. Lab 5 Handout 7 CSCI 134: Fall, 2017 TextPlay Objective To gain experience using GUI components and listeners. Note 1: You may work with a partner on this lab. If you do, turn in only one lab with both

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

User interfaces and Swing

User interfaces and Swing User interfaces and Swing Overview, applets, drawing, action listening, layout managers. APIs: java.awt.*, javax.swing.*, classes names start with a J. Java Lectures 1 2 Applets public class Simple extends

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

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

Midterm assessment - MAKEUP Fall 2010

Midterm 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 information

1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003

1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003 1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003 Name: E-mail Address: TA: Section: You have 3 hours to complete this exam. For coding questions,

More information

RAIK 183H Examination 2 Solution. November 11, 2013

RAIK 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 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

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages. 1 CS257 Computer Science I Kevin Sahr, PhD Lecture 14: Graphical User Interfaces Command-Line Applications 2 The programs we've explored thus far have been text-based applications A Java application is

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

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

Come & Join Us at VUSTUDENTS.net

Come & Join Us at VUSTUDENTS.net Come & Join Us at VUSTUDENTS.net For Assignment Solution, GDB, Online Quizzes, Helping Study material, Past Solved Papers, Solved MCQs, Current Papers, E-Books & more. Go to http://www.vustudents.net and

More information

Lecture 28. Exceptions and Inner Classes. Goals. We are going to talk in more detail about two advanced Java features:

Lecture 28. Exceptions and Inner Classes. Goals. We are going to talk in more detail about two advanced Java features: Lecture 28 Exceptions and Inner Classes Goals We are going to talk in more detail about two advanced Java features: Exceptions supply Java s error handling mechanism. Inner classes ease the overhead of

More information

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015 CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015 Name: This exam consists of 5 problems on the following 7 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet

More information

Java Programming Lecture 6

Java 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 information

Graphical User Interfaces

Graphical 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 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

University of Cape Town Department of Computer Science. Computer Science CSC117F Solutions

University of Cape Town Department of Computer Science. Computer Science CSC117F Solutions University of Cape Town Department of Computer Science Computer Science CSC117F Solutions Class Test 4 Wednesday 14 May 2003 Marks: 40 Approximate marks per question are shown in brackets Time: 40 minutes

More information

Graphics programming. COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson)

Graphics programming. COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson) Graphics programming COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson) Overview Aims To provide an overview of Swing and the AWT To show how to build

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

2. (True/False) All methods in an interface must be declared public.

2. (True/False) All methods in an interface must be declared public. Object and Classes 1. Create a class Rectangle that represents a rectangular region of the plane. A rectangle should be described using four integers: two represent the coordinates of the upper left corner

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

CS 209 Programming in Java #10 Exception Handling

CS 209 Programming in Java #10 Exception Handling CS 209 Programming in Java #10 Exception Handling Textbook Chapter 15 Spring, 2006 Instructor: J.G. Neal 1 Topics What is an Exception? Exception Handling Fundamentals Errors and Exceptions The try-catch-finally

More information

Chapter 12 Advanced GUIs and Graphics

Chapter 12 Advanced GUIs and Graphics Chapter 12 Advanced GUIs and Graphics Chapter Objectives Learn about applets Explore the class Graphics Learn about the classfont Explore the classcolor Java Programming: From Problem Analysis to Program

More information

Points Missed on Page page 1 of 8

Points Missed on Page page 1 of 8 Midterm II - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Name: ID: Problem #1 (8 points) Rewrite the following code segment using a for loop instead of a while loop (that is

More information

Input from Files. Buffered Reader

Input from Files. Buffered Reader Input from Files Buffered Reader Input from files is always text. You can convert it to ints using Integer.parseInt() We use BufferedReaders to minimize the number of reads to the file. The Buffer reads

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

Graphical User Interfaces 2

Graphical 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 information

Lecture 9. Lecture

Lecture 9. Lecture Layout Components MVC Design PaCern GUI Programming Observer Design PaCern D0010E Lecture 8 - Håkan Jonsson 1 Lecture 8 - Håkan Jonsson 2 Lecture 8 - Håkan Jonsson 3 1 1. GUI programming In the beginning,

More information

+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage)

+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage) +! Lecture 3: ArrayList & Standard Java Graphics +! Today n Reading n Standard Java Graphics (on course webpage) n Objectives n Review for this week s lab and homework assignment n Miscellanea (Random,

More information

CS 180 Final Exam Review 12/(11, 12)/08

CS 180 Final Exam Review 12/(11, 12)/08 CS 180 Final Exam Review 12/(11, 12)/08 Announcements Final Exam Thursday, 18 th December, 10:20 am 12:20 pm in PHYS 112 Format 30 multiple choice questions 5 programming questions More stress on topics

More information

The University of Melbourne Department of Computer Science and Software Engineering Software Design Semester 2, 2003

The University of Melbourne Department of Computer Science and Software Engineering Software Design Semester 2, 2003 The University of Melbourne Department of Computer Science and Software Engineering 433-254 Software Design Semester 2, 2003 Answers for Tutorial 7 Week 8 1. What are exceptions and how are they handled

More information

Name: CSC143 Exam 1 1 CSC 143. Exam 1. Write also your name in the appropriate box of the scantron

Name: CSC143 Exam 1 1 CSC 143. Exam 1. Write also your name in the appropriate box of the scantron Name: CSC143 Exam 1 1 CSC 143 Exam 1 Write also your name in the appropriate box of the scantron Name: CSC143 Exam 1 2 Multiple Choice Questions (30 points) Answer all of the following questions. READ

More information

Welcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068

Welcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068 Welcome to! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) Overview JAVA and GUIs: SWING Container, Components, Layouts Using SWING Streams and Files Text

More information

Exception Handling in Java. An Exception is a compile time / runtime error that breaks off the

Exception Handling in Java. An Exception is a compile time / runtime error that breaks off the Description Exception Handling in Java An Exception is a compile time / runtime error that breaks off the program s execution flow. These exceptions are accompanied with a system generated error message.

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors 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 CISC124, WINTER TERM, 2012 FINAL EXAMINATION 9am to 12pm, 26 APRIL 2012 Instructor: Alan McLeod If the instructor is

More information

SE1021 Exam 2. When returning your exam, place your note-sheet on top. Page 1: This cover. Page 2 (Multiple choice): 10pts

SE1021 Exam 2. When returning your exam, place your note-sheet on top. Page 1: This cover. Page 2 (Multiple choice): 10pts SE1021 Exam 2 Name: You may use a note-sheet for this exam. But all answers should be your own, not from slides or text. Review all questions before you get started. The exam is printed single-sided. Write

More information

Name: Checked: Learn about listeners, events, and simple animation for interactive graphical user interfaces.

Name: Checked: Learn about listeners, events, and simple animation for interactive graphical user interfaces. Lab 15 Name: Checked: Objectives: Learn about listeners, events, and simple animation for interactive graphical user interfaces. Files: http://www.csc.villanova.edu/~map/1051/chap04/smilingface.java http://www.csc.villanova.edu/~map/1051/chap04/smilingfacepanel.java

More information

GUI Forms and Events, Part II

GUI Forms and Events, Part II GUI Forms and Events, Part II Quick Start Compile step once always mkdir labs javac PropertyTax6.java cd labs Execute step mkdir 6 java PropertyTax6 cd 6 cp../5/propertytax5.java PropertyTax6.java Submit

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

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors 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 information

Exceptions, try - catch - finally, throws keyword. JAVA Standard Edition

Exceptions, try - catch - finally, throws keyword. JAVA Standard Edition Exceptions, try - catch - finally, throws keyword JAVA Standard Edition Java - Exceptions An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception

More information

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008

Overview. 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 information

Window Interfaces Using Swing. Chapter 12

Window Interfaces Using Swing. Chapter 12 Window Interfaces Using Swing 1 Reminders Project 7 due Nov 17 @ 10:30 pm Project 6 grades released: regrades due by next Friday (11-18-2005) at midnight 2 GUIs - Graphical User Interfaces Windowing systems

More information

CSE wi Final Exam 3/12/18 Sample Solution

CSE wi Final Exam 3/12/18 Sample Solution Question 1. (8 points, 2 each) Equality. Recall that there are several different notions of object equality that we ve encountered this quarter. In particular, we have the following three: Reference equality:

More information

JAVA NOTES GRAPHICAL USER INTERFACES

JAVA NOTES GRAPHICAL USER INTERFACES 1 JAVA NOTES GRAPHICAL USER INTERFACES Terry Marris 24 June 2001 5 TEXT AREAS 5.1 LEARNING OUTCOMES By the end of this lesson the student should be able to understand how to get multi-line input from the

More information

CS Exam 3 - Spring 2010

CS Exam 3 - Spring 2010 CS 1316 - Exam 3 - Spring 2010 Name: Grading TA: Section: INTEGRITY: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors 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 information

Laying Out Components. What is Widget Layout?

Laying Out Components. What is Widget Layout? Laying Out Components Interior Design for GUIs What is Widget Layout? Positioning widgets in their container (typically a JPanel or a JFrame s content pane) Basic idea: each widget has a size and position

More information

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

More information

CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM

CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM Objectives The objectives of this assignment are: to get your first experience with Java to become familiar with Eclipse Java

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

What is Widget Layout? Laying Out Components. Resizing a Window. Hierarchical Widget Layout. Interior Design for GUIs

What is Widget Layout? Laying Out Components. Resizing a Window. Hierarchical Widget Layout. Interior Design for GUIs What is Widget Layout? Laying Out Components Positioning widgets in their container (typically a JPanel or a JFrame s content pane) Basic idea: each widget has a size and position Main problem: what if

More information

PIC 20A GUI with swing

PIC 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 information

CS 11 java track: lecture 3

CS 11 java track: lecture 3 CS 11 java track: lecture 3 This week: documentation (javadoc) exception handling more on object-oriented programming (OOP) inheritance and polymorphism abstract classes and interfaces graphical user interfaces

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

Today. cisc3120-fall2012-parsons-lectiii.3 2

Today. cisc3120-fall2012-parsons-lectiii.3 2 MORE GUI COMPONENTS Today Last time we looked at some of the components that the: AWT Swing libraries provide for building GUIs in Java. This time we will look at several more GUI component topics. We

More information

Programmierpraktikum

Programmierpraktikum Programmierpraktikum Claudius Gros, SS2012 Institut für theoretische Physik Goethe-University Frankfurt a.m. 1 of 25 17/01/13 11:45 Swing Graphical User Interface (GUI) 2 of 25 17/01/13 11:45 Graphical

More information

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 :) )

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 :) ) 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 information

This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for computing and/or communicating) is NOT permitted.

This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for computing and/or communicating) is NOT permitted. York University AS/AK/ITEC 2610 3.0 All Sections OBJECT-ORIENTED PROGRAMMING Midterm Test Duration: 90 Minutes This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for

More information

OOP Assignment V. For example, the scrolling text (moving banner) problem without a thread looks like:

OOP Assignment V. For example, the scrolling text (moving banner) problem without a thread looks like: OOP Assignment V If we don t use multithreading, or a timer, and update the contents of the applet continuously by calling the repaint() method, the processor has to update frames at a blinding rate. Too

More information

CS 3331 Advanced Object-Oriented Programming Final Exam

CS 3331 Advanced Object-Oriented Programming Final Exam Fall 2015 (Thursday, December 3) Name: CS 3331 Advanced Object-Oriented Programming Final Exam This test has 5 questions and pages numbered 1 through 10. Reminders This test is closed-notes and closed-book.

More information

Java 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 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 information

Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics

Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics 1 Collections (from the Java tutorial)* A collection (sometimes called a container) is simply an object that

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

Project #1 Computer Science 2334 Fall 2008

Project #1 Computer Science 2334 Fall 2008 Project #1 Computer Science 2334 Fall 2008 User Request: Create a Word Verification System. Milestones: 1. Use program arguments to specify a file name. 10 points 2. Use simple File I/O to read a file.

More information

1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003

1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003 1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003 Name: E-mail Address: TA: Section: You have 3 hours to complete this exam. For coding questions,

More information

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline Java Intro 3 9/7/2007 1 Java Intro 3 Outline Java API Packages Access Rules, Class Visibility Strings as Objects Wrapper classes Static Attributes & Methods Hello World details 9/7/2007 2 Class Libraries

More information

JRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();

JRadioButton 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 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

Intro: Your brain on Java Who is this book for? What your brain is thinking. Bend your brain into submission What you need for this book

Intro: Your brain on Java Who is this book for? What your brain is thinking. Bend your brain into submission What you need for this book Intro: Your brain on Java Who is this book for? p. xx What your brain is thinking p. xxi Metacognition p. xxiii Bend your brain into submission p. xxv What you need for this book p. xxvi Technical editors

More information

Lecture 5: Java Graphics

Lecture 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 information

2IS45 Programming

2IS45 Programming Course Website Assignment Goals 2IS45 Programming http://www.win.tue.nl/~wsinswan/programmeren_2is45/ Rectangles Learn to use existing Abstract Data Types based on their contract (class Rectangle in Rectangle.

More information