/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
*
* This file is available and licensed under the following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Sun Microsystems nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package customsplashscreen;
import javafx.lang.FX;
import javafx.scene.input.MouseEvent;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.scene.paint.Color;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.Scene;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.AppletStageExtension;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
loading_image_height: 128
loading_image_width: 128
*/
var vis = false;
var media = Media {
source: "http:
}
var mediaPlayer = MediaPlayer {
autoPlay: true
media: media
}
var mediaView = MediaView {
translateY: 20
fitWidth: 400
mediaPlayer: mediaPlayer
}
var stageX:Number = 200;
var stageY:Number = 200;
var titlebar = Rectangle {
x: 0, y: 0
width: 400, height: 20
fill: LinearGradient {
startX : 0.0
startY : 0.0
endX : 0.0
endY : 1.0
stops: [
Stop {
color : Color.BLACK
offset: 0.0
},
Stop {
color : Color.GRAY
offset: 1.0
},
]
}
onMouseDragged: function( e: MouseEvent ):Void {
stageX += e.dragX;
stageY += e.dragY;
}
};
var titleText = Text {
fill: Color.WHITE
font : Font {
name:"Arial Bold"
size: 12
}
x: 10, y: 15
content: "Splash Screen Demo(JavaFX Samples)"
};
var closebutton = Rectangle {
x: 375 y: 3
width: 15 height: 15
visible: bind vis
arcHeight:5
arcWidth: 5
stroke:Color.GRAY
strokeWidth: 2
fill: Color.TRANSPARENT
onMouseClicked: function(e: MouseEvent): Void {
FX.exit();
}
}
var closetext= Text {
visible: bind vis
fill: Color.WHITE
font : Font {
name:"Arial Bold"
size: 14
}
x: 379, y: 15
content: "x"
}
var stage = Stage {
x: bind stageX
y: bind stageY
title: "Custome Splash Screen(JavaFX Samples)"
width: 400
height: 250
style: StageStyle.TRANSPARENT
scene:Scene {
content: [ mediaView,titlebar,closetext, closebutton, titleText]
}
extensions: [
AppletStageExtension {
onDragStarted: function() {
vis = true;
}
onAppletRestored: function() {
vis = false;
}
useDefaultClose: false
}
]
}