|
|||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Frame | +--ExtendsStuff
ExtendsStuff - Show how Java's inheritance capability makes writing seemingly complex/powerful programs easy.
This class is used to introduce the concept of inheritance, building on top of the existing things that are sort-of what you want to do. In the lesson "What's Java?," the Edit-Compile-Execute process was introduced with a simple application that used System.out.println( ) to display a String. This class provides a mechanism to display a String in a pop-up window by invoking the method: printInWindow( ).
Field Summary | |
static int |
FONT_SIZE
Default Font Size for Displaying Strings |
static int |
WINDOW_HEIGHT
Default Height of Pop-Up Window for Displaying Strings |
static int |
WINDOW_WIDTH
Default Width of Pop-Up Window for Displaying Strings |
Method Summary | |
void |
printInWindow(java.lang.String message)
Pop up a window and print some text in it. |
void |
setFontSize(int size)
Set the height of the font to be used to display a String by invoking printInWindow(). |
void |
setWindowHeight(int height)
Set the height of the window that will be created to contain a String displayed by invoking printInWindow(). |
void |
setWindowWidth(int width)
Set the width of the window that will be created to contain a String displayed by invoking printInWindow(). |
Field Detail |
public static final int FONT_SIZE
public static final int WINDOW_HEIGHT
public static final int WINDOW_WIDTH
Method Detail |
public void printInWindow(java.lang.String message)
Append the supplied text to a StringBuffer and create a new Label consisting of its contents. The new Label will use the current FontSize, which can be changed via setFontSize() method.
The size of the Frame and the attributes of the "SansSerif" Font (size and style) are also set based on current values of private fields. These fields may be changed via setXxx() invocations.
text
- String of text to be displayed in a window.setFontSize(int)
,
setWindowHeight(int)
,
setWindowWidth(int)
public void setFontSize(int size)
size
- Height of the font in points.printInWindow(java.lang.String)
public void setWindowHeight(int height)
height
- number of pixels on window's Y axis.printInWindow(java.lang.String)
public void setWindowWidth(int width)
width
- number of pixels on window's X axis.printInWindow(java.lang.String)
|
|||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |