Это не лучшее решение, но оно работает.Ниже приведен пример кода:
// Define the swing component, wrapper, and the scene.
var jPanel = new JPanel();
var swingWrapper = new SwingComponent.wrap(jPanel);
var scene = Scene{
width: 700
height: 500
content: [
swingWrapper
]
}
// Below are some triggers that fire off whenever the width or
// height of the scene change.
var currentWidth = bind scene.width on replace{
jPanel.setPreferredSize(new Dimension(scene.width,
scene.height));
swingWrapper.width = scene.width;
}
var currentHeight = bind scene.height on replace{
jPanel.setPreferredSize(new Dimension(scene.width,
scene.height));
swingWrapper.height = scene.height;
}
Stage {
title: "Some App"
scene: scene
}