SimpleSwingEditor.fx
package com.aspectsolution.javafx.example;
import javafx.ext.swing.SwingComponent;
import javax.swing.JEditorPane;
import java.awt.Dimension;
public class SimpleSwingEditor extends SwingComponent {
public override function createJComponent() {
var wrappedEditor: JEditorPane;
wrappedEditor = new JEditorPane();
wrappedEditor.setPreferredSize(new Dimension(width, height));
return new JEditorPane();
}
}
Main.fx
/*
* Main.fx
*
* Created on Dec 10, 2008, 11:23:38 PM
*/
package com.aspectsolution.javafx.example;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
Stage {
title: "Simple Swing in FX"
width: 400
height: 300
scene: Scene {
content:
Group {
content: [
Rectangle {
width: 400
height: 300
fill: Color.BEIGE
},
Circle {
centerX:200
centerY:130
radius: 120
fill: Color.LIGHTBLUE
},
Text {
font: Font {
size: 24
}
x: 10, y: 30
content: "A Simple Editor"
},
SimpleSwingEditor {
width: 400, height: 270
translateY: 60
opacity: 0.8
}
]
}
}
}

No comments:
Post a Comment