IFSC3340                             Exam 1             Name_______________________________

 

1.     We have covered the first 5 of Johnson ‘s 10 principles of GUI design.   He also gave us 4 case studies (Eudora, Kodak, Fork, and Satellite).  Indicate for each of the cases which if any of the first 5 principles are relevant to the point of the case and justify your opinion. (5 pts @)

Eudora:

 

 

 

 

 

 

 

Kodak

 

 

 

 

 

 

 

 

Fork

 

 

 

 

 

 

 

 

Satellite

 

 

 

 

 

 

 

 

 

 

2.     If a class extends Thread it implements the Runnable Interface.  What does that mean? (4 pts.)


3.     What is done with a JPanel  and what access methods does it have? (6 pts)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4.     Explain what a Layout Manger is and distinguish three different managers available in Java (12 pts).

 


5.     What are some of the standard uses of a JFrame’s RootPane’s LayeredPane? (8 pts.)





















 

6.     Discuss Java 2’s event model (what are events, what happens when they occur?) (12 pts.)


7.    Fill in explanatory comments where there are questions below: (14 pts.)

import javax.swing.JTabbedPane;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
// a. Why are the following classes imported?
import java.awt.*;
import java.awt.event.*;
 
public class TabbedPaneDemo extends JPanel {
/* b. What is this method for?  
 
 
    public TabbedPaneDemo() {
        ImageIcon icon = new ImageIcon("images/middle.gif");
        JTabbedPane tabbedPane = new JTabbedPane();
/* c. what does the method makeTextPanel do?
 
 
        Component panel1 = makeTextPanel("Blah");
        tabbedPane.addTab("One", icon, panel1, "Does nothing");
/* d. what does the following statement do?
 
        tabbedPane.setSelectedIndex(0);
 
        Component panel2 = makeTextPanel("Blah blah");
/* e. what is the purpose of the arguments of the following method call?
 
 
        tabbedPane.addTab("Two", icon, panel2, "Does twice as much nothing");
 
        Component panel3 = makeTextPanel("Blah blah blah");
        tabbedPane.addTab("Three", icon, panel3, "Still does nothing");
 
        Component panel4 = makeTextPanel("Blah blah blah blah");
        tabbedPane.addTab("Four", icon, panel4, "Does nothing at all");
 
/* f. what do the following two statements do?
 
 
 
 
        setLayout(new GridLayout(1, 1)); 
        add(tabbedPane);
    }
 
    protected Component makeTextPanel(String text) {
/* g. what does the following statement do (what is false)?
 
        JPanel panel = new JPanel(false);
/* h. what does the following statement do (what is text)?
 
 
        JLabel filler = new JLabel(text);
        filler.setHorizontalAlignment(JLabel.CENTER);
        panel.setLayout(new GridLayout(1, 1));
        panel.add(filler);
        return panel;
    }
 
public static void main(String[] args) {
/* i. what is created by the following statement?
 
 
        JFrame frame = new JFrame("TabbedPaneDemo");
/* j. what is created by the following statement?  [add a comment to explain each line]
 
 
 frame.addWindowListener(new WindowAdapter() {
 
 
public void windowClosing(WindowEvent e) 
 
{System.exit(0);}
        });
/* n. what is the purpose of the following statement?
 
 
        frame.getContentPane().add(new TabbedPaneDemo(), 
                                   BorderLayout.CENTER);
        frame.setSize(400, 125);
        frame.setVisible(true);
    }
}
 
 

8.     suspend() and resume() have been deprecated in Java 2.   why was this done?   What is meant by “thread-safe”? (9 pts.)


9.     Write three questions that I should use next year on this exam (in place of any of the above).  Instead of answering your question suggestions, explain what each would tell me about the student’s knowledge of this unit’s material. (15 pts.)