CHAPTER 7 & 8 REVIEW QUESTIONS

Slides:



Advertisements
Similar presentations
Graphical User Interfaces
Advertisements

Basic Java – Interface design. Understand: How to use TextPad for Java How to define classes and objects How to create a GUI interface How event-driven.
Java Software Development Paradigm Lecture # 12. Basics of GUI.
CS18000: Problem Solving and Object-Oriented Programming.
Graphic User Interfaces Layout Managers Event Handling.
F27SB2 Programming Languages
CMSC 341 Building Java GUIs. 09/26/2007 CMSC 341 GUI 2 Why Java GUI Development? Course is about Data Structures, not GUIs. We are giving you the opportunity.
Introduction to Java Classes, events, GUI’s. Understand: How to use TextPad How to define a class or object How to create a GUI interface How event-driven.
Java Swing Recitation – 11/(20,21)/2008 CS 180 Department of Computer Science, Purdue University.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
Chapter 121 Window Interfaces Using Swing Chapter 12.
Layout Mangers CSC 171 FALL 2001 LECTURE 14. History: The Transistor William Shockley, John Bardeen, and Walter Brattain invent the transfer resistance.
© The McGraw-Hill Companies, 2006 Chapter 10 Graphics and event- driven programs.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
Scott Grissom, copyright 2006Ch 11: GUI Slide 1 Graphical User Interfaces (Ch 11) Careful design of a graphical user interface is key to a viable software.
Chapter 6: Graphical User Interface (GUI) and Object-Oriented Design (OOD) J ava P rogramming: Program Design Including Data Structures Program Design.
Advanced Java and Android Programming Day 1: Introduction to GUI Programming Intro to GUI Programming1.
Introduction to GUI Java offers a great number of pre-defined classes to support the development of graphical user interfaces –These are broken down into.
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
Combo Box, Check Boxes, and Radio Buttons. Radio Buttons User can click radio buttons, just like other buttons BUT Radio buttons are mutually exclusive.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
Java GUI building with Swing. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
1 Why layout managers Can we perform layout without them? –Yes. A container’s layout property can be set to null. Absolute positioning: specify size and.
GUI Components and Design Here we add one more component to our programs, JButtons –JButtons can only be inserted into JPanels (or JApplets) –Clicking.
Java SE 8 for Programmers, Third Edition
1 Outline 1 Introduction 2 Overview of Swing Components 3 JLabel 4 Event Handling 5 TextFields 6 How Event Handling Works 7 JButton 8 JCheckBox and JRadioButton.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Field Trip #31 CrossWord Puzzle By Keith Lynn. JApplet A JApplet is a top-level container in Java We will use the JApplet to contain two Jpanels The first.
GUI Clients 1 Enterprise Applications CE00465-M Clients with Graphical User Interfaces.
Copyright © 2002, Systems and Computer Engineering, Carleton University c-Gui3.ppt * Object-Oriented Software Development Part 18-c Building.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
GUI Basics. What is GUI? A graphical user interface (GUI) is a type of user interface item that allows people to interact with programs in more ways than.
1 / 67 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 14 Programming Fundamentals using Java 1.
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Introduction to Java Chapter 9 - Graphical User Interfaces and Applets1 Chapter 9 Graphical User Interfaces and Applets.
GUI Basics. Agenda What GUI How to make in java Creating frames Frequently used GUI components Layout Managers.
Java Programming: From Problem Analysis to Program Design, Second Edition1 Lecture 5 Objectives  Learn about basic GUI components.  Explore how the GUI.
Review_6 AWT, Swing, ActionListener, and Graphics.
Computer Science 209 GUIs Model/View/Controller Layouts.
Ajmer Singh PGT(IP) JAVA IDE Programming - I. Ajmer Singh PGT(IP) GUI (Graphical User Interface) It is an interface that uses a graphic entities along.
1 Layout Managers Layout managers –Provided for arranging GUI components –Provide basic layout capabilities –Processes layout details –Programmer can concentrate.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 17.1 Test-Driving the Student Grades Application.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Swing GUI Components So far, we have written GUI applications which can ‘ draw ’. These applications are simple, yet typical of all Java GUI applications.
Graphical User Interface (GUI)
Event Handler Methods Text field Object Responder JAVA AWT Environment: Messages are sent between JAVA Objects Screen Event Notification Press Button.
5-1 GUIs and Events Rick Mercer. 5-2 Event-Driven Programming with Graphical user Interfaces  Most applications have graphical user interfaces to respond.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
Java Programming Fifth Edition Chapter 13 Introduction to Swing Components.
GUIs & Event-Driven Programming Chapter 11 Review.
Unit 131 GUI Layout Managers Learning Outcomes oList and distinguish between the four most common, standard layout managers in Java. oUse these and other.
Modular Event Handling
GUIs and Events Rick Mercer.
Christopher Budo, Davis Nygren, spencer franks, Luke miller
Lecture 16 More GUI programming
“Form Ever Follows Function” Louis Henri Sullivan
GUIs Model/View/Controller Layouts
Graphical User Interface (pronounced "gooey")
Java Programming: From Problem Analysis to Program Design,
Ellen Walker Hiram College
Chapter 13: Advanced GUIs and Graphics
Chapter 8 Objects and Classes Part 1
Constructors, GUI’s(Using Swing) and ActionListner
FINAL EXAM Final Exam Wednesday, Dec 14: 8: :00 AM (Frny G140)
Advanced GUIs and Graphics
Graphical User Interface
FINAL EXAM Final Exam Tuesday, May 3: 1:00 - 3:00 PM (Phys 112)
Presentation transcript:

