Domanda

I am trying to show a youtube video within my application. Currently it works in the emulator but the problem is the video isn't scaled well. The BorderLayout works fine for the width but i want to give the video a max height as well.

my code:

    Container c2 = new Container(new BorderLayout());
    c2.setPreferedH(400);
    WebBrowser player = new WebBrowser();
    player.setURL("https://www.youtube.com/embed/"+temp.getUrl()+"?rel=0");
    c2.addComponent(BorderLayout.CENTER, player);
È stato utile?

Soluzione

Don't invoke setPreferredH its generally a mistake.

What did you add c2 into?

I suggest that instead of creating c2 you would set the border layout to the form and add the player component into the center of the form.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top