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

Size: px
Start display at page:

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

Transcription

1 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 instructor is unavailable in the examination room and if doubt exists as to the interpretation of any problem, the candidate is urged to submit with the answer paper a clear statement of any assumptions made. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Please write your answers in the boxes provided. Extra space is available on the last page of the exam. The back of any page can be used for rough work. This exam is three hours long and refers exclusively to the use of the Java language. Comments are not required in the code you write. For full marks, code must be efficient as well as correct. This is a closed book exam. No computers or calculators are allowed. Student Number: Problem 1: / 20 Problem 4: / 15 Problem 2: / 10 Problem 5: / 10 Problem 3: / 15 TOTAL: / 70

2 Student Number: Page 2 of 17 Problem 1) [20 marks] Fundamental Java Starting below and continuing in the box on the next page write a static void method called prepare() that accepts a 2D array of int values of any size. The method will then sort this 2D array, in situ, based on the sum of the values in each row, so that the row with the smallest sum ends up at the top of the 2D array and the row with the largest sum is at the bottom of the array. The values within a row will not be moved around only the entire row itself. You may use any sorting algorithm you please. For example, selection sort would be appropriate, where the smallest remaining value in the unsorted portion of a collection is located and then swapped with the value one location above the sorted portion of the collection. For example, if the following 2D collection of numbers is supplied to prepare(): it will be altered to be: You may write any other supporting methods you need, but you do not need a main method. If the supplied 2D array has only one row, is empty or is null it is sufficient to just exit the method.

3 Student Number: Page 3 of 17 Problem 1, Cont.)

