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.
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.
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?
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:
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.