Skip to main content

problem applying Gradient fills to a Stage

1 reply [Last post]
frank_costanza
Offline
Joined: 2007-07-24
Points: 0

I'm having problems applying both LinearGradient and RadialGradient fills to a Stage. I can, however, fill the Stage with a solid color. Anyone experiencing similar problems on Windows or Mac? Or maybe I'm doing something wrong?

Platform: Linux (Ubuntu 8.04)
JRE: 1.6.0_10-rc-b27
JFX Compiler: July 31 nightly build

import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.geometry.*;
import javafx.scene.paint.*;
import javafx.scene.geometry.Polygon;
import javafx.ext.swing.*;
import javafx.scene.effect.*;

Frame {
width: 400
height: 400
closeAction: function() { java.lang.System.exit( 0 ); }
visible: true
stage: Stage {
fill: LinearGradient {
startX: 0
startY: 0
endX: 0
endY: 400
stops: [
Stop { offset: 0.0 color: Color.GREEN },
Stop { offset: 1.0 color: Color.WHITE }
]
}
}
}

Reply viewing options

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

I figured out that I was setting the start/end properties incorrectly on the gradient. It should be:

LinearGradient {
startX: 0.0
startY: 0.0
endX: 0.0
endY: 1.0
stops: [
Stop { offset: 0.0 color: Color.GREEN },
Stop { offset: 1.0 color: Color.WHITE }
]
}