Suggested Projects


Skill-Building Exercises

  1. Down and Dirty with GridBagLayout:   Using one GridBagLayout and 13 buttons only, create the following GUI.

    image from book

  2. Modeling the Real World:   Using any combination of JPanels and layout managers, pick a household appliance and replicate its interface.

  3. Assimilating Your Knowledge:   Changing nothing in the following code except to implement the createGUI() method, create an application that starts up looking like figure 12-44 and when stretched horizontally looks like figure 12-45. Notice that in figure 12-45 only the text fields were stretched.

    image from book
    Figure 12-44: Exercise3: Default Size

    image from book
    Figure 12-45: Exercise3: Stretched Horizontally

     1     package chap12.exercises; 2     import java.awt.*; 3     import javax.swing.*; 4 5     public class Exercise3 extends JFrame{ 6 7         public Exercise3(){ 8             super("Exercise3"); 9             setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 10            createGUI(); 11        } 12 13        public void createGUI(){ 14            //enter code here. Change no other part of this file. 15        } 16 17        public static void main(String[] arg) { 18            JFrame frame = new Exercise3(); 19            frame.pack(); 20            frame.setVisible(true); 21        } 22     }

  4. Exploring a new Layout Manager:   Investigate BoxLayout and write a small application that uses it.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net