Simple Data Binding with GUI


Splash

Source Code:

/*
 * Binding.fx
 **
 *pizaini.wordpress.com
 *zheiner.taurus@gmail.com
 *
 * Created on 22 Jan 10, 13:07:46
 */

package belajar.gui.binding;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.scene.paint.RadialGradient;
import javafx.scene.paint.Stop;
import javafx.scene.paint.LinearGradient;
import javafx.ext.swing.SwingSlider;
import javafx.scene.Cursor;
import javafx.scene.effect.DropShadow;

/**
 * @author Pizaini
 */

// My Code is Here
var slider = SwingSlider{
   minimum:0, maximum:80;
   value:0;
   translateX:20, translateY:190
   cursor:Cursor.HAND
 }
var circle:Circle;
Stage{
   title:"GUI Binding Slide Bar"
   scene: Scene{
     width:500;
     height:450;
     fill: LinearGradient{
        startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0, proportional: true
        stops: [
           Stop {offset: 0.0 color: Color.WHITE},
           Stop {offset: 1.0 color: Color.BLUE}
     ]
    }
    content: [
        circle = Circle{
            effect:DropShadow{
               color:Color.RED;
               radius:bind slider.value + 40
            }
           centerX:bind slider.value+100, centerY:100;
           radius:80;
           stroke:Color.YELLOW;
           fill:RadialGradient{
                centerX:100, centerY:100;
                radius:100;
                focusX:50, focusY:100;
                proportional:false;
                stops: [
                     Stop{ offset:0.1 color:Color.GREEN; }
                     Stop{ offset:1.0 color:Color.WHITE; }
                ]
           }
       },
       slider,
    ]
 }
}

One thought on “Simple Data Binding with GUI

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.