So all the missing bits are explained now. Here is Sun's statement on PBP 1.0:
Code:
If the heavyweight components are missing and Swing is unavailable, you might wonder how you create a user interface. There are two possibilities.
If your application is simple enough, you can create your own components:
import java.awt.*;
/**
* A _very_ simple UI component that draws a
* centered text string.
*/
public class SimpleTextLabel extends Component {
private String text;
public SimpleTextLabel( String text ){
this.text = text;
}
public void paint( Graphics g ){
int h = getHeight();
int w = getWidth();
g.setColor( getBackground() );
g.fillRect( 0, 0, w, h );
g.setColor( getForeground() );
FontMetrics fm = g.getFontMetrics();
int textWidth = fm.stringWidth( text );
int textHeight = fm.getHeight();
int x = ( w - textWidth ) / 2;
int y = ( h - 2 * textHeight ) / 2;
g.drawString( text, x, y );
}
}
At runtime, place these components directly on a Frame component:
...
Frame frame = ... // some frame you created
SimpleTextLabel label;
// Now build our user interface
label = new SimpleTextLabel( "Press a key to exit" );
label.setBackground( Color.blue );
label.setForeground( Color.yellow );
label.addKeyListener( new KeyAdapter(){
public void keyTyped( KeyEvent e ){
exit();
}
}
);
frame.add( label );
An application running under the new Xlet model uses the root container supplied by the system (available through the XletContext object passed to each Xlet on initialization) instead of creating its own frame.
The second way to create user interfaces is to use third-party lightweight user-interface toolkits. These toolkits may also be augmented by vendor-supplied classes.
Besides the lack of heavyweight components, the PBP AWT subset includes specific restrictions on what an application's user interface can do, so that PBP applications can run on systems with relatively limited UI capabilities. The most important restriction is that applications may use only a single instance of the Frame class. PBP applications built using the traditional model are responsible for creating the frame themselves. By contrast, in the Xlet model the system creates the frame on the application's behalf, and makes it (or a child container) available by way of the XletContext.getContainer() method. Other frame behavior is optional. The system is free to restrict the size, state, and position of a frame and to hide its title. There are also restrictions on cursor use and other minor details.
http://developers.sun.com/techtopics...ticles/pbp_pp/