Resizing to fill the window.

I would like my application resize to fill the available canvas, but am unable to figure out to make my StackPane expand to fill the space. My latest attempt is using binding, but I am getting a "A bound value cannot be set." exception on what I figured was a fairly basic usage of the facility:
<pre>
public class Test extends Application{
private StackPane rootGroup = new StackPane();
public static void main(String[] args) {
Application.launch(Test.class, args);
@Override
public void start(Stage primaryStage) {
Scene scene = new Scene(rootGroup, 350, 250);
rootGroup.widthProperty().bind(scene.widthProperty());
primaryStage.setScene(scene);
primaryStage.setVisible(true);
</pre>
At least, back in the 1.3 days, binding my container's height/width to the scene's height/width is how I accomplished this. How do I accomplish this with 2.0?
Edited by: JimSmyth on Sep 27, 2011 1:47 PM

Hi. There are some differences between javafx script binding and javafx2.0 binding.
Javafx Script Bind:
btn.layoutX = bind scene.width /2Javafx2.0 Bind:
btn.layoutXProperty().bind(scene.widthProperty().divide(2.0));In your case you are trying to bind StackPane’s width property which is defined as read only.
Here is a javafx2.0 binding example:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.shape.Rectangle;
public class TestBind extends Application {
    public static void main(String[] args) {
        Application.launch(TestBind.class, args);
    @Override
    public void start(Stage primaryStage) {
         Group root = new Group();
        Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
        Button btn = new Button();
        btn.layoutXProperty().bind(scene.widthProperty().divide(2));
        btn.layoutYProperty().bind(scene.heightProperty().divide(2));
        primaryStage.setTitle("Hello World");
        btn.setText("Hello World");
        btn.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent event) {
                System.out.println("Hello World");
        root.getChildren().add(btn);
        primaryStage.setScene(scene);
        primaryStage.show();
}

Similar Messages

  • HOW DO I GET WEB SITE TO FILL THE WINDOW?

    Various web sites I visit only fill the middle of the full open window. There is 3 or 4 inches of white space on the left and right side of the information within the open window. [it's happening here too]. I've used Safari and Foxfire with the same results. It's not a matter of zooming. For example, when I'm on a game at Facebook, the gaming area is a very small box, aprox. 4x6" in the middle of the open window. Minimize/zoom does not solve the issue. I'm assuming it must be solved within the screen preferences, but I didn't want to change anything until I read or learned more.
    When I used my Dell laptop everything filled the window, from corner to corner.
    Can anyone tell me how to change this. I have a 19" screen on my laptop, but I think I'm soon to be blind from trying to read the tiny print. Any help would be greatly appreciated. Thank you.

    The simple answer to your question is OSX does not work the same as Windoze where a window will fill the whole screen by maximising. In OSX it tends to make the window just the right size for what you are actually doing. You can manually resize the window by using the resizer at the bottom right corner of the window.

  • CacheDiagnosticsService fills the Windows drive in minutes

    I am running a Cloud Service that contains 4 web roles + 1 worker role. I am using in role caching across the 4 web roles. The worker role then populates the cache in the background.
    I am watching the Windows (D:) disk go from having 15GB free on a fresh spin up to having 0 bytes available. I have been able to run process monitor to see that it is the CacheDiagnosticsService.exe that writes directly into the ASP.NET IsolatedStorage directory.
    (D:\Windows\System32\config\systemprofile\AppData\Local\IsolatedStorage).
    Here's the event viewer message that persists constantly from the service crashing. I
    Application: CacheDiagnosticsService.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.ObjectDisposedException
    Stack:
       at System.IO.Compression.DeflateStream.EnsureNotDisposed()
       at MS.Internal.IO.Packaging.CompressStream.Flush()
       at MS.Internal.IO.Zip.ZipIOLocalFileBlock.FlushExposedStreams()
       at MS.Internal.IO.Zip.ZipIOLocalFileBlock.UpdateReferences(Boolean)
       at MS.Internal.IO.Zip.ZipIOBlockManager.SaveContainer(Boolean)
       at MS.Internal.IO.Zip.ZipIOBlockManager.SaveStream(MS.Internal.IO.Zip.ZipIOLocalFileBlock, Boolean)
       at System.IO.StreamWriter.Dispose(Boolean)
       at System.IO.StreamWriter.Close()
       at System.Xml.XmlTextWriter.Close()
       at System.IO.Packaging.ZipPackage+ContentTypeHelper.SaveToFile()
       at System.IO.Packaging.ZipPackage.Dispose(Boolean)
       at System.IO.Packaging.Package.System.IDisposable.Dispose()
       at Microsoft.ApplicationServer.Caching.AzureServerCommon.DiagnosticConfigHandler.CompressFileWithZipPackage(System.String, System.String)
       at Microsoft.ApplicationServer.Caching.AzureServerCommon.DiagnosticConfigHandler.MoveFiles(Boolean, System.String, System.String, System.String)
       at Microsoft.ApplicationServer.Caching.AzureServerCommon.DiagnosticConfigHandler.MoveFilesForUpload(System.Object)
       at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.TimerQueueTimer.CallCallback()
       at System.Threading.TimerQueueTimer.Fire()
       at System.Threading.TimerQueue.FireNextTimers()
    The same cloud service deployment was running for weeks when this problem started. 
    If this answer helped you, please vote or Propose as Answer.

    For an unknown reason, the CacheService crash dumped to disk (C:) it's memory contents (12GB)
    CacheDiagnosticsService is responsible for taking these dump files and moving into an upload directory within the same drive
    CacheDiagnosticsService executes as a windows service, and is writing it's temporary memory into the IsolatedStorage directory mentioned above
    I'm speculating that when the diagnostics service is reading the dump files into memory, the server is running out of memory and begins paging it's contents into IsolatedStorage
    Eventually this occurs enough with high resource utilization from cache service & dump file that it continues to happen eventually filling the windows disk
    Temporary fix until I can re-calculate capacity numbers and VM sizes:
    Delete contents within D:\Windows\System32\config\systemprofile\AppData\Local\IsolatedStorage
    Delete the offending file(s) (crash dump or general logs) within C:\Resources\Directory\{guid}.{my role name}.DiagnosticStore\
    If this answer helped you, please vote or Propose as Answer.

  • Keyboard shortcut for filling the window?

    A couple years ago I was routinely using a certain key combo which would instantly expand a PDF's pages to fill the window (rather than having to click the button in the GUI).  But I've forgotten how to do it.  I've searched the "keyboard shortcuts" list - in the Adobe Reader Help - but no sign of any such shortcut.  I'm currently using Adobe Reader 9.4.7.
    Anyone know?  Thanks.
    - Bob K.

    Yeah, that's a good one for maximizing the whole application window.  Problem is, it doesn't also stretch the document you're viewing - it leaves the document's zoom level unaffected (unless you've first used your mouse to click the "fill the window" button next to the zoom percentage field, which is what I'm trying to avoid having to do each time I call up a PDF).  What I remember was a keyboard shortcut to just make the document fill the app window - without also maximizing the app window to full screen.
    The good news is, I just stumbled onto the answer a few minutes ago myself, by trying different key combinations.  Turns out, it's Ctrl-3.  If a PDF's zoom level is currently set at, say, 50%, you can hit Ctrl-3 and the document will stretch to whatever zoom percentage will fill the app window's current size.  If your Reader window is maximized and you hit Ctrl-3, your current 50% document might jump to something like 142%, whereas if the window is un-maximized, say, to about half your total screen area, the doc may only need to jump to 70.4% to fill that smaller window.
    Well well.  Happy joy!!
    Thanks for the reply.
    - Bob K.

  • Here's your prototypical Dumb Question: Web Pages are displayed as centered on 4.0- how do I have the page fill the window?

    Here's your prototypical Dumb Question: Web Pages are displayed as centered on 4.0- how do I have the page fill the window?

    Do the following:
    1 - launch iPhoto with the Command+Option keys held down to open the First Aid window.
    2 - Run Option #4, Rebuild Database.

  • GridBagLayout resizing while making the window smaller

    Hi,
    I am maintaing a Swing app in which the GridBagLayout is extensively used. The GBL is not my cup of tea, I'd rather replace it by one of the LayoutManagers I seem to be able to control, but GBL is all over the place and not easily replaced. Now for the question: when a window is maximized, the components are resized as expected (made larger), when subsequently the window is made smaller again, the components remain large instead of shrinking back to their normal size and scrollbars appear. Can anyone give me a quick hint or pointer where to start looking in the docs or code to control shrinking?
    Thanks,
    Marnix

    Other windows in the same application do behave better, although most of their components remain at their original size.
    The window is being repainted as scrollbars appear when made smaller. I really would like to experiment with some settings on the constraints but I lack understanding of what parameters control the shrinking back to the "normal" size.
    I'll be checking the min/pref and max sizes settings.
    The fill parm is set to BOTH...
    As to an SSCCE: it is all part of a rather baroque collection of interdependent customized GUI components, I did not invent them but I have to deal with them. If any means of controlling the shrinking exist I'll happily read up on them and excersise the option in my app myself but so far a lack a starting point...

  • How to make the text resize to fit the window ?

    Hi,
    I'm making a website using Adobe Edge and I want the text to resize when the window is resized too. I tried some jQuery plugins but had no success. Any help would be greatly appreciated.
    Thanks in advance,
    Rafael Carignato

    See this post your question was already answered there:
    http://forums.adobe.com/message/5045627#5045627
    Here is a sample file of text that re-sizes according to window size:
    http://www.meschrene.puremadnessproductions.net/Samples/Resize-Text/Sample.html
    http://www.meschrene.puremadnessproductions.net/Samples/Resize-Text/Sample.zip

  • Resize effect maintaining the window centered

    I have a TitleWindow that I open using the PopUpManager.
    PopUpManager.centerPopUp(paymentWindow);       
    I would like to apply a resize effect when I show the window.
    <mx:Resize id="expand"  widthTo="640" heightTo="480"/>
    The problem is that the TitleWindow is resized from the upper left corner to the bottom right corner. So the popup is no more centered. How can I apply the same effect but maintaining the window centered in the screen while it is resized?

    I don't understand completely.But below is a piece of code I wrote render a image as a zoom popup and then when i cliked on the pop up it resized to its original size. May be it can help you
    use :-
    img.addEventListener(MouseEvent.CLICK, image_click);
    img.addEventListener(ResizeEvent.RESIZE, image_resize);
    PopUpManager.addPopUp(img, this, true);
    and
    private function image_click(evt:MouseEvent):void {
                        PopUpManager.removePopUp(evt.currentTarget as Image);
    private function image_resize(evt:ResizeEvent):void {
                       PopUpManager.centerPopUp(evt.currentTarget as Image);
    If you are using image.

  • Putty fills the window with dots

    When I click "Open"  after filling the "Hostname or IP Address" input box, it opens a window filled with dots and I cannot see anything. I am using KDE 4.7. What should I do not to see the dots? Here's the screenshot what I was trying to explain:
    Is there any suggestion for the problem?

    So lets say I have a JPanel called login, another JPanel called sales, and then a JFrame called userInterface. So the way I'm thinking is when the button in login is clicked it validates the data, then creates an instance of sales and passes sales to a method I have written in userInterface called updateWindow. Where in this method it should add sales to the correct BorderLayout and then call revalidate. Does this seem correct?

  • ADOBE CLOUD ON MY DESKTOP WILL NOT WORK. IT LOADS UP BUT NOTHING FILLS THE WINDOW

    ADOBE CLOUD ON MY DESKTOP WILL NOT WORK. IT LOADS UP BUT NOTHING FILLS THE WINDOW

    BLANK Cloud Screen http://forums.adobe.com/message/5484303 may help
    -and step by step http://forums.adobe.com/thread/1440508?tstart=0
    -and http://helpx.adobe.com/creative-cloud/kb/blank-white-screen-ccp.html

  • Hint on resizing components with the window

    Hi,
    I'm making a web browser and am having a bit of trouble getting the componenets inside ( a JSpliPane with various bits in it) and the top buttons to resize with the main frame when it is resized. At the moment it all stays in the top left at the same size.
    I would like it for the menu to just expand width ways and the JSplitPane to rezise fully to take ip the rest.
    Any ideas on where to start, I have an idea that it may be layout managers, but i cant seem to see how to get one to do this.
    Any pointers would be appreciated cheers (I will happilly look up the API if someone could tell me where to start).
    Cheers :)

    Use a LayoutManager, more specifically BorderLayout.
    JFrame f = new JFrame();
    f.getContentPane().setLayout(new BorderLayout()); //BorderLayout is the default layoutmanager
    f.getContentPane().add(myContentPane, BorderLayout.CENTER);And that's it...

  • Sometimes a Firefox window top bar goes weird, and the window controls at extreme top right disappear.

    Sometimes, after its been going quite a long time. a Firefox window top bar goes weird, and the window controls at extreme top right disappear, making it impossible to resize or close the window. The only solution I have found is to individually move the tabs to a new window. The original (bad) one then disappears as soon as the final tab is shifted.

    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings, disables most add-ons (extensions and themes).
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu:
    *In Firefox 29.0 and above, click the menu button [[Image:New Fx Menu]], click Help [[Image:Help-29]] and select ''Restart with Add-ons Disabled''.
    *In previous Firefox versions, click on the Firefox button at the top left of the Firefox window and click on ''Help'' (or click on ''Help'' in the Menu bar, if you don't have a Firefox button) then click on ''Restart with Add-ons Disabled''.
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    When the Firefox Safe Mode window appears, select "Start in Safe Mode".<br>
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • I would like to know how to increase the window size and message font size on the the Three Button Dialog.vi

    I like using the Three Button Dialog .vi. However, I am doing a job were I need to use a larger font size. I tried to adjust the core vi but could not make it do what I wanted. Any help would be great.

    Jeff Bohrer wrote:
    1: VI Properties Window Size- Check maintain proportions of window for different monitor resolutions.  (Your users will thank you)
    Jeff,
    Why do you think that is a good idea?  When I opened your VI on my screen, the buttons were cut off at the bottom, and there was a slight cutoff on the right side.  Without scrollbars or the ability to resize the panel, (which I generally wouldn't want on a dialog box anyway) there is no way to be able to see the whole dialog.
    Did your VI show all of the buttons and show all of the text box?  On mine it looked like this.
    What was your screen resolution and your monitor aspect ratio?  Mine is 1680 x 1050 for a 16:10 ratio.  I think you will have problems with checking this box.  I would recommend unchecking it.  Suppose you programmed on a 16:10 screen, but someone else has a 16:9, or even a 4:3.  That is going to screw up the appearance of the dialog unless you take the time to resize the buttons and text inside the dialog.  (And I feel checking the resize option inside the Window Appearance settings just never works right either.)
    If I was the user, I'd appreciate a dialog box that wasn't cut off. 
    Attachments:
    3ButtonDialog.PNG ‏6 KB

  • Background image to fill the whole screen

    Hi everybody
    Please assist,
    1st question : I want to add the background image that fit the whole screen. I have tried to put image background however it leaves white spaces on the edges and another thing is that after adding the background image when I add content in the tables the background image start to repeat.
    This is the website example I want to achieve : www.inesjaksic.com , www.grupa-desperado.com
    www.street-heroes.com
    2nd question : How to add the scroll bar on the text content, so when you scroll only the text moves.
    Website example : http://www.kls.com/page.php?p=about/biography/index
    Thank you in advance for your help.
    Kind regards
    Vusi
     

    #1 Background images are static.  They don't resize to fill the browser viewport without a lot of additional tricks which may or may not work in all browsers.   Moreover images that resize quickly become distorted.   For best all around results, build your page to a fixed-width target audience (990px is usually fine for most users).  Use a seamless background tile or gradient slice and repeat it vertically (repeat-y), horizontally (repeat-x) or both ways (repeat).
    #2 Use CSS overflow and height property.
    #divName {
    height: 400px;
    overflow: scroll;
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Put my macbook pro to sleep. When I opened it, the desktop window is small and I can't resize it. All applications now run in the smaller size window.  Can't make it fill the screen. Just switched from windows.  Thank you.

    Put my macbook pro to sleep. When I opened it, the desktop window is small and I can't resize it. All applications now run in the smaller size window.  Can't make it fill the screen. Just switched from windows.  Thank you.

    Check to see if the resolution has been changed in System Preferences.
    Allan

Maybe you are looking for

  • Strange nop(?) code in java.awt.Dialog

    Can anyone give some explanation for the following code? private void hideAndDisposeHandler() {     if (keepBlocking) {         synchronized (getTreeLock()) {             keepBlocking = false;             EventQueue.invokeLater(new Runnable(){ public

  • Unzip flat file in pipeline

    Hello All, One of my requirement is to unzip the flatfile in pipeline and process it and convert it in XML. Can some one give me reference link or article... ??? Thanks and Regards, Nitin.

  • PDF fast web view option don't work like the specification  Acrobat Reader suggest...

    I have an optimized/linear PDF file for support fast web viewing option. My issue is about the plugin comportment. In the Adobe specification, when the plugin receive a large optimized PDF file, he suppose to be began to read and show the PDF file af

  • When importing files, folders are not updated?

    Could anyone please help? Since I reinstalled Lightroom on a new harddrive (after a crash) whenever I import photos into my library, they appear in "Previous Import", but they are not visible in the destination folder. Even if I, in the import screen

  • Type conflict error - in Transformations

    Hi all, I have done Transformation euregine of Transfer/Update rules for 0FI_AA_006 DS/IS I have activated and loaded till PSA.When  Iexecuting my DTP it is showing an dump stating that " Dump: ABAP/4 processor: ASSIGN_TYPE_CONFLICT " . I have seen a