Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

javafx

Explorer ,
Dec 26, 2008 Dec 26, 2008
Has anyone looked at the new javafx, it looks a lot like action script but with subtle differences, what I was wodering is could this code be transfered to as3 with a few changes or are they tottaly incompatible :-)


/*
* simplecalc2.fx
*
* Created on 25-Dec-2008, 02:04:17
*/

package javafxpert;

import javafx.ext.swing.*;
import javafx.stage.Stage;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.input.*;
import javafx.scene.layout.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.scene.text.*;
import javafx.scene.transform.*;

/**
* @author David Harris
*/

Stage {
// The model
var displayStr:String;
var keyLabels = ["7", "8", "9", "+",
"4", "5", "6", "-",
"1", "2", "3", "x",
"0", ".", "=", "/"];

title: "Calculator 2"
scene: Scene {
//The gradient on the keys
var btnGradient = LinearGradient {
startX: 0.0, startY: 0.0,
endX: 0.0, endY: 1.0
stops: [
Stop {
offset: 0.0
color: Color.rgb(166, 166, 168,)
} ,
Stop {
offset: 1.0
color: Color.rgb(122, 122, 122)
}
]
};
content: [
// The rounded rectangle behind the entire calculator
Rectangle {
width: 278
height: 401
arcWidth: 16
arcHeight: 16
fill: LinearGradient {
startX: 0.0, startY: 0.0,
endX: 0.5, endY: 1.0
stops: [
Stop {
offset: 0.0
color: Color.rgb(119, 116, 123)
} ,
Stop {
offset: 1.0
color: Color.rgb(2, 2, 2)
}
]
} ,
} ,
VBox {
transforms: bind Translate.translate(20, 20)
spacing: 27
content: [
// The calculator's display
TextBox {
text: bind displayStr
width: 238
height: 65
editable: false
style: bind "text-fill: #343434; "
"background-fill: #f4f4f4; "
"font: 28pt Dialog; "
"font-weight: bold; "
} ,
// The calculator's keys
VBox {
spacing: 2
content: for (row in [0..3]) {
HBox {
spacing: 2
content: for (column in [0..3]) {
Group {
var rectRef:Rectangle;
var textRef:Text;
content: [
rectRef = Rectangle {
width: 58
height: 50
fill: btnGradient
} ,
textRef =Text {
transforms: bind
Translate.translate((rectRef.layoutBounds.width -
textRef.layoutBounds.width) / 2,
(rectRef.layoutBounds.height -
textRef.layoutBounds.height) / 2)
content: keyLabels[row * 4 + column]
textOrigin: TextOrigin.TOP
fill: Color.rgb(222, 222, 222)
font: Font {
name: "Arial Bold"
size: 30
}
}
]
onMouseClicked: function (me:MouseEvent): Void {
displayStr = "{displayStr} {textRef.content}"
}
}
}
}
}
}
]
}
]
}
}

TOPICS
ActionScript
374
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 26, 2008 Dec 26, 2008
they're significantly different.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 26, 2008 Dec 26, 2008
LATEST
I took a look at javaFX, I was thinking about starting to learn it, but put it off for a bit due to lack of documentation. But I installed netBeans and everything. I took a look at the sample applications and they seem pretty different. Isn't javaFX Script written on Java
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines