Skip to main content

ShapeSubtract component's width binding to stage width does not work

2 replies [Last post]
riepi
Offline
Joined: 2008-03-27
Points: 0

Following problem: I want to create an own Windowborder around my undecorated frame. When i scale my Window the border has to scale too, so that all other elements on my stage are behind the border when the window is too small. To create the border i want to use ShapeSubtract element with two rectangles. But i cant bind the recangles width to my stagewidth. Why? here a short example:

<br />
Frame {<br />
    var stageRef:Stage;<br />
    title: "MyApplication"<br />
    width: 200<br />
    height: 200<br />
    visible: true<br />
    stage: stageRef=Stage {<br />
        content: [Rectangle {<br />
                x: 0, y: 110<br />
                width: bind stageRef.width, height: 20<br />
                fill: Color.BLACK<br />
            },</p>
<p>            ShapeSubtract{<br />
                fill: Color.YELLOW<br />
                a: Rectangle {<br />
                    x: 10<br />
                    y: 10<br />
                    width: bind stageRef.width //does not work<br />
                    height: 90<br />
                    fill: Color.BLACK<br />
                }<br />
                b:<br />
                Rectangle {<br />
                    x: 20<br />
                    y: 20<br />
                    width: bind stageRef.width - 20 //does not work<br />
                    height: 70<br />
                    fill: Color.BLACK<br />
                }<br />
            }<br />
        ]<br />
    }<br />
}<br />

riepi

Message was edited by: riepi

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexsch
Offline
Joined: 2007-07-12
Points: 0

It is definitely a bug. Please, file a JIRA issue on it: http://openjfx.java.sun.com/jira/secure/CreateIssue!default.jspa

riepi
Offline
Joined: 2008-03-27
Points: 0

uhm, tried the same with "clip", didn't work either:

[code]

/*
* NewJavaFXEmpty.fx
*
* Created on 04.08.2008, 14:19:22
*/

package transparentwindowtest;

import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.*;
import javafx.scene.geometry.*;
import javafx.scene.paint.*;
import javafx.application.*;
import javafx.scene.effect.*;
import javafx.scene.effect.light.DistantLight;
import javafx.scene.text.*;

Frame {
var stageRef:Stage;
title: "MyApplication"
width: 400
height: 200
visible: true
stage:
stageRef = Stage {
fill: null
content: [Rectangle {
x:0
y:0
width:bind stageRef.width - 2
height: bind stageRef.height - 2
arcWidth:10
arcHeight:10
stroke: Color.LIGHTGRAY
fill:LinearGradient {
startX:0 startY:0 endX:0 endY: 1
stops: [
Stop { offset:0 color:Color.rgb(255,255,255,0.3)},
Stop { offset:0.3 color:Color.rgb(185,185,185,0.3) },
Stop { offset:1 color:Color.rgb(200,200,200,0.3) },
]
}
effect: Lighting{
light: DistantLight{
azimuth: 225
}

}

},

Rectangle { x:5 y:25 width:bind stageRef.width - 12 height:bind stageRef.height - 32
stroke: Color.web("#555")
fill: Color.WHITE
arcHeight: 4
arcWidth: 4
},

//Content
Group{

/* does not work:

clip: Rectangle { x:5 y:25 width:bind stageRef.width - 12 height:bind stageRef.height - 32 }
*/
content:[
Text {
textOrigin: TextOrigin.TOP
font: Font {
size: 80
style: FontStyle.PLAIN
}

x: 10
y: 60
content: "HelloWorld"
}
]

}
]
}
}

[/code]