package nodeswingmixing;
import javafx.stage.*;
import javafx.ext.swing.*;
import javafx.scene.*;
import javafx.scene.input.*;
import javafx.scene.shape.*;
import javafx.scene.paint.*;
import javafx.animation.*;
import javafx.scene.text.*;
var map = SetupMap.create();
map.setPreferredSize(new java.awt.Dimension(400,300));
var mapComp = SwingComponent.wrap(map);
mapComp.clip = Rectangle {
width: 400 height: 300
arcHeight: 30 arcWidth: 30
};
var mapGroup = Group {
opacity: 0.01
translateX: 300-400/2
translateY: 200-300/2
scaleX: bind scale
scaleY: bind scale
content: [
mapComp,
Rectangle { width: 400 height: 300
arcHeight: 30 arcWidth: 30
stroke: Color.web("#3B3D3F")
strokeWidth: 3
fill: null
}
]
};
var bigText:Text = Text {
content: "Swing + JavaFX"
font: Font.font("Verdana",FontWeight.BOLD,60)
fill: Color.web("#0C60AE")
stroke: Color.web("#3B3D3F") strokeWidth: 2
y: 130 x: -700
blocksMouse: true
onMouseEntered:function(e:MouseEvent) {
bigText.fill = Color.web("#D2EDFF");
}
onMouseExited:function(e:MouseEvent) {
bigText.fill = Color.web("#0C60AE");
}
};
var scale = 0.3;
var zoomIn = Timeline {
keyFrames: [
at(0s) { scale=>0.3 tween Interpolator.LINEAR},
at(0s) { mapGroup.opacity=>0.0 tween Interpolator.LINEAR},
at(1s) { scale=>1.0 tween Interpolator.LINEAR},
at(1s) { mapGroup.opacity=>1.0 tween Interpolator.LINEAR},
at(0.5s) { bigText.x => -600 tween Interpolator.LINEAR},
at(2s) { bigText.x => 40 tween Interpolator.LINEAR},
]
};
Stage {
width: 600
height: 400
scene: Scene {
fill: Color.WHITE
content: [
Rectangle { x: 35 width: 70 height: 30 fill: Color.web("#0C60AE") stroke: Color.web("#888888")
onMousePressed: function(e:MouseEvent) {
zoomIn.playFromStart();
}
},
Text { content: "Show" x: 44 y: 22 fill: Color.WHITE font: Font { size: 20 } },
mapGroup,
bigText,
]
}
}