Reflections

Tuesday Jan 27, 2009

Elliptical Gradient Button in JavaFX

In JavaFX, we can make our own fancy buttons. Here in this blog, I tried to write an elliptical button. Have a look.



Here is the code :


package ellipticalbutton;

import javafx.scene.effect.*;
import javafx.scene.Group;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.*;
import javafx.scene.Scene;
import javafx.scene.shape.*;
import javafx.scene.text.*;
import javafx.stage.*;

var x=70;
var y=40;

var el:Ellipse = Ellipse {
    centerX: 120
    centerY: 100
    radiusX: bind x
    radiusY: bind y

    effect: DropShadow {
        offsetY: 3
        color: Color.color(0.3, 0.3, 0.3)
        spread:0.4
    }//end effect

    effect:GaussianBlur{
    }
    fill:RadialGradient{
        centerX:0
        centerY:0
        radius:25
        proportional:false
        cycleMethod:CycleMethod.REPEAT
        stops:[
            Stop {
                offset: 0.0
                color: Color.ANTIQUEWHITE },
            Stop {
                offset: 0.3
                color: Color.GREEN },
            Stop {
                offset: 0.8
                color: Color.ANTIQUEWHITE }
        ]

    }//end fill

    onMousePressed: function( e: MouseEvent ):Void {
        x = x - 2;
        y = y - 2;
    }

    onMouseReleased: function( e: MouseEvent ):Void {
        x = x + 2;
        y = y + 2;
    }

}//end ellipse


var t = Text {
    font: Font {
        size: 20
        name:"Verdana"
    }

    x: 90
    y: 100
    content: "Press"
    fill:Color.DARKGREEN
    effect:DropShadow{
        offsetX:10
        offsetY:10
        color:Color.DARKGRAY
    }

}//end Text

Stage {
    title: "Elliptical Button"
    //style:StageStyle.UNDECORATED
    width: 240
    height: 320
    scene: Scene {

            fill:Color.LIGHTGREY
            content: [Group{
                    content:[
                        el,
                        t
                    ]

                }
            ]
        }
}

Comments:

For further information about the Warhammer CD-key and Warhammer Timecard, Please keep an eye on air jordan shoes.
For more information please keep an eye on cheap jordan shoes .

Posted by air jordons on June 26, 2009 at 09:23 AM IST #

Your article very interesting, I have introduced a lot of friends look at this article, the content of the articles there will be a lot of attractive people to appreciate, I have to thank you such an article.

Posted by gucci shoes on August 01, 2009 at 02:49 PM IST #

Your article very interesting, I have introduced a lot of friends look at this article, the content of the articles there will be a lot of attractive people to appreciate, I have to thank you such an article.

Posted by chi hair iron on September 17, 2009 at 01:13 PM IST #

For men, these are available in tans, blacks, chestnuts and are designed for style and comfort.

Posted by ugg boots uk on October 18, 2009 at 06:39 AM IST #

You might think it’s a good idea to buy the same iron

[url=www.mytopchi.com]chi flat iron[/url] your best friend

has, but if your hair texture is different

[url=www.mytopchi.com]chi flat irons[/url], your results may

never be the same.
If you use a flat iron [url=www.mytopchi.com]chi hair

straightener[/url] every day you want it to last. Make sure

you select a flat iron [url=www.chihaironline.com]chi hair

straighteners[/url]
guaranteed to survive your daily styling habits. If you use a

flat iron [url=www.chihaironline.com]chi hair tools[/url]
sporadically, go for a less expensive Ceramic iron without

all the technological bells and whistles.
I hope you take the time to ask yourself these simple

questions, the flat iron [url=www.chihaironline.com]chi hair

iron[/url]
of your dreams is waiting for you![url=www.mytopchi.com]chi

hair irons[/url]

Posted by Chi Flat Iron on October 22, 2009 at 02:35 PM IST #

Metin2 yang leads you into an eastern<a href="http://www.ibay24.com" title="metin2 yang">metin2 yang</a> fantasy <a href="http://www.metin2.mobi" title="metin2 yang">metin2 yang</a>world.

Posted by Metin2 yang on November 10, 2009 at 01:37 PM IST #

100%safe metin2 yang!
metin2 powerleveling!
cheap metin2 yang!

Posted by Metin2 yang on November 10, 2009 at 01:38 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referrers