Bug or feature? Panel layout doesn't work when Stage contained in class

I have found a very strange behavior. But can't really understand what goes wrong. So I hope I can get some hints here.
Just try the following demo:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.Panel;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.layout.Container;
public function run(   ) {
  //Remove the next two lines for a miracle!
  Asdf {}}
public class Asdf {
  def stage: Stage = Stage {
      scene: Scene {
        width: 800
        height: 600
        content: [
            def p: Panel = Panel {
                width: bind stage.scene.width
                height: bind stage.scene.height
                onLayout: function (): Void {
                  p.resizeContent();
                  for ( node in Container.getManaged( p.content ) ) {
                    Container.positionNode( node, indexof node * 20 + 50, indexof node * 30 + 40, true );
                content: [
                  Rectangle {
                    width: 140, height: 90
                    fill: Color.ORANGE
                    opacity: 0.5
                  Rectangle {
                    width: 100, height: 120
                    fill: Color.BLUE
                    opacity: 0.5
}The layout function is called, but the values are not respected...
Now just remove the two lines containing the object initialization and class definition. It should look like that:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.Panel;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.layout.Container;
public function run(   ) {
  //Remove the next two lines for a miracle!
//  Asdf {}}
//public class Asdf {
  def stage: Stage = Stage {
      scene: Scene {
        width: 800
        height: 600
        content: [
            def p: Panel = Panel {
                width: bind stage.scene.width
                height: bind stage.scene.height
                onLayout: function (): Void {
                  p.resizeContent();
                  for ( node in Container.getManaged( p.content ) ) {
                    Container.positionNode( node, indexof node * 20 + 50, indexof node * 30 + 40, true );
                content: [
                  Rectangle {
                    width: 140, height: 90
                    fill: Color.ORANGE
                    opacity: 0.5
                  Rectangle {
                    width: 100, height: 120
                    fill: Color.BLUE
                    opacity: 0.5
}Now everything works as expected... Any hints? What did I miss?

I have found a very strange behavior. But can't really understand what goes wrong. So I hope I can get some hints here.
Just try the following demo:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.Panel;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.layout.Container;
public function run(   ) {
  //Remove the next two lines for a miracle!
  Asdf {}}
public class Asdf {
  def stage: Stage = Stage {
      scene: Scene {
        width: 800
        height: 600
        content: [
            def p: Panel = Panel {
                width: bind stage.scene.width
                height: bind stage.scene.height
                onLayout: function (): Void {
                  p.resizeContent();
                  for ( node in Container.getManaged( p.content ) ) {
                    Container.positionNode( node, indexof node * 20 + 50, indexof node * 30 + 40, true );
                content: [
                  Rectangle {
                    width: 140, height: 90
                    fill: Color.ORANGE
                    opacity: 0.5
                  Rectangle {
                    width: 100, height: 120
                    fill: Color.BLUE
                    opacity: 0.5
}The layout function is called, but the values are not respected...
Now just remove the two lines containing the object initialization and class definition. It should look like that:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.Panel;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.layout.Container;
public function run(   ) {
  //Remove the next two lines for a miracle!
//  Asdf {}}
//public class Asdf {
  def stage: Stage = Stage {
      scene: Scene {
        width: 800
        height: 600
        content: [
            def p: Panel = Panel {
                width: bind stage.scene.width
                height: bind stage.scene.height
                onLayout: function (): Void {
                  p.resizeContent();
                  for ( node in Container.getManaged( p.content ) ) {
                    Container.positionNode( node, indexof node * 20 + 50, indexof node * 30 + 40, true );
                content: [
                  Rectangle {
                    width: 140, height: 90
                    fill: Color.ORANGE
                    opacity: 0.5
                  Rectangle {
                    width: 100, height: 120
                    fill: Color.BLUE
                    opacity: 0.5
}Now everything works as expected... Any hints? What did I miss?

Similar Messages

  • Panel.setPreferredSize() doesn't work

    I have a internal frame. In this internal frame, I need to dynamic generate panels and put labels data in each panel.
    The panels and labels are generate correctly, but panel.setPreferredSize() doesn't work.
    I hope each panel can have the same width. can someone take a look for me? Thanks a lot~~
    Here is my code. When the internal frame is initialized, it will call addPanel() function.
    public void addPanel(int[][] cluster, String[] labels, String[][] searchResult){
             JPanel mainPanel = new JPanel();
             mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
            mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
             //panel for clusters
             JPanel[] clusterPanel = new JPanel[cluster.length];
             docsLabel = new JLabel[searchResult[3].length];
             int docIndex, docsLabelIndex=0;
             for(int i=0;i<cluster.length;i++){
                  //set up border for cluster panel
                  clusterPanel=new JPanel();
                   clusterPanel[i].setBorder(BorderFactory.createCompoundBorder(
    BorderFactory.createTitledBorder(labels[i]),
    BorderFactory.createEmptyBorder(3,3,3,3)));
                   clusterPanel[i].setLayout(new BoxLayout(clusterPanel[i],BoxLayout.Y_AXIS));
              for(int j=0;j<cluster[i].length;j++){
                   docIndex=cluster[i][j];
                   labelsIndex[docIndex]=docsLabelIndex;
                   docsLabel[docsLabelIndex]= new JLabel(url[docIndex]);
                   docsLabel[docsLabelIndex].setToolTipText(searchResult[3][docIndex]);
                   docsLabel[docsLabelIndex].setHorizontalTextPosition(JLabel.LEFT);
                   docsLabel[docsLabelIndex].setOpaque(true);
                   docsLabel[docsLabelIndex].addMouseListener(this);
                   clusterPanel[i].add(docsLabel[docsLabelIndex]);
                   clusterPanel[i].addMouseListener(this);
                   clusterPanel[i].setName(Integer.toString(i));
                   docsLabelIndex++;
                   clusterPanel[i].setPreferredSize(new Dimension(200, 50)); ----------------->this doesn't work
              clusterPanel[i].setOpaque(true);
                   mainPanel.setOpaque(true);
                   mainPanel.add(clusterPanel[i]);
         ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
              sp.setBounds(2,2,2,2);
              sp.setVisible(true);
              sp.add(mainPanel);
         this.add(sp);

    are you sure that the panels are the ones that are the wrong size? Maybe the contents of the panels sizes only make it look that way. Try setting different types of components to have different background colors to see what's what.
    Keep in mind that preferred size only specifies the preferred size. It doesn't mean that a layout manager has to respect that. Although, I would expect BoxLayout to do so.

  • [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

    When selecting a menu item I used to click the left mouse button and hold it down, move the pointer to the desired menu item and release the mouse button. Everything works fine in the mine menu, but there's a problem when adding new adjustment layer from the layer panel: when I release the button nothing happens, I have to press the button again. In previous PS version it worked fine. How can I fix this?

    I don't think that is user fixable, meaning you'll have to wait till adobe fixes it with an update.
    Photoshop cc 2014
    windows does not work
    mac does work
    Did you already post over here:
    [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

  • [svn] 4028: Bug: Draining of buffered messages doesn' t work correctly with long-polling.

    Revision: 4028
    Author: [email protected]
    Date: 2008-11-06 09:04:26 -0800 (Thu, 06 Nov 2008)
    Log Message:
    Bug: Draining of buffered messages doesn't work correctly with long-polling.
    QA: Yes - please make sure both nio and regular long-polling channels work with throttling.
    Doc: No
    Checkintests: Pass.
    Details: Made sure that buffered messages are drained properly with all polling channels (polling, long-polling, and nio-long-polling).
    Modified Paths:
    blazeds/trunk/modules/core/src/flex/messaging/client/FlexClient.java

    Sounds like you've probably already looked but the CUPS article in the wiki led me through setting up a printer without any problems.  http://wiki.archlinux.org/index.php/CUPS
    The first section describes how to troubleshoot CUPS and printing problems.
    I've also found a few other posts and links that may help.
    http://hplipopensource.com/hplip-web/mo … eries.html
    http://ubuntuforums.org/showthread.php?t=419163
    Hope this helps!

  • HT4623 Landscape feature on iphone doesn't work after OS 7 download.  HELP.

    The landscape feature on iphone doesn't work after OS 7 download.  How do i fix it?!

    Swipe up from the bottom.  Control center should cover about 2/3 of the screen.  At the top right of control center is a circle with a lock in it.  If that lock is closed, tap to open it.

  • After installing Mavericks on my MacBook Pro 2009 (japanese keyboard) the layout doesn't work. I mean if I press the @ button the è symbol comes out. I tried to change the layout in Preferences but doesn't work. Could anyone help me please?

    Hi there
    after installing Mavericks on my macbookpro 2009 (Japanese keyboards) the layout doesn't work anymore. I mean, if I press the "@" button the "è" symbol comes out. I did already change the layout in the Preferences but it didn't work.
    Could anyone help me please?

    Apple has changed the way Kotoeri keyboard layouts work.  You should be able to get normal behavior if you activate the US layout and switch to that just before using Kotoeri.  Here is also an Apple note on the topic with another suggestion:
    http://support.apple.com/kb/TS5284
    Be sure to tell Apple you want this changed back to the way if was in 10.8 and earlier via
    http://www.apple.com/feedback
    If you know Japanese well, you might ask on the Japanese discussions whether someone has found a better fix for this:
    https://discussionsjapan.apple.com

  • Hello. I recently updated numbers on my macbook pro. I like the auto completion feature (proposing te word as I type). With this new update, I cannot see this feature and it doesn't work automatically. Can I have any help on this issue ?

    Hello. I recently updated numbers on my macbook pro. I like the auto completion feature (proposing te word as I type). With this new update, I cannot see this feature and it doesn't work automatically. Can I have any help on this issue ?

    This is really unfortunate. I'm sorry that nothing works. I was going to mention holding down the power button and doing a force shutdown but you already did that. You might need to take it into the Apple store. I don't know if booting into safe mode would help. You would have to turn off the machine again, hit the start button and hold down the shift key after you hear the tone, but normally you would let go of the shift key when you see the apple logo and spining wheel. Maybe by holding down the shift key after you here the tone will cause the screen to come back on? The other option is to start up from the 'install disk' if your machine came with one. You would insert the disk, then shut down the computer, and hold down the C key right after hitting the start button.
    Here's the link for the safeboot
    http://support.apple.com/kb/HT1564?viewlocale=nl_nl

  • Collapse action doesn't work when several hierarchical columns in a report

    Hello everyone!
    I have an analysis which contains 6 hierarchical columns. And the problem is that for the 5th and 6th columns collapse doesn't work. I can easily expand the column, but I can't collapse it back. The first four columns are collapsing fine. Is there a bug which describes this?
    I'm using OBIEE 11.1.1.6.7. Tried to check this issue in Mozilla and IE - collapse didn't work in neither of them.

    It doesn't work here either. After checking the italicized bit below, I see that it doesn't work when called by an application either. It looks like a bug.
    Here's the fix I found here. Put it in the automator action "run Applescript"
    http://bbs.applescript.net/viewtopic.php?id=15292
    on run {input, parameters}
    --Pop Box
    display dialog "Automator hosed me with a bug, so I'm making you wait for 5 secs with delicious Applescript." giving up after 5
    return input
    end run
    The non-working solution :P
    One suggestion - split the workflow into two (or more) parts.
    1. Open Finder Items with Default Application
    2. Ask for Confirmation
    3. Run Workflow
    4. Wait for User Action
    5. Open Finder Items with Specific Application
    Save the first as an app, the second as a workflow.
    BG3, G4QS, G4ALPB   Mac OS X (10.4.3)  

  • My speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    my speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    Thanks for your solution, it wasn't quite what solved the problem but i remembered that i had a bit of salt water on my phone recently and spraying the charging port with an anti-oxide spray solved my problem, do you mind if i ask, how is the charging port related with the volume or/and speakers?

  • BitmapData draw method doesn't work when the project is published as the .swf file of the web applic

    Hi,
            I am totally confused by this strange error. When I tried using the draw method of BitmapData to draw a movieclip symbol of my project, it seems to work fine locally. However, as I uploaded the published .swf file to my web server and launched it as the plugin of my web application, it failed. The source codes as follows,
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    message3 didn't show at all. Instead, the browser console shows "Uncaught Error: Error calling method on NPObject.". My understanding of this error message is that the .swf is calling something crashing, and I believe that bd.draw(stage)is the crashng method call.
    Also, here is my html embed tag:
        <embed src="/tests/videoplayer.swf" id="flash" quality="high" height="510" width="990" scale="exactfit" name="squambido" align="middle" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" style="margin: 0px auto;clear:both;position:relative;"/>
    Can someone help me?

    Thank you for your reply.
    I tried stageWidth and stageHeight, but it still doesn't work.
    The draw() methid is triggered when I clicked a screenshot button in my application as follows,
    ExternalInterface.addCallback("printscreenClicked", printscreenClicked);
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    Would you please give me an example of "waiting for Event.RESIZE is good, or just at least Event.ENTER_FRAME"?
    My real purpose in this application is to capture a snapshot of a streaming video. The video is contained in a movieclip object. I tried stage first since BirmapData.draw() doesn't work when drawing the movieclip on the web site. Do you have any suggestion for this situation? Also, is there any good method to find out what happened if the browser have "Uncaught Error: Error calling method on NPObject."?

  • I have different account ID's with my iphone and computer. I would like to standardise both to just the one. One of the ID's doesn't work, when I tried to list the second email with the preferred one a message telling me that this email is already in

    I have different account ID's with my iphone and computer.
    I would like to standardize both to just the one.
    One of the ID's doesn't work, when I tried to list this second email with the preferred one a message telling me that this email is already in use pops up.. yes it is, with me??
    Is there an easy to fix this please, Fabfitz

    If the email address you want to use is being used as the primary email address on a different ID you have to manage that ID and change it to a different primary email address.  This explains how: Change your Apple ID - Apple Support.
    If it is being used as an alternate or rescue address on a different ID, you manage the ID and either remove it or change it to a different email address.  This explains how: Manage your Apple ID primary, rescue, alternate, and notification email addresses - Apple Support.

  • I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing

    I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing my document using Microft Word 2010. I have tried using the tab add-in, but it doesn't respond either. The only way to convert my document is to save it as a .pdf from the save as drop down box. I need to be able to have the full functionability of creating a PDF document with the tabs and links working.
    Please help!

    From OFFICE 2010 you either have to have AA X or just print to the Adobe PDF printer. You give no information on your operating system or specifically what you mean by PDFing -- there are multiple ways to create a PDF from a WORD document and you have given no information. However, in this case your only choice is to print to the Adobe PDF printer. Otherwise, you need to upgrade Acrobat.

  • TS1398 The internet on my Iphone 4 doesn't work when I use the Wifi

    The internet on my Iphone 4 doesn't work when I use the Wifi at home. My Mac works fine. On the Iphone it shows it's connected but it doesn't open any app. Anyone knows what to do? Thanks

    Ÿ. If you tap and hold the "Y" does it appear? If so, just slide your finger up to select.

  • It doesn't work when I press "transfer purchased items from ipod" and I don't know specidicly whitch item I need to transfer

    It doesn't work when I press "transfer purchased items from ipod" and I don't know specidicly whitch item I need to transfer.
    Whenever i press "transfer purchased items from ipod", itunes sync's for about 3 seconds, but I still can't install updates on the ipod without itues warning me about purchased items on the ipod, that aren't in the itunes library. I've tried folowing the steps in itunes help, but I can only find a step guide for when you know the specific item that needs transferring, and I donøt know that specific item.

    This Apple Tech Note explains the process:
    http://support.apple.com/kb/ht1848
    It will transfer all purchased items that the computer you are transferring to is authorised to play: you don't have to select the items.

  • I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

Maybe you are looking for

  • Voice memos saving in iTunes to macbook

    iphone 3gs voice memos show in iTunes under devices and play fine - but how do I transfer/copy to the macbook - won't let me drag to mac folder or anything.... Q: how do I copy / move them to mac

  • EBP - SUS integration

    Hi experts,      I m new to SRM5.0.  Can any one explain me abt EBP-SUS integration? Wt is the need of this integration? wt r the prerequisites to this? I m using EBP4.0 and SRM5.0. Kindly help me on this. Regards Raaams.

  • Regarding the installation of portal

    hi there, i have installed sap netweaver ce  trail version with nwds , but was not able to find the portal component in the download from where can i download the portal component and for nw as ce 1.0 and is it necessary to install the portal for ins

  • 7.2.1 crashed iPhone

    iPhone keeps flashing Apple logo after 7.1.2 update. Trouble started after iPhone  did automatic upgrade to 7.2.1; wouldn't turn on. Went through all the steps to reset (hold sleep and home button) Finally went to iTunes to reset to factory. Now phon

  • Oracle Forms code review documentation tool?

    To achieve an SEI Level-3 certification, one must do code reviews. Is there a tool for creating a document containing 'all the code' in an Oracle*Form v6.0? We are basically looking for the equivalent of the old FORMDOC feature of Forms 4.0; it liste