Przykład

public static void main( String[] args) {
Frame frame = new Frame( "Peers" );
Button button = new Button( "Hello World!" );
frame.setLayout( new GridLayout() );
frame.add( button );
frame.setVisible( true );
ButtonPeer peer = (ButtonPeer)button.getPeer();
peer.dispose();
}

Rozwiązanie
Usuń wywołania do obiektów równorzędnych. Zamiast tego użyj interfejsów java.awt lub javax.swing i klas.

public static void main( String[] args) {
Frame frame = new Frame( "Peers" );
Button button = new Button( "Hello World!" );
frame.setLayout( new GridLayout() );
frame.add( button );
frame.setVisible( true );
}