2017-03-16 11 views
0

JavaFXとFXMLに問題があります。 私はこのように構成され、単純なFXMLファイルをしました:ビデオがウィンドウのサイズを超えています - JavaFXとFXML

<?xml version="1.0" encoding="UTF-8"?> 

<?import javafx.scene.control.Button?> 
<?import javafx.scene.control.SplitPane?> 
<?import javafx.scene.control.ToolBar?> 
<?import javafx.scene.layout.AnchorPane?> 
<?import javafx.scene.layout.BorderPane?> 
<?import javafx.scene.media.MediaView?> 

<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="480.0" minWidth="720.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mediaplayer.MediaPlayerControllerSplit"> 
    <center> 
     <SplitPane dividerPositions="0.5" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" BorderPane.alignment="CENTER"> 
     <items> 
      <AnchorPane fx:id="mediaPaneL" style="-fx-background-color: green;"> 
       <children> 
        <MediaView fx:id="mediaViewL" /> 
       </children> 
      </AnchorPane> 
      <AnchorPane fx:id="mediaPaneR" style="-fx-background-color: red;"> 
       <children> 
        <MediaView fx:id="mediaViewR" /> 
       </children> 
      </AnchorPane> 
     </items> 
     </SplitPane> 
    </center> 
    <bottom> 
     <ToolBar minHeight="-Infinity" minWidth="-Infinity" style="-fx-background-color: black;" BorderPane.alignment="BOTTOM_CENTER"> 
     <items> 
      <Button mnemonicParsing="false" onAction="#openVideo" text="Openfile" /> 
      <Button mnemonicParsing="false" onAction="#playVideo" text="&gt;" /> 
      <Button mnemonicParsing="false" onAction="#pauseVideo" text="||" /> 
      <Button mnemonicParsing="false" onAction="#stopVideo" text="stop" /> 
      <Button mnemonicParsing="false" text="&lt;&lt;&lt;" /> 
      <Button mnemonicParsing="false" text="&lt;&lt;" /> 
      <Button mnemonicParsing="false" text="&gt;&gt;" /> 
      <Button mnemonicParsing="false" text="&gt;&gt;&gt;" /> 
      <Button mnemonicParsing="false" onAction="#exitVideo" text="EXIT" /> 
     </items> 
     </ToolBar> 
    </bottom> 
</BorderPane> 

2本のビデオをロードして、次の画像に示すように、SplitView内部の相対2 AnchorPanesに表示しますコントローラ: ClickMe

ビデオが親アンカーパネルの幅の範囲を超えています。どのように正しく設定できますか? ありがとうございます。

答えて

0

私はコントローラクラスのコードの次の行でこれを解決してきました:

mediaViewL.fitWidthProperty().bind(mediaPaneL.widthProperty()); 

mediaView幅彼の最初の親の幅に装着されています(1が右に同じ)左(AnchorPaneL/AnchorPaneR )。

関連する問題