Lab Assignment 3 -- Demo and Writeup Due 6 p.m. Sept. 28 in the lab session
CS 5551, Fall Semester, 2009
15 Points
Topics: Using Layout Managers

Reference: Chapter 4 of the Swing Tutorial book

The assignment: consists of three parts: (1) changing a border layout to a grid layout, (2) using a card layout, (3) investigating absolute layouts.

Part 1:
In the suggested implementation of the layout shown in Question 1. at the end of Chapter 4, a border layout is used, but they also suggest that a grid layout could be used. For this part, make that change -- from the border layout to the (1-by-1) grid labout. The border layout solution is at: Question 1 program file.

Part 2:
In the suggested implementation of the layout shown in Question 4. at the end of Chapter 4, change the text displayed by component 3 from "Component 3" to something that looks like:

Component 3 is so tall
it makes the container taller
I was able to modify the card layout program at: Question 4 program file.
But I had to use an HTML string (to get a line break after "... so tall") instead of an ordinary string.

Question for this part: does this change make the component area at the bottom taller?

Part 3:
The question came up in class about whether it is possible to have overlapping buttons when using absolute positioning. To answer this question use the program shown in the section "Doing Without a Layout Manager (Absolute Positioning)" and add another button labeled "two.five" whose dimensions overlap both button "two" and button "three". In the code, add this button between buttons "two" and "three". Here is the code: Absolute position program file.

Questions for this part:

  1. Is it possible to have overlapping buttons in an absolute layout?
  2. If the answer to the preceding question was "yes", and you press the left mouse button (while the pointer is) in the overlap area, which button is pressed? You can tell by which one turns dark gray (this probably depends on which one is on top in the overlap).

What to turn in: Turn in the following items from the Computer Science Lab Report Format:
1. (1 point) The Basic Information (your name, class, section, TA's name, assignment number, and date) can be on a separate cover sheet or as (highlighted) comments at the top of your main program file.
11. (6 points) Include the program listings. This listing should show good style, be appropriately commented, have the important/new parts highlighted, and include handwritten explanations if it helps the reader's understanding of the code.
13./14. (8 points) Do demos of your modified program for the TA that demonstrate that the programs work correctly. Also answer the questions in Parts (2) and (3) above, which can be on their respective program listings or separately.


Page URL: http://www.d.umn.edu /~ddunham/cs5551f09/assignments/lab3/assignment.html
Page Author: Doug Dunham
Last Modified: Tuesday, 08-Sep-2009 17:28:35 CDT
Comments to: ddunham@d.umn.edu