문제

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);
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top