Skip to main content

Positioning Shapes dependent on the framesize

1 reply [Last post]
Joined: 2008-03-27

It is easy to make attributes dependent on other attributes. But it is possible in my example to change the shape just when i resize my window? At the moment the Shape only changes when i release the mouse button.

<br />
/*<br />
 * Main.fx<br />
 *<br />
 * Created on 11.07.2008, 18:52:24<br />
<p>package layouttest02;</p>
<p>import javafx.application.*;<br />
import javafx.scene.geometry.*;<br />
import javafx.scene.paint.Color;</p>
<p>var weite = 400;<br />
var hoehe = 400;</p>
<p>var rect1:Rectangle = Rectangle {<br />
    var rectheight = 20<br />
    x: 0<br />
    y: bind (hoehe - 35- rectheight)<br />
    width: bind weite,<br />
    height: rectheight<br />
    fill: Color.BLUE<br />
    scaleX: 1<br />
    scaleY: 1<br />
<p>Frame {<br />
    var stageRefA:Stage<br />
    title: "PositionsTest"<br />
    width: bind weite with inverse<br />
    height: bind hoehe with inverse<br />
    visible: true<br />
    stage:<br />
    stageRefA = Stage {<br />
        content:<br />
            [<br />
                rect1<br />
            ]<br />


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-03-27

Noone any idea?

I am looking for a way to bring my Shapes to a width and hight depending on my framesize like a component in a layoutmanager or as we know from html. For example it would be nice to set a rectangle's width and height values to something like "max", so that it expands within the place the shape has.