Fortress Maximus
Holy crap, I just figured out how to programatically maximize a JavaFX Stage in code. Well, technically a JFXStage from the JFXtras library, since you need access to the Window which also may or may not secretly be a Frame. It's an ugly hack. Hopefully JavaFX 1.5 will have a proper way to do it.
I bet the code will format beautifully...
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import org.jfxtras.stage.JFXStage;
import javafx.ext.swing.SwingButton;
import java.awt.Frame;
/**
* @author Owner
*/
var jfxs: JFXStage = JFXStage {
title: "Application title"
width: 250
height: 80
scene: Scene {
content: SwingButton {
text: "Button"
action: function() {
if(jfxs.getWindow() instanceof Frame) {
println("hallelujah!");
var frame = jfxs.getWindow() as Frame;
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
} else {
println("boooourns!");
}
}
}
}
}
