निम्नलिखित दृष्टिकोण के साथ आप अपनी सबससीन को किसी भी वर्ग में डाल सकते हैं जो फलक वर्ग (जैसे सीमावर्ती, ग्रिडपेन इत्यादि) को बढ़ाता है। फिर भी
public class GuiControler extends BorderPane implements Initializable,ChangeListener {
//Set a changeListener to the Stage's Window and Implement the ChangeListener in the class where you want to make the subScene scaling.
stage.widthProperty().addListener(this);
stage.heightProperty().addListener(this);
//....
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
double width = stage.getWidth();
double height = stage.getHeight();
if(observable.equals(this.widthProperty())) {
double scale = width/400; // 400 is my initial width size of the stage (main java app window) window
subScene.setWidth(200*scale); // 200 is my initial size of the subscene window
}else if(observable.equals(this.heightProperty())){
double scale = height/400; // 400 is initial size for stage height window
subScene.setHeight(250*scale); // 250 is initial size for subScene width
}
}
}
मैं कुछ समय पहले कि बारे में पता चला, लेकिन धन्यवाद: इसके अलावा subScene अपने फलक से एक अलग आकार हो सकता है। – fho
अभिभावक वर्ग में ऊंचाई नहीं हैप्रॉपर्टी() या चौड़ाईप्रॉपर्टी()। – Arceus
आप किस मूल वर्ग का उपयोग कर रहे हैं? क्या आप पैरेंट क्लास के अंदर एक स्टैकपैन जोड़ सकते हैं और फिर सबसिन्स बांध सकते हैं? – MitchBroadhead