Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to fit javafx Screen in browser window

 
shalini chaurasia
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made javafx application so when i am running this app at browser it showing half part of the screen, so how can i make this fit to screen in browser.
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you gone through the tutorial?
 
John Damien Smith
Ranch Hand
Posts: 298
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl's right, the relevant part of the tutorial is, the part which says =>

width and height
Dimensions used to reserve space for an embedded application. The values can be absolute (in pixels) or relative (for example, 50 or 50%).


But the deployment tutorial will only get you so far with sizing your application to fit a browser window as it is not comprehensive in this regard . . .

So what you want is to have the width and height set to 100%, then your app will fill the html page.
By default browsers will add some padding around html elements, so you need to apply a little bit of css to the web page embedding your app so that it fills the entire area.
Look to the standard Ensemble example for JavaFX for an example of how to do this.
Download the source code for ensemble from the page I linked.

The standard JavaFX deployment packaging tools did not used to directly support percentage sizing for embedded apps, but I have not tried it for a long time and perhaps the current ones do.
What Ensemble had done to get it working was have a custom ant build xml file which post processed the generated html page to modify it to use the percentage values.
Check the Ensemble ant build source to see if that is still in there or if it just directly specifies the percentage sizes in it's ant deployment tasks.
You will need to download the Ensemble project, and build it (either from the command line with the ant tool, or (probably easier) from NetBeans).
Once you have done that, in the dist subdirectory, you find a generated html file that contains the essential dtjava.embed parameters (the 100% width and height specifiers) and the css style rules to remove default padding so that the page will fill the entire screen.







 
shalini chaurasia
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is not working, it is taking browser specified size.
 
John Damien Smith
Ranch Hand
Posts: 298
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> The code is not working, it is taking browser specified size.

The code works, it is doing what it is supposed to do, (make the JavaFX app fill the available area of a browser window).

Did you follow my instructions and build and run the Ensemble application in a browser?

Perhaps you want a different effect or behaviour, but if so you need to describe what you require much better.
You can link screen shots, offer more in depth explanations, post an sscce, etc.
 
shalini chaurasia
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used the given code. but its working only for first page, when i clicked for second page it takes browser specified size like 800*600. please help me !!
 
John Damien Smith
Ranch Hand
Posts: 298
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it is possible to assist on this question without an sscce and a better description of issues you are facing.

If you create an sscce you can also post it to either the Oracle JavaFX forums or StackOverflow with a JavaFX tag as both of those places are far more active regarding JavaFX than JavaRanch. If you do decide to crosspost, follow JavaRanch's crossposting rules, don't do it without first creating an sscce and make sure that your question is complete and describes your issue in enough detail that somebody would actually be able to assist you in solving it.
 
shalini chaurasia
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK

Thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic