class A extends B {
//Gets all public bits
}
class C implements D {
// Fulfils promises
}
class A extends B implements C, D, E {
java.awt.Component
java.awt
javax.swing
Component: Monitors keys/mouse and resizing.Container: Uses 'LayoutManager' objects to position contents.Window: Superclass for windows style objects : rarely used on own.
Panel and Canvas: A window with no border etc. Panel subclassed by Applet.Frame: Window with border, close buttons and, potentially, menus.
JDesktopPanel: Used for making desktops.
|
|
Frame frame = new Frame ("My Window");
frame.setSize(int width, int height);
frame.setSize(300,300);
frame.setVisible(true);
//Opposite is(false)
Label newLabel = new Label("My Label");
frame.add (newLabel);
import java.awt.*;
class PopUp2 extends Frame {
public PopUp2 () {
super("My Window");
setSize(300,300);
Label newLabel = new Label("My Label");
add (newLabel);
setVisible(true);
}
public static void main (String args[]) {
new PopUp2();
}
}
LayoutManager layout = new LayoutManager();
guiObject.setLayout(layout);
FlowLayout - as each component added they fill across the available space then wrap to the next line. Frame's BorderLayout allows you to add things to the CENTER/NORTH/SOUTH/EAST/WEST of the component.
GridBagLayout - this gives absolute positioning control, but allows for windows to resize.
FlowLayout and BorderLayout, but if you use GridBag you'll be ruler of the geeks. Lucky old you.