World Wind SDK Java

1 resposta
L

Estou desenvolvendo uma aplicação baseado nos exemplos disponíveis no site http://goworldwind.org/getting-started/ Consegui abrir o mapa, inserir alguns componentes nativos da biblioteca worldwind. Estou com dificuldades de inserir em um ponto fixo do mapa (globo) algum componente Swing, por exemplo um JButton. Não encontrei nenhum exemplo de código para a inserção de componentes Swing, não sei se é possível inserir um componente da classe Swing no mapa ?

Estou pesquisando mas se alguém já trabalhou com World Wind SDK, e poder me ajudar desde já agradeço

1 Resposta

L

No código abaixo tem a class RenderableLayer que utilizo para inserir no mapa um objeto tipo layer atraves do metodo addRenderable(Renderable renderable), adicionei um metodo addRenderableButton(JButton jc) para inserir um JButton no mapa, mas está dando um erro de java.lang.NullPointerException na linha this.component.add(jc);
Algum pode me ajudar ?

public class RenderableLayer extends AbstractLayer

{

private java.util.Collection renderables = new java.util.concurrent.ConcurrentLinkedQueue();

private Iterable renderablesOverride;

protected PickSupport pickSupport = new PickSupport();

private JComponent component;
/** Creates a new <code>RenderableLayer</code> with a null <code>delegateOwner</code> */
public RenderableLayer()
{
}

public void addRenderable(Renderable renderable)
{
    if (renderable == null)
    {
        String msg = Logging.getMessage("nullValue.RenderableIsNull");
        Logging.logger().severe(msg);
        throw new IllegalArgumentException(msg);
    }

    if (this.renderablesOverride != null)
    {
        String msg = Logging.getMessage("generic.LayerIsUsingCustomIterable");
        Logging.logger().severe(msg);
        throw new IllegalStateException(msg);
    }

    this.renderables.add(renderable);

    // Attach the layer as a property change listener of the renderable. This forwards property change events from
    // the renderable to the SceneController.
    if (renderable instanceof AVList)
        ((AVList) renderable).addPropertyChangeListener(this);
}

public void addRenderableButton(JButton jc){
    
    if (jc == null)
    {
        String msg = Logging.getMessage("nullValue.RenderableIsNull");
        Logging.logger().severe(msg);
        throw new IllegalArgumentException(msg);
    }
    
    this.component.add(jc);
    
    if (jc instanceof AVList)
        ((AVList) jc).addPropertyChangeListener(this);
}

}

Criado 27 de março de 2012
Ultima resposta 28 de mar. de 2012
Respostas 1
Participantes 1