CHAPTER 7 & 8 REVIEW QUESTIONS ______ class is used to create a frame using Swing.

The default layout manager of JPanel object is ______.

The default layout manager of JFrame object is ______.

The default allignment of a FlowLayout manager is ______ allignment.

Adding radio button components to an object of ________ class will create a mutually exclusive relationship between them.

A panel can not be displayed by itself.

You can place multiple components inside a GridLayout cell.

You can place multiple components inside a BorderLayout region.

You can place a panel inside a BorderLayout region.

You can write a class that extends the JPanel class.

What kind of Listener should be used for JButton and JTextField objects?

What kind of Listener should be used for JCheckBox and JRadioButton objects?

What import statement must you include in your code to use a ActionListener class?

Which class is used to create a Border object?

The type of parameter in the setVisible() method of JFrame class is:

The type of parameter in the actionPerformed() method of ActionListener interface is:

The type of parameter in the itemStateChanged() method of ItemListener interface is:

Which method in the ActionEvent class is used to identify the source of an action event?

Given a JPanel object p, which of the followings is the correct statement to set the GridLayout manager of dimension 3 by 4 for p?

The default alignment of FlowLayout manager is:

What method is used to set a border around a panel?

Each element of an array is accessed by a number known as a ________?

The first subscript in an array is always ____.

If n is the number of elements in an array, then the last subscript in this array is _____.

The array field that holds the number of elements in an array is ______.

To insert an item into an ArrayList object, you use this method.

An array’s size declarator can be a negative integer expression.

Both of the following declarations are legal and equivalent: int [] n; int n [];

Java compiler does not display an error message when it processes a statement that uses an invalid subscript.

Each row in a two-dimensional array can have a different length.

An ArrayList automatically expands in size to accommodate the items stored in it. True or false?

What will be the output when running the following program? public class MyClass { public static void main(String args[]) { int [][]a = { {3,5,1,2}, {0,1,3,4}, {1,2,9,8}}; int i=1; int j; for (j=1; j<=2; ++j){ a[i][j] += a[j][i]; } System.out.println(a[i][j-1]);

What results from the following fragment of code? int x = 1; String [] names ={“Fred”, “Jim”, “Sheila” }; names[--x] += “.”; for (int i = 0; i < names.length; i++) { System.out.println(names[i]); }

Given the following code fragment: int [] array = {2, 3, 6, 4, 1, 7, 9, 12}; int i = 1; int j = 2*i + 1; What is the value of array[j]?

Given the following code fragment: int [][] array = new int[5][]; for (int i = 0; i < 5; i++) array[i] = new int[i+1]; for (int j = 0; j < array[i].length; j++) array[i][j] = i + j; How many elements does array have?

What import statement must you include in your code to use a Arrays and ArrayList class?

To delete an item from an ArrayList object, you use this method.

To determine the number of items stored in an ArrayList object, you use this method.

Given the following method: static int sum(int[] a) { int s = 0; for (int i=0; i<a.length; i++) if (a[i]%2==0) s += a[i]; return s; } And given the following array: int [] m = {1, 2, 3, 4, 5, 6}; What is the value of sum(m)?

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=1; i<m.length; i++) m[i] = 2*m[i-1]; for (int n: m) System.out.print(n+ " "); System.out.println();

Given the following code fragment: int [] array = {2, 3, 6, 4, 1, 7, 9, 12}; int i = 1; int j = 2*i + 1; What is the value of array[j]?

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=0; i<m.length; i++) m[i] = 2*m[i]; for (int n: m) System.out.print(n+ " "); System.out.println();

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=0; i<m.length; i++) m[i] = m[i] + 2; for (int n: m) System.out.print(n+ " "); System.out.println();

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=0; i< m.length–1; i++) m[i] = 2*m[i+1]; for (int n: m) System.out.print(n+ " "); System.out.println();

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=0; i<m.length; i++) m[i] = (m[i]%2==0 ? m[i]/2 : 3*m[i]+1); for (int n: m) System.out.print(n+ " "); System.out.println();

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=0; i<m.length; i++) m[i] = (i%2 == 0 ? 2*m[i] : m[i] + 2); for (int n: m) System.out.print(n+ " "); System.out.println();

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=1; i<m.length; i++) m[i] = m[i-1] + m[i]; for (int n: m) System.out.print(n+ " "); System.out.println();

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=1; i<m.length; i++) m[i] = m[i]- m[i-1]; for (int n: m) System.out.print(n+ " "); System.out.println();

What will be the output of the following code segment? int[] m = {1, 2, 3, 4, 5, 6}; for (int i=1; i<m.length; i++) m[i] = (m[i-1]< m[i] ? m[i] : m[i-1]); for (int n: m) System.out.print(n+ " "); System.out.println();