4 Student Number: Page 4 of 17 Problem 2) [10 marks] Fundamental Java The main method for this program is on the next page. In the box provided on the next page, complete the console output of this program. The output of the first call to printtwod() is given so you can see how this method works. public class Problem2 { public static int attr = 0; public static int method1(int[][] twod, int[] oned, int nod) { int max = 0; for(int i = 0; i < twod.length; i++) if (sumrow(twod[i]) > max) { max = sumrow(twod[i]); nod = i; // end if for(int i = 0; i < twod[nod].length; i++) { oned[i] = twod[nod][i]; twod[nod][i] = 0; // end for return max; // end method1 public static int sumrow(int[] oned) { int sum = 0; for(int i = 0; i < oned.length; i++) sum = sum + oned[i]; attr = attr + sum; return sum; // end sumrow public static void printoned(int[] oned) { for(int i = 0; i < oned.length; i++) System.out.print(oneD[i] + " "); // end printoned public static void printtwod(int[][] twod) { for(int i = 0; i < twod.length; i++) { printoned(twod[i]); System.out.print("\n"); // end for // end printtwod

5 Student Number: Page 5 of 17 Problem 2, Cont.) public static void main(string[] args) { int[][] test2d = {{0, 0, 0, 1, {0, 0, 1, 1, {1, 1, 1, 1, {1, 0, 1, 1; int[] test1d = {2, 1, 2, 1; int anum = 0; printtwod(test2d); // This output is supplied System.out.println(method1(test2D, test1d, anum)); printtwod(test2d); printoned(test1d); System.out.println("\naNum = " + anum); System.out.println("attr = " + attr); // end main // end Problem2 Complete the output from here down:

6 Student Number: Page 6 of 17 Problem 3) [15 marks] Java Hierarchy Here is the Machine class: public abstract class Machine { private String model; private String manuf; private double cost; public Machine(String manuf, String model, double cost) { this.manuf = manuf; this.model = model; this.cost = public String tostring() { String output = manuf + " " + model + ", $"; output += String.format("%.2f", cost); return output; public abstract String getuse(); // end Machine And here is a class demonstrating the use of the hierarchy: public class Problem3 { public static void main(string[] args) { Machine[] machines = new Machine[5]; machines[0] = new Serger("Janome", "MAGNOLIA7034D", 400, 4); machines[1] = new SewingMachine("Janome", "HT2008", 500); machines[2] = new Embroidery("Janome", "MC11000", 5700, true); machines[3] = new SewingMachine("Singer", "7463", 200); machines[4] = new Embroidery("Kenmore", "Elite", 1200, false); for (int i = 0; i < 5; i++) { System.out.print(machines[i].getUse()); System.out.println(machines[i]); // end main // end Problem3 /* OUTPUT: Serger machine: Janome MAGNOLIA7034D, $400.00, 4 threads. Sewing machine: Janome HT2008, $ Embroidering machine: Janome MC11000, $ , has a touch screen. Sewing machine: Singer 7463, $ Embroidering machine: Kenmore Elite, $ , does not have a touch screen. */

7 Student Number: Page 7 of 17 Problem 3, Cont.) On this page and the next, write the minimum amount of code for the classes required to complete the hierarchy so that the Problem3 class performs as indicated by the listed output. Assume all parameters will be legal, so no error checking is required. Note that a sewing machine is a machine, a serger is a sewing machine and an embroidering machine is a sewing machine.

8 Student Number: Page 8 of 17 Problem 3, Cont.)

9 Student Number: Page 9 of 17 Problem 4) [15 marks] Threading In assignment 5 the code used to calculate the colours for the Mandelbrot figure was quite time consuming. When it was running, nothing else on the window was responsive. For this problem, you will need to alter the assignment 5 solution code so that the calculation and display operations will run on a separate thread. You create a thread by extending the Thread class. In this thread class you need to override the public void run() method. You will also find the following Thread methods useful: start() starts the thread by executing the run() method of the thread. Once the thread is started it can only be interrupted, it cannot be re-started. So, as long as the run method is executing, the thread will be active. If the run method completes without being interrupted, the thread becomes inactive and cannot be re-started. The thread would have to be re-instantiated to start it again in this case. interrupt() causes an InterruptedException to be thrown. Code inside run() must be prepared to catch this exception and stop the loop used by the thread. sleep(nmilliseconds) used inside the loop used by the thread to set the thread to sleep for a short time so other threads can execute. Will also catch and then propagate the InterruptedException. If you can remember other Thread class methods and think they will be useful feel free to use them. For example the isactive() method might be useful. It returns true if the thread has been started and not interrupted, and false otherwise. The yield() method yields control to any pending threads. On the next page is a listing of the pertinent parts of the assignment 5 sample solution. You will not need any code that is not listed here, so it is represented by a comment instead.

10 Student Number: Page 10 of 17 Problem 4, Cont.) // All needed imports are carried out public class FractalWindowBufferedImage extends JFrame { private DrawPanel drawingzone; // Other class attributes public FractalWindowBufferedImage() { // Constructor code private class DrawPanel extends JPanel { // DrawPanel constructor, etc. public void paintcomponent(graphics g) { int row, col; Graphics2D g2d = (Graphics2D)g; // Other declarations // Get the height and width of drawingzone BufferedImage pretty = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // Iterate through the entire panel, pixel by pixel for (row = 0; row < height; row++) { for (col = 0; col < width; col++) { // Calculate the pixel colour and use setrgb on pretty g2d.drawrenderedimage(pretty, null); // end paint // end DrawPanel // Carried out by exit button private class EndingListener implements ActionListener { public void actionperformed(actionevent e) { System.exit(0); // end actionperformed method // end EndingListener class // Other listeners // end FractalWindowBufferedImage class On the next two pages, write the code you need to add to the above class in order to thread the calculation and display operations currently carried out in paintcomponent(). Identify the area of the class in which you are adding or changing code by using the names: class attribute section, class constructor section, inner classes section, or identify the existing method or inner class that you are modifying by name. Repeat whatever code you need to use to make your intentions clear.

11 Student Number: Page 11 of 17 Problem 4, Cont.)

12 Student Number: Page 12 of 17 Problem 4, Cont.)

13 Student Number: Page 13 of 17 Problem 5) [10 marks] Here is a complete GUI program, sprawling over this and the next two pages: import javax.swing.jframe; import javax.swing.jbutton; import javax.swing.jpanel; import javax.swing.jlabel; import javax.swing.jtextfield; import java.awt.event.actionlistener; import java.awt.event.actionevent; import java.awt.borderlayout; import java.awt.flowlayout; import java.awt.font; public class Problem5 extends JFrame { private final int WINDOW_WIDTH = 300; private final int WINDOW_HEIGHT = 140; private JTextField txtwidth = new JTextField(8); private JTextField txtheight = new JTextField(8); private JLabel lblwidtherror = new JLabel("Illegal Width!"); private JLabel lblheighterror = new JLabel("Illegal Height!"); private JLabel lblresult = new JLabel("Area ="); public Problem5() { super(); setlayout(new BorderLayout()); settitle("problem 5"); setdefaultcloseoperation(jframe.exit_on_close); setsize(window_width, WINDOW_HEIGHT); setresizable(false); setlocation(200, 200); Font myfont = new Font("Arial", Font.BOLD, 16); JPanel toppanel = new JPanel(new FlowLayout()); JPanel centrepanel = new JPanel(new FlowLayout()); JLabel lblwidth = new JLabel("Width:"); lblwidth.setfont(myfont); JLabel lblheight = new JLabel("Height:"); lblheight.setfont(myfont); txtwidth.setfont(myfont); txtheight.setfont(myfont); lblwidtherror.setfont(myfont); lblwidtherror.setvisible(false); lblheighterror.setfont(myfont); lblheighterror.setvisible(false);

14 Student Number: Page 14 of 17 Problem 5, Cont.) toppanel.add(lblwidth); toppanel.add(txtwidth); toppanel.add(lblwidtherror); centrepanel.add(lblheight); centrepanel.add(txtheight); centrepanel.add(lblheighterror); add(toppanel, BorderLayout.NORTH); add(centrepanel, BorderLayout.CENTER); JPanel bottompanel = new JPanel(new BorderLayout()); lblresult.setfont(myfont); JButton calculatebutton = new JButton("Calculate"); calculatebutton.setfont(myfont); calculatebutton.addactionlistener(new CalculateListener()); JButton exitbutton = new JButton("Close"); exitbutton.setfont(myfont); exitbutton.addactionlistener(new EndingListener()); bottompanel.add(calculatebutton, BorderLayout.WEST); bottompanel.add(lblresult, BorderLayout.CENTER); bottompanel.add(exitbutton, BorderLayout.EAST); add(bottompanel, BorderLayout.SOUTH); // end Problem5 constructor private class EndingListener implements ActionListener { public void actionperformed(actionevent e) { System.exit(0); // end actionperformed method // end EndingListener class

15 Student Number: Page 15 of 17 Problem 5, Cont.) private class CalculateListener implements ActionListener { public void actionperformed(actionevent e) { boolean widthok, heightok; double width = 0, height = 0, area; lblwidtherror.setvisible(false); lblheighterror.setvisible(false); lblresult.settext(""); widthok = true; try { width = Double.parseDouble(txtWidth.getText()); if (width <= 0) widthok = false; catch(numberformatexception except) { widthok = false; heightok = true; try { height = Double.parseDouble(txtHeight.getText()); if (height <= 0) heightok = false; catch(numberformatexception except) { heightok = false; if (!widthok) lblwidtherror.setvisible(true); if (!heightok) lblheighterror.setvisible(true); if (widthok && heightok) { area = width * height; lblresult.settext("area = " + area); // end actionperformed method // end CalculateListener class public static void main(string[] args) { Problem5 gui = new Problem5(); gui.setvisible(true); // end main // end Problem5

16 Student Number: Page 16 of 17 Problem 5, Cont.) Sketch the appearance of this window for each of the three following cases. Use the following key to draw your components: A Label: A Text Box A Button a) As the window first appears, without any user entry or actions: b) If the user enters 2 for the width and 3 for the height and clicks on Calculate : c) If the user enters Summer for the width and Vacation! for the height and clicks on Calculate :

17 Student Number: Page 17 of 17 (Extra page)

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 CISC124, WINTER TERM, 2009 FINAL EXAMINATION 7pm to 10pm, 18 APRIL 2009, Dunning Hall Instructor: Alan McLeod

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, 2008 FINAL EXAMINATION 7pm to 10pm, 17 DECEMBER 2008, Grant Hall Instructor: Alan McLeod

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 CMPE212, FALL TERM, 2012 FINAL EXAMINATION 18 December 2012, 2pm Instructor: Alan McLeod If the instructor is unavailable

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, 2009 FINAL EXAMINATION 14 DECEMBER 2009 Instructor: Alan McLeod If the instructor is unavailable

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

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

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, 2007 FINAL EXAMINATION 7pm to 10pm, 10 DECEMBER 2007, Jeffery Hall Instructor: Alan McLeod If the

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, 2007 FINAL EXAMINATION 7pm to 10pm, 10 DECEMBER 2007, Jeffery Hall Instructor: Alan McLeod

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 CISC124, WINTER TERM, 2010 FINAL EXAMINATION 2pm to 5pm, 19 APRIL 2010, Dunning Hall Instructor: Alan McLeod

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

Page 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. 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 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, 2009 FINAL EXAMINATION 14 DECEMBER 2009 SOLUTION Instructor: Alan McLeod If the instructor is unavailable

More information

Page 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. 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 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, 2011 FINAL EXAMINATION 7pm to 10pm, 26 APRIL 2011, Ross Gym Instructor: Alan McLeod If the instructor

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 CISC212, FALL TERM, 2010 FINAL EXAMINATION 11 DECEMBER 2010, 9am SOLUTION HAND IN Answers Are Recorded on Question Paper Instructor: Alan McLeod If the instructor

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, FALL TERM, 2013 FINAL EXAMINATION 7pm to 10pm, 18 DECEMBER 2013 Instructor: Alan McLeod If the instructor

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 UNIVERSIY SCHOOL O COMPUING CMPE212, ALL ERM, 2011 INAL EXAMINAION 15 December 2011, 2pm, Grant Hall Instructor: Alan McLeod HAND IN Answers Are Recorded on Question Paper SOLUION If the instructor

More information

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

SampleApp.java. Page 1

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

17 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

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

CSIS 10A Assignment 7 SOLUTIONS

CSIS 10A Assignment 7 SOLUTIONS CSIS 10A Assignment 7 SOLUTIONS Read: Chapter 7 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,

More information

DM503 Programming B. Peter Schneider-Kamp.

DM503 Programming B. Peter Schneider-Kamp. DM503 Programming B Peter Schneider-Kamp petersk@imada.sdu.dk! http://imada.sdu.dk/~petersk/dm503/! ADVANCED OBJECT-ORIENTATION 2 Object-Oriented Design classes often do not exist in isolation from each

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 UNIVERSIY SCHOOL O COMPUING CISC124, WINER ERM, 2011 INAL EXAMINAION 7pm to 10pm, 26 APRIL 2011, Ross Gym HAND IN Answers Are Recorded on Question Paper SOLUION Instructor: Alan McLeod If the instructor

More information

Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords

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 information

Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb

Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb HAND IN Answers recorded on Examination paper This examination is THREE HOURS

More information

CSCI 201L Midterm Written Summer % of course grade

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

COMP16121 Sample Code Lecture 1

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

Example: Building a Java GUI

Example: Building a Java GUI Steven Zeil October 25, 2013 Contents 1 Develop the Model 2 2 Develop the layout of those elements 3 3 Add listeners to the elements 9 4 Implement custom drawing 12 1 The StringArt Program To illustrate

More information

Example: Building a Java GUI

Example: Building a Java GUI Steven Zeil October 25, 2013 Contents 1 Develop the Model 3 2 Develop the layout of those elements 4 3 Add listeners to the elements 12 4 Implement custom drawing 15 1 The StringArt Program To illustrate

More information

Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008

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

Dr. Hikmat A. M. AbdelJaber

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

Java Never Ends MULTITHREADING 958 Example: A Nonresponsive GUI 959

Java Never Ends MULTITHREADING 958 Example: A Nonresponsive GUI 959 CHAPTER 19 Java Never Ends 19.1 MULTITHREADING 958 Example: A Nonresponsive GUI 959 Thread.sleep 959 The getgraphics Method 963 Fixing a Nonresponsive Program Using Threads 964 Example: A Multithreaded

More information

The Islamic University Gaza Department of Electrical & Computer Engineering. Midterm Exam Spring 2012 Computer Programming II (Java) ECOM 2324

The Islamic University Gaza Department of Electrical & Computer Engineering. Midterm Exam Spring 2012 Computer Programming II (Java) ECOM 2324 The Islamic University Gaza Department of Electrical & Computer Engineering Midterm Exam Spring 2012 Computer Programming II (Java) ECOM 2324 Instructor: Dipl.-Ing. Abdelnasser Abdelhadi Date: 31.03.2013

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

Page 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. 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, 2004 FINAL EXAMINATION 9am to 12noon, 22 DECEMBER 2004 Instructors: Alan

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 CISC124, FALL TERM, 2013 FINAL EXAMINATION 7pm to 10pm, 18 DECEMBER 2013 Instructor: Alan McLeod HAND IN Answers Are Recorded on Question Paper SOLUTION If the instructor

More information

GUI (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. 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 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

Java Never Ends CHAPTER MULTITHREADING 1100 Example: A Nonresponsive GUI 1101

Java Never Ends CHAPTER MULTITHREADING 1100 Example: A Nonresponsive GUI 1101 CHAPTER 20 Java Never Ends 20.1 MULTITHREADING 1100 Example: A Nonresponsive GUI 1101 Thread.sleep 1101 The getgraphics Method 1105 Fixing a Nonresponsive Program Using Threads 1106 Example: A Multithreaded

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

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 Exam Paper CMPE212, WINTER TERM, 2016 FINAL EXAMINATION 9am to 12pm, 19 APRIL 2016 Instructor: Alan McLeod If the instructor is unavailable

More information

CSCI 201L Midterm Written SOLUTION Summer % of course grade

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

APPENDIX. public void cekroot() { System.out.println("nilai root : "+root.data); }

APPENDIX. public void cekroot() { System.out.println(nilai root : +root.data); } APPENDIX CLASS NODE AS TREE OBJECT public class Node public int data; public Node left; public Node right; public Node parent; public Node(int i) data=i; PROCEDURE BUILDING TREE public class Tree public

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

Graphical User Interface

Graphical User Interface Lecture 10 Graphical User Interface An introduction Sahand Sadjadee sahand.sadjadee@liu.se Programming Fundamentals 725G61 http://www.ida.liu.se/~725g61/ Department of Computer and Information Science

More information

Graphical User Interfaces in Java - SWING

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

More information

Swing I CHAPTER EVENT-DRIVEN PROGRAMMING 921 Events and Listeners 921

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

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

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

More information

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

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

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

Swing I Event-Driven Programming Buttons, Events, and Other Swing Basics Containers and Layout Managers 946

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

Agenda. Container and Component

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

More information

Introduction. Introduction

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

More information

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

State Application Using MVC

State Application Using MVC State Application Using MVC 1. Getting ed: Stories and GUI Sketch This example illustrates how applications can be thought of as passing through different states. The code given shows a very useful way

More information

AnimatedImage.java. Page 1

AnimatedImage.java. Page 1 1 import javax.swing.japplet; 2 import javax.swing.jbutton; 3 import javax.swing.jpanel; 4 import javax.swing.jcombobox; 5 import javax.swing.jlabel; 6 import javax.swing.imageicon; 7 import javax.swing.swingutilities;

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

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

1.00/ Introduction to Computers and Engineering Problem Solving. Quiz 2 / November 5, 2004

1.00/ Introduction to Computers and Engineering Problem Solving. Quiz 2 / November 5, 2004 1.00/1.001 Introduction to Computers and Engineering Problem Solving Quiz 2 / November 5, 2004 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do

More information

Chapter 13 Lab Advanced GUI Applications

Chapter 13 Lab Advanced GUI Applications Gaddis_516907_Java 4/10/07 2:10 PM Page 113 Chapter 13 Lab Advanced GUI Applications Objectives Be able to add a menu to the menu bar Be able to use nested menus Be able to add scroll bars, giving the

More information

Answer on question #61311, Programming & Computer Science / Java

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

INTRODUCTION TO (GUIS)

INTRODUCTION TO (GUIS) INTRODUCTION TO GRAPHICAL USER INTERFACES (GUIS) Lecture 10 CS2110 Fall 2009 Announcements 2 A3 will be posted shortly, please start early Prelim 1: Thursday October 14, Uris Hall G01 We do NOT have any

More information

Eclipsing Your IDE. Figure 1 The first Eclipse screen.

Eclipsing Your IDE. Figure 1 The first Eclipse screen. Eclipsing Your IDE James W. Cooper I have been hearing about the Eclipse project for some months, and decided I had to take some time to play around with it. Eclipse is a development project (www.eclipse.org)

More information

Section Basic graphics

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

FirstSwingFrame.java Page 1 of 1

FirstSwingFrame.java Page 1 of 1 FirstSwingFrame.java Page 1 of 1 2: * A first example of using Swing. A JFrame is created with 3: * a label and buttons (which don t yet respond to events). 4: * 5: * @author Andrew Vardy 6: */ 7: import

More information

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

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)

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

AppBisect > PrBisect > class Functie. AppBisect > PrBisect > class Punct. public class Functie { double x(double t) { return t;

AppBisect > PrBisect > class Functie. AppBisect > PrBisect > class Punct. public class Functie { double x(double t) { return t; 1 AppBisect > PrBisect > class Punct public class Punct { double x,y; public Punct(double x, double y) { this.x = x; this.y = y; public void setx(double x) { this.x = x; public double getx() { return x;

More information

CMP-326 Exam 2 Spring 2018 Solutions Question 1. Version 1. Version 2

CMP-326 Exam 2 Spring 2018 Solutions Question 1. Version 1. Version 2 Question 1 30 30 60 60 90 20 20 40 40 60 Question 2 a. b. public Song(String title, String artist, int length, String composer) { this.title = title; this.artist = artist; this.length = length; this.composer

More information

Queens College, CUNY Department of Computer Science. CS 212 Object-Oriented Programming in Java Practice Exam 2. CS 212 Exam 2 Study Guide

Queens College, CUNY Department of Computer Science. CS 212 Object-Oriented Programming in Java Practice Exam 2. CS 212 Exam 2 Study Guide Topics for Exam 2: Queens College, CUNY Department of Computer Science CS 212 Object-Oriented Programming in Java Practice Exam 2 CS 212 Exam 2 Study Guide Linked Lists define a list node define a singly-linked

More information

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

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

More information

CSC 160 LAB 8-1 DIGITAL PICTURE FRAME. 1. Introduction

CSC 160 LAB 8-1 DIGITAL PICTURE FRAME. 1. Introduction CSC 160 LAB 8-1 DIGITAL PICTURE FRAME PROFESSOR GODFREY MUGANDA DEPARTMENT OF COMPUTER SCIENCE 1. Introduction Download and unzip the images folder from the course website. The folder contains 28 images

More information

encompass a group of features for building Graphical User Interfaces (GUI).

encompass a group of features for building Graphical User Interfaces (GUI). Java GUI (intro) JFC Java Foundation Classes encompass a group of features for building Graphical User Interfaces (GUI). javax.swing.* used for building GUIs. Some basic functionality is already there

More information

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ GRAPHICAL USER INTERFACES 2 HelloWorld Reloaded

More information

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

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

Introduction This assignment will ask that you write a simple graphical user interface (GUI). Computing and Information Systems/Creative Computing University of London International Programmes 2910220: Graphical Object-Oriented and Internet programming in Java Coursework one 2011-12 Introduction

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

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, FALL TERM, 2015 FINAL EXAMINATION 7pm to 10pm, 15 DECEMBER 2015 Instructor: Alan McLeod If the instructor

More information

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

Calculator Class. /** * Create a new calculator and show it. */ public Calculator() { engine = new CalcEngine(); gui = new UserInterface(engine); }

Calculator Class. /** * Create a new calculator and show it. */ public Calculator() { engine = new CalcEngine(); gui = new UserInterface(engine); } A Calculator Project This will be our first exposure to building a Graphical User Interface (GUI) in Java The functions of the calculator are self-evident The Calculator class creates a UserInterface Class

More information

// autor igre Ivan Programerska sekcija package mine;

// autor igre Ivan Programerska sekcija package mine; // autor igre Ivan Bauk @ Programerska sekcija package mine; import java.awt.color; import java.awt.flowlayout; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener;

More information

Chapter 13 Lab Advanced GUI Applications Lab Objectives. Introduction. Task #1 Creating a Menu with Submenus

Chapter 13 Lab Advanced GUI Applications Lab Objectives. Introduction. Task #1 Creating a Menu with Submenus Chapter 13 Lab Advanced GUI Applications Lab Objectives Be able to add a menu to the menu bar Be able to use nested menus Be able to add scroll bars, giving the user the option of when they will be seen.

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

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

Based on slides by Prof. Burton Ma

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

Assignment 2. Application Development

Assignment 2. Application Development Application Development Assignment 2 Content Application Development Day 2 Lecture The lecture covers the key language elements of the Java programming language. You are introduced to numerical data and

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

CS Exam 1 Review Suggestions

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

Part I: Learn Common Graphics Components

Part I: Learn Common Graphics Components OOP GUI Components and Event Handling Page 1 Objectives 1. Practice creating and using graphical components. 2. Practice adding Event Listeners to handle the events and do something. 3. Learn how to connect

More information

CS108, Stanford Handout #22. Thread 3 GUI

CS108, 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 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

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