JavaFX - Custom "Window"


AWT/Swing provides various top level windows such as Window, Frame, Dialog. javafx.stage.Stage is roughly the equivalent for Frame. We can instantiate and show multiple instance of Stage, or we may use Swing windows. But still it may not be convenient and will impact the look and feel of application (especially when deployed as Applet in Browser).

It may not be possible to emulate all features provided by Frame/Dialog (especially Modal-Dialog), but we may implement a CustomNode which has some basic look and functionality. Here is an attempt..

<script src="http://dl.javafx.com/1.2/dtfx.js"></script> <script src="/rakeshmenonp/resource/JavaFXWindow/JavaFXWindow.js"></script>


To launch click on above image or

Try it out and let me know feedback..


<script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="/rakeshmenonp/resource/JavaFXWindow/zoneit.js"></script>

Comments:

Hi Rakesh

thanks a lot for this real world app.

I would like to learn, what it is necessary to save record in a database.

Dieter

Posted by Dieter on December 21, 2009 at 04:06 PM IST #

@Dieter Thanks! There is nothing specific in JavaFX to connect directly to database. Its same as connecting from Java application. You may refer to

http://jfxstudio.wordpress.com/2009/02/22/javafx-sql-server/
http://jfxstudio.wordpress.com/2009/03/03/the-graphic-database-front-end/

I have received this query many times before, so I will also provide a simple sample which saves and retrieves records to database (But it will be same as Java code, nothing specific to JavaFX)

Posted by Rakesh Menon on December 22, 2009 at 01:21 AM IST #

a muchisismas gracias todo esto es de mucha ayuda mara mi, thanks :)

Posted by rodrigo salado on December 22, 2009 at 02:46 PM IST #

Hi Rakesh,
I wast just thinking about implementing this kind of dialog in my javafx application.
What would be cool imo is to to make the "main" application window darker when the dialog is showing.

Guido

Posted by Guido on December 29, 2009 at 06:31 AM IST #

@Guido Yes, I agree with you. One way to do this is to introduce another Rectangle (which will fill the entire Scene) with some transparency. Make this Rectangle visible, along with "Window".

Posted by Rakesh Menon on December 29, 2009 at 07:26 AM IST #

@Dieter I have new blog entry, hope this helps..
http://blogs.sun.com/rakeshmenonp/entry/javafx_database_table

Posted by Rakesh Menon on December 30, 2009 at 01:18 AM IST #

Thanks for your tips, Rakesh!
Simple and cool!
I noticed in your example you do only hide the dialog when it is closed. But this doesn't remove the dialog from the scenegraph ?
BR,

Posted by Guido on December 31, 2009 at 05:27 AM IST #

@Guido Good catch.. Yes it will be an issue when there are too many instances of "Window", it needs to be removed from scenegraph to enable garbage collection.

Posted by Rakesh Menon on December 31, 2009 at 07:35 AM IST #

Post a Comment:
Comments are closed for this entry.
About


The views expressed on this blog are my own and do not necessarily reflect that of my organization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today