Changing BorderPane contraints causes component to disappear

Hello everyone,
I have this short snippet that is giving me a headache, don't know if it's something i'm doing wrong but the behavior seems weird to me:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class MainWindow extends Application {
     public static void main(String[] args) {
          Application.launch(args);
     public void start(Stage s) {
          BorderPane workArea = new BorderPane();
          Button button = new Button(".");
          Scene scene = new Scene(workArea, 800, 600, Color.TRANSPARENT);
          s.setScene(scene);
          s.show();
          workArea.setCenter(button);
          workArea.getChildren().remove(button);
          workArea.setLeft(button);
          workArea.getChildren().remove(button);
          workArea.setCenter(button);
}As you can see i move the same component back and forth between left and center. When you run this piece of code you'll get and empty stage.
I have a workaround (more like a hack) but it seems that i'm lacking something, what i do in order for this to work is creating a new instance of button and remove the original from the Pane, this works ok but then i would have to copy all the properties from the original object.
Any idea on if it's normal, why, and how to workaround this?
Thanks
Bruno

Hi Bruno,
Yea, weird this doesn't work - just ran it and got the same results as you. Strangely the following does work:
public void start(Stage stage) throws Exception
    BorderPane workArea = new BorderPane();
    Scene scene = new Scene(workArea, 800, 600);
    stage.setScene(scene);
    stage.show();
    Button button = new Button("Test");
    workArea.setLeft(button);
    workArea.setLeft(null);
    workArea.setRight(button);
    workArea.setRight(null);
    workArea.setCenter(button);
}So it looks like it is a problem specifically with the remove on BorderPane not doing something that the setLeft/Right/Center does. I can't see a bug for it so I would suggest raising one. The above code is painful as you would have to record where it was last added in order to remove it on the next move.
You could also use another layout. For my money, I highly recommend MigLayout. You can do very complex layouts simply in a single pane and it handles this dynamic adding stuff well:
public void start(Stage stage) throws Exception
    MigPane workArea = new MigPane("fill");
    Scene scene = new Scene(workArea, 800, 600);
    stage.setScene(scene);
    stage.show();
    Button button = new Button("Test");
    workArea.add(button, "left");
    workArea.getChildren().remove(button);
    workArea.add(button, "right");
    workArea.getChildren().remove(button);
    workArea.add(button, "center");
}You need the core MigLayout library from here: http://www.miglayout.com/
And the JFX wrapper is here: http://java.net/projects/miglayoutfx2/pages/Home
Start using Mig and you will never look back. I have used it in Swing heavily for commercial apps and it has never let me down.
If you can't bring yourself to use Mig, and you only want to change the anchor like in your simple example, here's a little cheat that seems to work:
public void start(Stage stage) throws Exception
    GridPane workArea = new GridPane();
    Scene scene = new Scene(workArea, 800, 600);
    stage.setScene(scene);
    stage.show();
    Button button = new Button("Test");
    workArea.add(button, 0, 0);
    workArea.setAlignment(Pos.CENTER_LEFT);
    workArea.setAlignment(Pos.CENTER_RIGHT);
    workArea.setAlignment(Pos.CENTER);
}This sidesteps the whole add/remove issue.
Cheers,
zonski

Similar Messages

  • Changing Ownership & Permissions caused Volume to Disappear

    When changing "Ownership & Permissions" on one of my volumes, under ""Ownership & Permissions > Details > Others" I selected "No Access." As a result the volume has disappeared from the desktop. As a result I cannot access it even though I am the Administrator. How do I get the volume to reappear again on the desktop so that I can change the "Ownership & Permissions" back to normal? I am using OS 10.4.9. Thank you.
    eMac Power PC G4   Mac OS X (10.4.9)   800 MHz, 512 MD SDRAM

    Follow the instructions in the section of this FAQ which is relevant to your situation.
    (21095)

  • It seems my "passed" events in my calendar are not on my iphone anymore...Is there a setting I have changed that caused them to disappear?  They do still appear on my Outlook calendar on my pc?  How can I get them to show up on my iphone again?

    Events that are in the past do not appear on my calnedar on my iphone.  Have I possibly changed a setting that caused them to disappear?  Can I get them back on my iphone as they do still appear on my Outlook calendar on my PC?

    Settings> Mail, Contacts, Calendars> in Calendar section change the Sync setting.

  • When I download a file I can't find it - ANYWHERE. I have changed settings, destinations, etc. it just disappears. How to fix??

    I had to uninstall my McAfee virus software and when I went to download to reinstall the saved/download file just disappears. I have changed settings per some previous posts, I have tried new destinations on my computer, I have restarted, I have disabled all add-ons, nothing seems to work. I have tried to install a new browser (Google Chrome) just to see if that works but I can't install that either since the download file disappears and I can't install anything! I even ran a search of my C: drive looking for any and all files that I have downloaded in last 2 days and it doesn't find anything. The saves are just going into the abyss! What can I do? How can I fix?

    You mention changing some settings. What were they?
    You could try turning off integrated virus scanning. This assumes that you have real-time virus scanning of files added to the file system via McAfee or another product.
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the filter box, type or paste '''scan''' and pause while the list is filtered
    (3) Double-click '''browser.download.manager.scanWhenDone''' to toggle its value.
    Besides the obvious -- that this setting points your AV software at the file -- it also marks the file as sourced from the web, which causes Windows to apply certain security restrictions to the file. If you find that this change resolves the issue, the file disappearance might have been due to your IE security settings for the Internet zone.

  • How to change status value in component system (maintenance project)?

    Hy Experts,
    we are facing a problem while stting up CHARM in a three system landscape:
    The error occurs wile attempting to create an IMG project:
    Longtext:
    Status values are different in source and target systems. See long text
    Message no. SOLAR_SPROJECT022
    Diagnosis
    When you create a customzing project in the component system, the Solution Manager project status values are copied. If these values do not yet exist in the component system, they are created. If they already exist, they are not changed.
    In this case, the copied  status values exist in the component system, but they may have a different meaning: their descriptions differ.
    Procedure
    Check the meaning of the status values and make them match. If this is not possible, create and use new status values to avoid inconsistencies.
    How can I check and change this settings in component systems?
    kind regards
    T. Uhl

    Hy Valdecir,
    thanks for urgent reply!
    Do you know where the status values in (each client) or centrally (SolMan?) could be modified?
    I think there are some changes to be done, cause there are all identically configured but none of them has a specific status description.
    thanks in advance
    kind regards
    Tom

  • A seeming small change by Verizon causes major monetary and unrecovera​ble damages

    A seeming small change by Verizon causes major monetary and unrecoverable damages
    Back, I think in March or so, Verizon changed how they bill. Prior to this time frame my elderly mom paid the phone bill and I paid the DSL bill. The DSL bill came on my name and I paid by credit card and the phone bill came under her name and she paid by direct debit. She will not use a computer.
    So, they make both bills on her name and won't change it. They did, however, allow the payment from my credit card.
    The first unfortunate consequence was the internet speed suddenly dropped in speed by a factor of 2 to 1.5/364 and it did take me probably a month to notice it. NO ONE that I called was able to find the problem. It took multiple attempts until some bright “call in technician” said the problem is on their end and could be fixed in software. Thus, I believe, because of the name change, the provision changed too. The phone line crapped out too at this time.
    The troubleshooting was stupid too. I took another modem and connected it directly to the NID and directly to the laptop and the technician on the phone said, it's either in your house or your modem and wanted to send me a new modem which they did. I don' get it. This is the wrong conclusion.
    This shows the need of modems like Westell 2200 and the Westell 6100 because of the ability to measure line statistics and provisioned data rates.
    Verizon sent me a D-link model DSL-2750B modem which I have to return because its just plain old stupid. It boasts Wireless n and the wired ports are 10/100. What's up with that? Next, there are no line stats and a horrible interface, akin to Verizon's website. Still can't figure out how to put it in Bridge mode. I own a D-link repeater and the interface is fine.
    I asked them what modem they would send me and they would not tell me, so I got whatever piece of junk they had lying around.
    I have now purchased a Network RAID array with no wireless access and with ~400 mb/s access rates. Yep, really stupid router.
    Because of the number of outages, I have to be able to quickly switch from a bridge connected modem, Westel 6100) to one that is connected in direct mode, a Westell 2200 It's almost easy, but not quite, since the equipment is up in the rafters in the laundry room. The DSL cable is commercial terminated CAT5, which is rare. The modem is within 6' of the NID.
    Plans include, the ability to switch the DSL line with a switch with positions for Modem #1 (Bridge), Modem #2(Wired), #3(RJ11 – Normal wiring) and #4: RJ-11 (Reverse wiring) and moving the direct connect jack for easy access. In any event, testing with the DSL modem at the NID is the gold standard.
    In progress, is a 48 port Gigabit patch panel for phone and Ethernet, A separate 24 port RED patch panel will be bridged for phone.
    I have already upgraded my network infrastructure to include a UPS for the network infrastructure and POE (Power over Ethernet) for the DSL modem. The UPS backup does not backup a repeater although it may in the future.
    Now, let's go back to this seeming innocuous billing change.
    So, this constant having to access the modem in the alternate configuration and a medical condition (migraines) that makes it hard to think clearly. So, in one of these episodes, I placed my laptop on top a container that was soaking laundry.
    So, the LCD screen has to be replaced at $300 and the battery had to be replaced. Then the Ethernet cord to the modem got pulled and caused the laptop to fall on the floor. It worked for a few weeks and then suffered an UNRECOVERABE hard drive crash.
    During this time frame, in fact over a 2 day period. My mom ended up in the hospital and to a rehab facility. My car ended up staying in the shop for a few days because of parts unavailability. My hard drive crashed and their was water in the basement. I don't have time for this.
    Recovery would have cost $2004.00, if it were possible. I only have a drive image from 2011 which I have yet to try to use. I' now running UBUNTU Live rather than Windows 7 Pro. Some of the very important stuff was backed up on Flash, but a lot of stuff is gone forever.
    Plans are to contact the billing office and the attorney general's office in the state where billing questions need to be resolved.
    The last outage, fixed on July 27, was flagged as a phone outage by Verizon, when 18 routers supposedly died. 18 routers suspiciously means that they they were not adequately protected against surges. Verizon should look at the way DelMarVa Power reports outages: see: Delmarva,  Put the usual World Wide Web Prefix and the COMercial domain suffix
    For god's sake, quit making the website circular. I though Yahoo was the expert in that. I never visit Verizon's website unless there are problems. I mistaking thought I could find outage information, say using my phone's browser. This time I had to purchase service from CLEAR internet to ride me through this fix.
    I know, you can't fix stupid and you can always find a better idiot. Comcast is looking more attractive.
    Compensation of or my loss I will probably never get, but maybe with the help of the attorney general I can get the billing fixed. I do have power of attorney. Now, of course, the name the Verizon Website addresses me as is not right on this forum.
    All, basically because of Verizon's unreliable network, incompetent people and the lack of maintenance of copper lines. The problem is, “We have little choice”. Currently, we need traditional land-line service to support an Emergency Response system. It's unclear whether digital phone lines support Faxes and alarm monitoring reliably.
    I'll bet that there is NO WAY to tell Verizon if a service address as special needs like Emergency Medical reporting via phone or Internet, so that priorities for repair can be done properly. Utilities have that capability. Those ares with people with oxygen generators or other medical equipment get a higher priority,

    That should not be happening.  I sympathize with both of you (you and the the person who strated this thread).  That sounds like the reason I would never want Dish. 
    I am fortunate that my service with Verizon Fios has been very reliable and that I haven't had too many issues over the years.  But don't get me started on Verizon Wireless.  I am through with doing any more business with them once my cell phone minutes run out.  I love it when they say they have done everything the could to investigate such a simple issue with running my debit card transaction wrong and blaming it on my bank, i.e. running it through as a "debit" when I choose "credit" all of a sudden now  two times in a row after 4 years of doing it right as "credit".  And now they consider the issue closed on their end when nothing has been resolved.  That's no way to treat a long time customer and I really felt treated like I was a bother to them.  It's not like I ever paid them much money for this pre-paid cell phone service that I have used infrequently but I was really mad at the way they just wrote this off and pretty much told me "too bad".  Talk about "customer non-service".  It's also very hard to track the number of minutes left on my balance.  I'm due for an upgrade anyway.  I want to switch to the I-Phone from this flip phone but never again with Verizon Wireless.  T-Mobile is way more attractive.  Verizon  Wireless is not only an entity separatedfrom Fios but it's definitely a much different animal and their customer service has really gone downhill.  When you're treated like they don't care, it's maddening.
    My customer service experience with Fios overall has been far superior to that most of the time.  My setup is simple and even though there are some people who will inevitably complain about anything just to vent, I definitely believe at least some of what is posted here.  And switching TV, phone, and Internet providers is a lot more involved than switching a cell phone provider. 

  • My Hard Disk setting has been changed into no access for everyone and i can't open my mac. please tell me how can i login as an admin to change the setting cause i have a lot of date in my hard drive.

    My Hard Disk setting has been changed into no access for everyone and i can't open my mac. please tell me how can i login as an admin to change the setting cause i have a lot of date in my hard drive.

    Read and follow Apple Support Communities contributor Niel's User Tip: kmosx: I accidentally set a disk's permissions to No Access

  • How to change name of software component version in IR and ID?

    Hi All,
    I have a scenario in which 50 interfaces are there.All interfaces are working fine and we are in Testing stage.
    I need to change name of Software component which I have used in IR.
    I tried with release transport. I am able to pass all my mapping programs and everything under new software component name. But in ID all configuration objects contain IR objects (Like interface mapping) with old software component name.
    Do I need to change everything in ID manually or is there any other way for this?
    Thanks in advance.
    Warm Regards,
    Gouri

    Gouri,
    If you check this blog , you are able to transfer data even without IR content, i.e, there is no message interface , no namespace in IR and stil this works. Reason, there is no validation if the message interafce exists in the IR. In the runtime the SOAP Header is filled with the interfacename and namespace and it uses these values.
    /people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
    Likewise, irrespective of which SWCV the interface name and namespace is, things will work fine as long as they exists in the IR in your case.
    The SWCV is a means to group objects, it might be displayed while doing the manual configuration but it doesnt matter even if you just key in the values without using the help.
    Things will work fine.
    Regards
    Bhavesh

  • The bookmark tab went from the right side to the left side. I did not change that. what cause the change from the right side to the left side?

    The bookmark tab went from the right side to the left side. I did not change that. what cause the change from the right side to the left side? Also the the Mozilla Firefox tab on the upper left hand corner changed.
    Its was a red colored tab and now its blue in color. I did not change any thing!

    Hey jimmiet,
    There were some recent ui changes around the downloads manager. What version where you on before? Anyway, you can customize things in Firefox really easily. Take a look at [[Customize Firefox controls, buttons and toolbars|this article on customizing Firefox]] for details. Should be a piece of cake to move the bookmarks button.
    As for the color of the button, you might be in [[Private Browsing - Browse the web without saving information about the sites you visit|Private Browsing]] mode. That changes the color of the button from orange to a purplish color.
    Matt

  • TS4268 Facetime was normally working on my iphone 4S, but when i changed my sim card it completely disappeared (ot even in settings)

    Facetime was normally working on my iphone 4S, but when i changed my sim card it completely disappeared (not even in settings).

    Hi
    I am also having the same problem. I purchased the iphone 5s (Unlocked) from kuwait. I can use the facetime in my zain sim (kuwait sim) when i change the sim in srilanka (Carrier Dialog) the face time app completely disappears. but in roaming for kuwait sim it works perfectly. before i have purchased iphone 4s from kuwait and it has facetime even in srilanka(carrier Dialog).
    Is there any issue with the apple software for 5s? becoz till today no one is able to answer this query?
    I hopefully expect a solid answer here....

  • ADF Faces - Change style for menuTab component

    How to change color for menuTab components (selected and enabled)?
    I do not want to create new style, all I need is just change some colors and fonts for default oracle style.
    I was able to change color for table, overridinf some styles in my css-file, but overriding
    <af_menuTabs_selected> and <af_menuTabs_enabled> did not work, because on generated html-page menuTab components do not use any styles. Is there any workaround to change color of that component?
    Thanks.

    public String commandButton_action() {
    ot_msg.setValue("Hello");
    AdfFacesContext.getCurrentInstance().addPartialTarget(ot_msg);
    The code above works fine but I nead also, in the method, to generate a excel file with JXLS librairie.
    The file can takes a long time to download and thus I want to change the value of outputText while the file is generating and not after.
    How can I do that ?
    Thanks

  • Volume changer on ipod touch music app disappeared

    the volume changer on my music app just disappeared, and now I don't know where the heck it went

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.

  • I was an Exchange student in the USA and I had a American Credit card. It expired, now back in the Netherlands I found out I still need to pay some bills. But I can't change credit cards, cause I'm not in the USA anymore

    Yeah, so I had a American credit card from bank of America, and I closed my bank account before I left the country.
    When I came home I found out I still need to pay like $2.00 but I can't change the country cause I need to pay my bill first,
    but I can't because I don't own a American credit card anymore... what do I do??

    Contact a friend in the USA and have them mail to you a cheap US iTunes Gift Card that you can redeem in your US account. Or, if a friend has an iTunes account, they can use the iTunes app on a Mac or PC to buy a cheap electronic gift certificate for you. The second option would be faster.

  • I accidentally deleted photos from my photo stream, causing them to disappear from my camera roll aswell. I am desperate to get these photos back. Is there any way I can recover them? Thanks

    Hi, I accidentally deleted photos from my photo stream, causing them to disappear from my camera roll aswell. I am desperate to get these photos back. Is there any way I can recover them? Thanks

    Hi Am1121,
    Welcome to the Apple Support Communities!
    If you have a backup of your iPhone on either iCloud or iTunes from the time when those photos were on the Camera Roll, you can restore from that backup and recover those photos. Please use the following article for information on restoring from backups.
    iOS: Back up and restore your iOS device with iCloud or iTunes
    http://support.apple.com/kb/HT1766
    Have a great day,
    Joe

  • Splitting events after batch date change causes event to disappear

    Hi all,
    The basic (repeatable) scenario is this:
    o I scan in a bunch of old pictures I want to keep in iPhoto (lets say 10)
    o I import them into iphoto (no problems with import) 1 event with 10 pictures is created.
    o I then take a specific set of 4 photos and split them out of the main event into a new event (everything still ok) - 2 events, 4 and 6 events respectively.
    o I open the new event and do a batch date change on the 4 pictures, changing the date to the correct date of the picture
    o I exit the event expecting it to move up in the list of events (I sort by date). It's gone! iPhoto lists the 1 new event and its 6 photos
    o I change my sort (by time, by name, etc) and still not there.
    o I find my library in finder, open the package, and the files are still there.
    o I go back to iPhoto and click on "Photos". Walla! 10 pictures!
    o I undo the data change and they show up again in events - 2 new events, 10 total pictures.
    I've already done all the obvious checks (are you sorting by date, look up by even name, search by file name through all events etc.) I've talked with a product specialist and they said the standard "rebuild the library" which did not resolve the issue.
    I can repeat this until the cows come home in the existing library. I've created a brand new library and it does not repeat, do there is something in my library not right. But I don't buy the standard "redo your library from scratch" (36K pictures, 50 faces and hundreds of places). Just like with faces, you can discard the db files, there must be something besides "rebuild automatically and if that doesn't work sorry start over". Was iPhoto coded in Redmond?
    Has anyone had anything similar to this? I looked through the forums and couldn't see anything. If I have to rebuild this, I am done with iPhoto after having to rebuild due to faces too many times, and my question changes to what are folks recommendations for a more stable photo management software suite?
    Thanks!
    HOTG

    If the problem doesn't repeat in another Library then obviously the issue is with that library.
    As you've tried the basic rebuild: Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    The obvious solution is to restore a good version from your back up and, er, Walla! as you say yourself.
    Next least destructive option: Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.
    Regards
    TD

Maybe you are looking for

  • StoreEvents always creating new event?

    Hey all, Our university recently upgraded to the newest version of the calendar server and so I've been going back to some old code I wrote that should now function correctly. However, I'm having an issue. The part of my program I'm currently dealing

  • Recurring file-permissions problems

    A problem has abruptly appeared and keeps (unpredictably) recurring.  When I edit a file and then save the modified version of that file, something breaks and when I try to reopen the file, later, I get a "you do not have permission to open this file

  • Links in email

    When I receive an email with a link in it, and  I click the link, I receive the following message: "This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator".  I would appreciate advic

  • Manual inspection lot with out specification

    Hi gurus,                 can anybody  give me an example for Manual inspection lot with out specification? regards, sbabu

  • COPA assessments

    Hey All Is there any way to reverse the signs in COPA assessments. For eg. FI has a balance of $100 which is to be assessed to COPA. When assessed the COPA gets the same value $100. Can I make some setting to change it to $100- in COPA. The record ty