Please send questions to
st10@humboldt.edu .
CIS 480 - Advanced Java Programming
STUDY SUGGESTIONS for MIDTERM #1
* Midterm #1 will be held on Wednesday, March 7th.
* it will be in NHW 244;
* it will be open computer (you cannot e-mail anyone, but you
can look at the course Web page, BlueJ, the Java API etc.)
* you will be given a paper version of the test, but there
will also be an on-line version available.
* You are responsible for material covered in lecture and on the
homeworks; the examples and the notes on the course web page are, of
course, fair game.
* Some high points of what has been covered so far:
* related to Java applications:
* what is the difference between a Java applet and a
Java application?
* how do you run a Java application (from a command line)?
* what must an application have? (a main() method)
* how can one use command-line arguments in a Java
application?
* how can one leave a Java application "prematurely"
(say because of incorrect command-line arguments or other
problems)?
* if one uses a GUI with a Java application, what must
be included for "graceful" termination? (System.exit(0)
wherever needed --- we've seen several scenarios...)
* AWT Frames (for use in GUI applications)
* how does one "set up" a Frame? (need to set its
size, need to show() it, can setTitle() for it, etc.)
* what two methods can one use to set a Frame's size?
* what is default layout manager for a frame?
* how can one set it up so that the Java application
exits "gracefully" when the frame is closed? (System.exit(0)
in an anonymous inner class handling window closing events
on the frame instance, in several of the class examples)
* (note that System.exit(0) was also called as
the action for our Quit menu item)
* what is an inner class?
* what is an anonymous inner class?
* in Java 2, can you have multiple "top-level" classes
within a simgle file? (Yes, as long as only one is public;)
* setting up menu, menubars, menuitems for a Frame;
* if I showed you the source code for a Java class, could you tell
if it was an applet? an application? neither an applet nor an
application?
* Swing intro:
* what package is the "main" Swing package?
* what are some of the major differences between AWT
and Swing?
* how do AWT and Swing differ in attempting to meet
the goal of "write once, run anywhere"?
* why was Swing developed? What are some of the Swing
classes' advantages?
* what are the disadvantages (at least currently) of Swing?
* if you use Swing, do you no longer need the AWT at all?
* what is a heavyweight component? a lightweight component?
* Can you give three differences between an AWT applet
and a Swing JApplet?
* don't forget the difference in default
layout manager;
* Can you give at least one difference between an AWT
Frame and a JFrame?
* need to know --- where are components added,
in a JFrame? How is a reference to that location
obtained?
* Considering common popular AWT components and their
Swing equivalents, how do they differ? (What capabilities
does the Swing version add?)
* How can one convert code using AWT components into
code using Swing components? What are some cases that are
not so straightforward?
* What are some of the pitfalls to watch out for when
mixing lightweight and heavyweight components?
* what are some Swing features/components that do not have
AWT equivalents?
* intro to simple tables;
* should be able to create, use a simple table;
* what import statement does one include when
using JTable?
* what is a (relatively) simple way that one can
instantiate a table?
* how can a JScrollPane be useful in conjunction
with a table (and with JTextArea, too, for that matter)?
* how to accomplish painting "properly" in Swing;
* should be able to properly accomplish simple
"painting" in Swing;
* what method do you NOT use to accomplish "painting"
in a JApplet?
* understand that JFrames, JApplets, JDialogs do NOT
like to be painted on;
* understand that, instead, it is recommended
practice to draw onto another component, and then
add THAT to the content pane of the appropriate
container;
* (1) which component does one typically
extend to do this?
* (2) which of its methods does one
typically override in doing this?
* whenever you override this method (2),
what statement do you need to be careful
to make sure that you include?
* within your class extending (1),
how can you "force" an execution
of your overridden method (2)?
* putting an image on a JButton (and, very similarly,
on a JLabel);
* should be able to do this;
* how can you obtain an ImageIcon instance from a
desired .gif file?
* how can this then be used in putting an
image onto a JButton or JLabel?
* intro to JTabbedPane;
* should be able to use this;
* intro to Box, and to BoxLayout;
* should be able to use these;
* can only a Box component use BoxLayout?
* what kind of things can you do with BoxLayout?
* what are glue, struts?
* intro to borders;
* should be able to add a simple border
to a Swing component;
* what import statement does one include
when adding, changing borders?
* what method lets you set a border for
the component for which you want a
border?
* intro to JScrollPane
* how can this be useful with such components
as tables, JTextAreas?
* how can it be instantiated?
* non-Swing aside: how can you specify that *NO* layout
manager be used for some container, AWT or Swing?