2016-11-04 4 views
1

녹색 및 파란색 상자가있는 이미지와 마찬가지로 TitledPane 헤더에 두 개의 창이 추가됩니다.TitledPane 헤더에 두 개의 창을 추가하는 방법은 무엇입니까?

enter image description here

하지만 그런 식으로 할 때, 그것은 단지 현장 빌더를 사용하는 경우 나 이미지 뷰으로 하나 개의 창을 추가 할 수 있습니다.

+0

질문에 답을하십시오. – Sedrick

+0

질문에 대한 답변을 – MrSandman

+0

stackpane. 나는 샘플 코드로 당신을 정말로 도울 수 없다. – Sedrick

답변

3

SceneBuilder에서이 작업을 수행하는 방법에 대해 궁금한 점이 있으므로 제 답변을 계속해서 알려 드리겠습니다.

TitledPane에 HBox를 그래픽으로 추가 한 다음 필요한 노드를 추가 할 수 있습니다.

<?import javafx.geometry.Insets?> 
<?import javafx.scene.control.Label?> 
<?import javafx.scene.control.TitledPane?> 
<?import javafx.scene.layout.HBox?> 
<?import javafx.scene.shape.Rectangle?> 

<TitledPane animated="false" contentDisplay="GRAPHIC_ONLY" prefHeight="227.0" prefWidth="392.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1"> 
    <graphic> 
     <HBox alignment="CENTER_LEFT" prefHeight="18.0" prefWidth="605.0" spacing="10.0"> 
     <children> 
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="#1be440" height="15.0" stroke="BLACK" strokeType="INSIDE" width="13.0" /> 
      <Label maxWidth="1.7976931348623157E308" text="title" HBox.hgrow="ALWAYS" /> 
      <Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="15.0" stroke="BLACK" strokeType="INSIDE" width="13.0" /> 
     </children> 
     <padding> 
      <Insets right="5.0" /> 
     </padding> 
     </HBox> 
    </graphic> 
</TitledPane> 

는 다음과 같이 창을 생성합니다 : 당신은 화살표가 HBox의 왼쪽에 여전히주의 할

enter image description here

. 이를 방지하기 위해 기본 화살표를 숨기고 HBox에 화살표를 추가 할 수 있습니다. 방금 추가 한 새 화살표에 기본 화살표 스타일을 추가하십시오. 자세한 내용은 How to change header component in TitledPane in JavaFX이 게시물을보십시오.

관련 문제