using [java]javax.swing::JFrame
class JFrameDemo{
static Void main() {
frm := JFrame()
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
frm.setSize(800,600)
frm.setVisible(true)
}
}
JFrame disappear and program exited. Why?
I know about fwt::Window. But I want to use "Active Rendering" and java.awt.image.BufferStrategy. more
brianSat 19 Sep 2009
One bit of ugliness is that Fan requires you to put a sleep once you open the frame (right after you call setVisible):
frm.setVisible(true)
Actor.sleep(Duration.maxVal)
The reason for that is because Fan always calls System.exit as soon as the main returns so that it can return an exit code back to the caller.
tompalmerSat 19 Sep 2009
The reason for that is because Fan always calls System.exit as soon as the main returns so that it can return an exit code back to the caller.
Any way to watch to non-daemon threads spawned instead? Or some other such technique?
AkcelistoSat 19 Sep 2009
I have another question. I want to access to nice gfx api.
BufferStrategy bStrategy
Graphics2D jg
Void loop(){
try{
jg = (Graphics2D)bStrategy.getDrawGraphics
// here I want access to fwt::Graphics
g := Graphics(jg) // how to create fwt::Graphics from java.awt.Graphics2D?
}finally{
jg.dispose
}
bStrategy.show
// skip
}
How to create fwt::Graphics from java.awt.Graphics2D?
brianSat 19 Sep 2009
Any way to watch to non-daemon threads spawned instead? Or some other such technique?
Yeah, I'd like to come up with something a little better. Although in practice Swing is really the only time I've seen this issue come up. I don't really want to try and watch threads - that seems too fraught with peril. But I am open to other suggestions. If the semantics are that Fan forces an exit when main returns then it would be a breaking change to alter those semantics (meaning we should figure out what we want soon).
How to create fwt::Graphics from java.awt.Graphics2D?
We don't have a port of fwt::Graphics to Java2D yet. We have a port to SWT and to HTML5 Canvas. Although a port to Java2D would probably be pretty easy if anyone wants to try their hand at that project and submit a patch (not the whole FWT, just GFX).
Another feature I'd love to see is a gfx to PDF implementation. Andy has written a custom PDF graphics context before. I haven't looked recently but I would think there is an existing Java2D to PDF library already out there we could use. Although a 100% Fan version we could run in browser would be awesome!
Akcelisto Sat 19 Sep 2009
JFrame disappear and program exited. Why?
I know about fwt::Window. But I want to use "Active Rendering" and java.awt.image.BufferStrategy. more
brian Sat 19 Sep 2009
One bit of ugliness is that Fan requires you to put a sleep once you open the frame (right after you call setVisible):
The reason for that is because Fan always calls System.exit as soon as the main returns so that it can return an exit code back to the caller.
tompalmer Sat 19 Sep 2009
Any way to watch to non-daemon threads spawned instead? Or some other such technique?
Akcelisto Sat 19 Sep 2009
I have another question. I want to access to nice gfx api.
How to create fwt::Graphics from java.awt.Graphics2D?
brian Sat 19 Sep 2009
Yeah, I'd like to come up with something a little better. Although in practice Swing is really the only time I've seen this issue come up. I don't really want to try and watch threads - that seems too fraught with peril. But I am open to other suggestions. If the semantics are that Fan forces an exit when main returns then it would be a breaking change to alter those semantics (meaning we should figure out what we want soon).
We don't have a port of fwt::Graphics to Java2D yet. We have a port to SWT and to HTML5 Canvas. Although a port to Java2D would probably be pretty easy if anyone wants to try their hand at that project and submit a patch (not the whole FWT, just GFX).
Another feature I'd love to see is a gfx to PDF implementation. Andy has written a custom PDF graphics context before. I haven't looked recently but I would think there is an existing Java2D to PDF library already out there we could use. Although a 100% Fan version we could run in browser would be awesome!