View of the application javafx

后端 未结 1 1283
没有蜡笔的小新
没有蜡笔的小新 2020-12-22 04:06

i was searching in google for hours and i still cant find the right answer, so i have a last chance to come here and ask.

i\'m making school year JAVA FX project. I\

1条回答
  •  礼貌的吻别
    2020-12-22 04:28

    What I think you are asking for is a Scene with a map (represented as an Image) in the background and controls layered on top of the map to allow interaction with the map at certain positions. Your question is a little unclear, so I'm not exactly sure if that is what you are asking.

    If so, here is some sample code to implement that.

    pannable

    For the example use the mouse (or probably touch commands or trackpad scroll gestures - though I haven't a touch screen or trackpad to test it) to drag the map around. Click on the button to "Kill the evil witch".

    The solution works by:

    1. Creating an ImageView to hold the background map.
    2. Constructing the scene contents in a StackPane over the stacked background ImageView.
    3. Wrapping the scene in a ScrollPane bound to the scene's size.
    4. Setting properties on the ScrollPane to make it pannable.

    0 讨论(0)
提交回复
热议问题