2009-08-26 6 views
0

저는 javafx를 처음 사용했습니다. 내 무대에 가로 스크롤 막대를 추가하려고합니다. 나는 매우 넓은 그림을 가지고 있는데, 그 중 일부만 보여주고 사용자가 그것을 스크롤 할 수있게하고 싶습니다. 어떻게 된거 야?javafx 스크롤바

답변

1

value 스크롤 막대를 바인딩하여 이미지 X (또는 Y)를 변환 할 수 있습니다. 물론 스크롤바의 최소값과 최대 값을 0으로 설정하면됩니다. image.width (.height)

0

ScrollPane을 사용하면 ScrollPane에서 사진을 찍을 수 있습니다. Scenebuilder에서

:

AnchorPane ->의 ScrollPane -> AnchorPane

1
Image roses = new Image(getClass().getResourceAsStream("roses.jpg")); 
ScrollPane sp = new ScrollPane(); 
sp.setContent(new ImageView(roses)); //result 1 

sp.setHbarPolicy(ScrollBarPolicy.NEVER);// add for result 2 
sp.setVbarPolicy(ScrollBarPolicy.ALWAYS); 

(큰 그림으로) 결과 : setHbarPolicy와

enter image description here

결과와 setVbar 정책 :

enter image description here

인사말 Kaito