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 02: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 07:49 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 chi hair iron on September 17, 2009 at 06:13 AM IST #

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

Posted by ugg boots uk on October 17, 2009 at 11:39 PM 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 07:35 AM 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 05:37 AM IST #

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

Posted by Metin2 yang on November 10, 2009 at 05:38 AM IST #

good

Posted by gucci shoes on January 27, 2010 at 12:29 AM IST #

fashion brand
http://www.brand-well.com/
choose online!

Posted by ブランド コピー on January 30, 2010 at 01:33 AM IST #

thanks...

Posted by air jordan shoes on February 26, 2010 at 11:47 AM IST #

Thank you for sharing out

Posted by gucci handbags on March 08, 2010 at 11:25 PM IST #

Christian Louboutin shoes are designed for women who crave for fashion. Whether you want to find trend shoes out for dating or shoes for holiday, Christian Louboutin shoes can satisfy you.

Posted by Christian Louboutin on March 10, 2010 at 05:29 AM IST #

Dear Admin,thank you for this informative article.It's very good.I wish you continued success whould you like.

Posted by mbt shoes on March 15, 2010 at 02:06 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

I am Vikram Aroskar working in the Java team based out of India.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today